Giter Site home page Giter Site logo

ib's Introduction

GoIB

Build Status GoDoc Coverage Status

This is a pure Go interface to Interactive Brokers IB API. Features include:

  • 100% pure Go (no Java/C calls)
  • Idiomatic design (Go naming conventions, channels, error handling etc)
  • Choice of low-level types or our high-level Manager types
  • Extensively tested (test coverage via Coveralls, CI via Drone, local test server)
  • Documentation on GoDoc
  • Reflects very up-to-date IB API version

We welcome your involvement and contributions! If you like the project, please click the GitHub "Star" or "Fork" button. We also invite you to join the contributor list by submitting pull requests.

Status

  • The code presently supports IB API 971.01 (latest as of March 2014)
  • All reply types (see ereader.go) are supported
  • Some request types (see eclientsocket.go) require porting

Testing

go test requires IB Gateway be running at 127.0.0.1:4002 and providing access to a financial advisor account. Always use a demo or paper trade account, as the tests may modify your account.

The easiest way to start IB Gateway with a financial advisor demo account is to use the test server. Have a look at the test server instructions for all the details.

By default the tests produce no output. If you'd like to view engine communication logs during test execution, set the IB_ENGINE_DUMP environment variable to any value. For example, IB_ENGINE_DUMP=t go test.

If you fork this project and would like to configure Drone and Coveralls for your fork, our Drone instructions should be of help.

License

This library is licensed under GNU Lesser General Public License version 3.

Static linking exception: The copyright holders give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you must extend this exception to your version of the library.

  • This library is safe for use in close-source applications. The LGPL share-alike terms do not apply to applications built on top of this library.
  • You do not need a commercial license. The LGPL applies to the library's own source code, not your applications.

ib's People

Contributors

benalexau avatar creack avatar dimfeld avatar dsouzae avatar haohui avatar indrekj avatar joelreymont avatar nothize avatar p-lewis avatar typeless avatar uwe avatar

Watchers

 avatar  avatar

Forkers

dimfeld

ib's Issues

TestInstrumentManager result in "Waited 5 seconds for reply channel 0xc42006d200"

Procedure:

GATEWAY_URL=localhost:4002 go test -run TestInstrumentManager -v

Expected result:

Test should complete and success.

Actual result (the test is not end and the message is showed repeatedly):

=== RUN TestInstrumentManager
2017/06/13 22:45:56 Waited 5 seconds for reply channel 0xc42006d200

Findings:

  1. 8a68c49 tries to fix the infinity loop when the errors channel is being closed. (Reading from a closed channel will return immediately with ok as false, so it prevents other cases from being processed)
  2. However, the defer block will only execute after errors being set to nil and reading from a nil channel will wait forever thus the EngineState observer is never unsubscribed from the Engine which cause infinity loop in the defer block of Engine's main loop.

Solution:

  1. Setting nil to the closed channel errors to prevent the case from preempting the select block is correct, though can be done right after close(errors).
  2. Reading from errors from the defer block works if errors is not nil, so a better alternative is to add a new channel to synchronise between the preLoop goroutine and defer block.

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.