Skip to content

Commit 5202024

Browse files
committed
quick comm
0 parents  commit 5202024

10 files changed

Lines changed: 834 additions & 0 deletions

.gitignore

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Python
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
*.so
6+
.Python
7+
env/
8+
build/
9+
develop-eggs/
10+
dist/
11+
downloads/
12+
eggs/
13+
.eggs/
14+
lib/
15+
lib64/
16+
parts/
17+
sdist/
18+
var/
19+
wheels/
20+
*.egg-info/
21+
.installed.cfg
22+
*.egg
23+
24+
# PyInstaller
25+
*.manifest
26+
*.spec
27+
28+
# Logs
29+
*.log
30+
31+
# Unit test / coverage reports
32+
htmlcov/
33+
.tox/
34+
.coverage
35+
.coverage.*
36+
.cache
37+
nosetests.xml
38+
coverage.xml
39+
*.cover
40+
.hypothesis/
41+
42+
# Jupyter Notebook
43+
.ipynb_checkpoints
44+
45+
# VS Code
46+
.vscode/
47+
*.code-workspace
48+
49+
# PyCharm
50+
.idea/
51+
52+
# Environment directories
53+
.env
54+
.venv
55+
venv/
56+
ENV/
57+
58+
# Operating System
59+
.DS_Store
60+
.DS_Store?
61+
._*
62+
.Spotlight-V100
63+
.Trashes
64+
ehthumbs.db
65+
Thumbs.db

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 NVDA/TSM Ratio Chart Contributors
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# NVDA/TSM Ratio Chart
2+
3+
A real-time chart application that displays and monitors the price ratio between NVIDIA (NVDA) and TSMC (TSM) stocks using Interactive Brokers API.
4+
5+
## Features
6+
7+
- Real-time price ratio monitoring
8+
- 100-minute historical data with 1-minute bars
9+
- 20-period moving average
10+
- Auto-updates every 10 seconds
11+
- Statistical analysis (mean, std, min, max)
12+
- Support for both real-time and delayed market data
13+
- Current local time display
14+
15+
## Requirements
16+
17+
- Python 3.8 or higher
18+
- Interactive Brokers TWS (Trader Workstation) or IB Gateway
19+
- Market data subscriptions for NVDA and TSM
20+
21+
## Installation
22+
23+
1. Clone the repository:
24+
```bash
25+
git clone https://github.com/yourusername/nvda-tsm-ratio-chart.git
26+
cd nvda-tsm-ratio-chart
27+
```
28+
29+
2. Install dependencies:
30+
```bash
31+
pip install -r requirements.txt
32+
```
33+
34+
## Usage
35+
36+
### Running from Source
37+
38+
1. Start TWS/Gateway and log in
39+
2. Run the script:
40+
```bash
41+
python stock_ratio_chart.py
42+
```
43+
44+
### Building Windows Executable
45+
46+
1. Install dependencies:
47+
```bash
48+
pip install -r requirements.txt
49+
```
50+
51+
2. Run the build script:
52+
```bash
53+
python build_simple.py
54+
```
55+
56+
3. Find the executable in the `dist` directory
57+
58+
### TWS/Gateway Setup
59+
60+
1. Open TWS/Gateway
61+
2. Go to File -> Global Configuration (or Configure in Gateway)
62+
3. Select "API" -> "Settings" in the left panel
63+
4. Enable "Socket port" and ensure it's set to 7497
64+
5. Check "Enable ActiveX and Socket Clients"
65+
6. Click "Apply" and "OK"
66+
67+
## Project Structure
68+
69+
```
70+
├── stock_ratio_chart.py # Main application script
71+
├── build_simple.py # Build script for Windows executable
72+
├── requirements.txt # Python dependencies
73+
├── README.md # Project documentation
74+
└── LICENSE # MIT License
75+
```
76+
77+
## Development
78+
79+
To contribute to this project:
80+
81+
1. Fork the repository
82+
2. Create a feature branch
83+
3. Make your changes
84+
4. Submit a pull request
85+
86+
## Troubleshooting
87+
88+
1. If the chart doesn't appear:
89+
- Verify TWS/Gateway is running and logged in
90+
- Check port 7497 is enabled for API connections
91+
- Ensure you have market data permissions for NVDA and TSM
92+
93+
2. If data isn't updating:
94+
- Check your internet connection
95+
- Verify market is open (US market hours)
96+
- Confirm data subscriptions are active in TWS
97+
98+
## License
99+
100+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
101+
102+
## Disclaimer
103+
104+
This software is for educational purposes only. Use at your own risk. The authors accept no responsibility for trading losses that may be incurred by using this software.

README.txt

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
NVDA/TSM Ratio Chart Application
2+
==============================
3+
4+
This application displays a real-time chart of the NVDA/TSM price ratio with 1-minute historical data.
5+
6+
Requirements:
7+
------------
8+
1. Interactive Brokers TWS (Trader Workstation) or IB Gateway must be running
9+
2. TWS/Gateway must be configured to accept API connections on port 7497
10+
3. Market data subscriptions for NVDA and TSM
11+
12+
Setup in TWS/Gateway:
13+
-------------------
14+
1. Open TWS/Gateway
15+
2. Go to File -> Global Configuration (or Configure in Gateway)
16+
3. Select "API" -> "Settings" in the left panel
17+
4. Enable "Socket port" and ensure it's set to 7497
18+
5. Check "Enable ActiveX and Socket Clients"
19+
6. Click "Apply" and "OK"
20+
21+
Usage:
22+
------
23+
1. Start TWS/Gateway and log in
24+
2. Double-click NVDA_TSM_Ratio_Chart.exe
25+
3. The chart will automatically:
26+
- Display 100 minutes of historical 1-minute data
27+
- Update every 10 seconds
28+
- Show current local time
29+
4. Close the chart window to exit the application
30+
31+
Features:
32+
--------
33+
- 100-minute historical data with 1-minute bars
34+
- NVDA/TSM price ratio plot
35+
- 20-period moving average
36+
- Real-time statistics (mean, std, min, max)
37+
- Auto-updates every 10 seconds
38+
- Current local time display
39+
40+
Troubleshooting:
41+
--------------
42+
1. If the chart doesn't appear:
43+
- Verify TWS/Gateway is running and logged in
44+
- Check port 7497 is enabled for API connections
45+
- Ensure you have market data permissions for NVDA and TSM
46+
47+
2. If data isn't updating:
48+
- Check your internet connection
49+
- Verify market is open (US market hours)
50+
- Confirm data subscriptions are active in TWS
51+
52+
Note: This application requires an active Internet connection and proper market data subscriptions in your Interactive Brokers account.

0 commit comments

Comments
 (0)