Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prograsaur/ib-historical-data
Interactive Brokers TWS API -- Historical data downloader
https://github.com/prograsaur/ib-historical-data
example-app gui ibapi interactive-brokers python-3 python-3-6 python-script python3 tkinter tws
Last synced: about 3 hours ago
JSON representation
Interactive Brokers TWS API -- Historical data downloader
- Host: GitHub
- URL: https://github.com/prograsaur/ib-historical-data
- Owner: Prograsaur
- License: gpl-3.0
- Created: 2018-03-22T02:26:53.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-04-10T17:22:37.000Z (over 6 years ago)
- Last Synced: 2024-12-20T23:23:58.584Z (2 days ago)
- Topics: example-app, gui, ibapi, interactive-brokers, python-3, python-3-6, python-script, python3, tkinter, tws
- Language: Python
- Size: 30.3 KB
- Stars: 53
- Watchers: 2
- Forks: 17
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Interactive Brokers TWS API -- Historical bar data downloader
Interactive Brokers TWS API usage example.TWS API Guide http://interactivebrokers.github.io/tws-api/#gsc.tab=0
## Usage
1. Configure the TWS (see below)
2. Change ```config.py``` if necessary
2. Run: ```pythonw main.py```## Interactive Brokers Trader Workstation configuration
To allow connection between your application and TWS you have to set several options in the TWS configuration:
In the TWS window:
- File => Global configuration...
- Configuration => API => Settings
- [x] Enable ActiveX and Socket Clients
- [ ] Read-Only API
- [x] Download open orders on connection
- Socket Port: 7497
- [x] Expose entire trading schedule to API
- [x] Let API account requests switch user-visible account subscription
- Master API client ID: 0
- [x] Allow connections from the localhost only## Configuration
Edit config.py file directly to change the configuration.
## Interactive Brokers Client class
Client has to check not just messages from the TWS but messages from the GUI as well.
To do so I just copied the EClient.run() method body from the API code and
added onLoopIteration() hook call inside the EClient infinite loop.I'm using this hook to process messages from other sources (GUI), not just TWS.
Uncomment self.onIdle() to create another hook to process something while
no messages are comming from the TWS.