Git Product home page Git Product logo

ib-historical-data's Introduction

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
  3. 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
  • Enable ActiveX and Socket Clients
  • Read-Only API
  • Download open orders on connection
  • Socket Port: 7497
  • Expose entire trading schedule to API
  • Let API account requests switch user-visible account subscription
  • Master API client ID: 0
  • 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.

ib-historical-data's People

Contributors

prograsaur avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.