GithubHelp home page GithubHelp logo

yipjustin / swigibpy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from komnomnomnom/swigibpy

0.0 1.0 0.0 227 KB

Third party Interactive Brokers Python API generated from TWS C++ API using SWIG.

Home Page: http://github.com/Komnomnomnom/swigibpy/

License: Other

swigibpy's Introduction

Overview

Interactive Brokers Python API, auto generated from C++ API using SWIG.

Latest version: 0.4 (TWS API v9.67)

Install

Use pip (recommended):

$ pip install swigibpy

Alternatively download your archive of choice and run:

$ python setup.py install

Notes for Windows Users

swigibpy just provides a wrapper around the TWS C++ API so this needs to be compiled for your target platform during installation. While this should 'just work' for Linux and OSX, Windows users might need to do some extra work.

Compile with MinGW

Download and install MinGW and follow the steps to add MinGW to your path. Note there is a compatability problem between the latest version of MinGW and disutils so it is recommended to install an older version until this is resolved (mingw-get-inst-20110802.exe has been known to work).

To get pip to use MinGW as the compiler edit or create a file named distutils.cfg in [PYTHON LOCATION]\Lib\distutils where [PYTHON LOCATION] is the path to your Python install, e.g. C:\Python27. Add the following to distutils.cfg:

[build]
compiler=mingw32

then use the pip command above and with a bit of luck, you're done!

Alternatively you can download and build the package directly. To build and install use:

$ python setup.py build -c mingw32
$ python setup.py install

This has been verified to work using MinGW and Python 2.7 on Windows 7, Vista, and XP.

Compile with Visual Studio

Several users have reported success building swigibpy with Visual Studio, with a few caveats:

  • Distutils has issues building with anything later than Visual Studio 2008 (version 9).
  • The MFC library is required by the TWS API.
  • Visual Studio 11 doesn't like the /MD compile flag, which distutils adds. For a workaround see here.

Usage

To use simply import the swigibpy module, see the examples directory for more. For API reference refer to the C++ API documentation.

By default swigibpy will automatically poll TWS for messages. If you wish to handle polling yourself, swigibpy's polling can be disabled using the poll_auto argument:

tws.eConnect("", 7496, 42, poll_auto=False)

Notes

The yield parameter in CommissionReport clashes with a Python reserved keyword so it is renamed to _yield.

Develop

Contributions are welcome! For developement you can build the extension in the current dir:

$ python setup.py build_ext --build-lib .

To regenerate the SWIG wrappers (SWIG 2.0+ required), in the IB API directory run:

$ swig -v -c++ -python -threads -keyword -w511 -o swig_wrap.cpp 
    -outdir .. -modern -fastdispatch -nosafecstrings -noproxydel 
    -fastproxy -fastinit -fastunpack -fastquery -modernargs -nobuildnone 
    ../swigify_ib.i

NOTE: SWIG options -builtin and -fvirtual are not compatible with swigibpy's interface file.

License

swigibpy original code is free software under the New BSD license.

Interactive Brokers propriety C++ API is copyright Interactive Brokers LLC. swigibpy is in no way supported or endorsed by Interactive Brokers LLC.


swigibpy's People

Contributors

aidoom avatar komnomnomnom avatar olafsep01 avatar

Watchers

 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.