Skip to content

kvokka/interactive_brokers

Repository files navigation

CircleCI Gem Version

InteractiveBrokers

This allow to communicate with Interactive Brokers (further IB) trough HTTP. This gem contains 3 gems:

  • interactive_brokers_app - Server application (proxy) which will communicate with IB and serve clients requests.
  • interactive_brokers_generator - Code generator for further TWS API upgrades
  • interactive_brokers_common - Client part extensions, which should help to make correct request on the client side with out any knowledge of server side internals

Request life cycle looks like:

client => interactive_brokers_app => IB Gateway (async wait) => responce to the client

All long-processing requests have some Id field (requestId, orderId or something like it, will name it just ID later on). Presence of the ide will determine the request type.

  1. Requests where ID is mot mandatory are treated as fast (or the server side responce does not matter), so they are not concurrent by the design of IB Gateway
  2. Requests with ID will gather all the responses in the context of this ID.

It is the client's responsibility to provide uniq ID. Unfortunately, embedded IB function NextValidId will not support concurrency correctly with external API calls.

Current progress

Gem use 976.01 API version

NOTE: All functions naming is from Java official API doc. URI paths for corresponding functions will be the same.

Global functions

  • reqOpenOrders
  • reqAccountUpdates
  • reqIds
  • reqNewsBulletins
  • cancelNewsBulletins
  • setServerLogLevel
  • reqAutoOpenOrders
  • reqAllOpenOrders
  • reqManagedAccts
  • reqScannerParameters
  • reqCurrentTime
  • reqMarketDataType
  • reqGlobalCancel
  • reqPositions
  • cancelPositions
  • reqFamilyCodes
  • reqMktDepthExchanges
  • reqNewsProviders
  • reqMarketRule
  • reqCompletedOrders

Functions with ID

  • reqContractDetails
  • placeOrder
  • reqMktData
  • cancelMktData
  • cancelOrder
  • reqExecutions
  • reqMktDepth
  • cancelMktDepth
  • reqHistoricalData
  • exerciseOptions
  • cancelHistoricalData
  • reqRealTimeBars
  • cancelRealTimeBars
  • cancelScannerSubscription
  • reqScannerSubscription
  • reqFundamentalData
  • cancelFundamentalData
  • calculateImpliedVolatility
  • calculateOptionPrice
  • cancelCalculateImpliedVolatility
  • cancelCalculateOptionPrice
  • reqAccountSummary
  • cancelAccountSummary
  • queryDisplayGroups
  • subscribeToGroupEvents
  • updateDisplayGroup
  • unsubscribeFromGroupEvents
  • reqPositionsMulti
  • cancelPositionsMulti
  • reqAccountUpdatesMulti
  • cancelAccountUpdatesMulti
  • reqSecDefOptParams
  • reqSoftDollarTiers
  • reqMatchingSymbols
  • reqSmartComponents
  • reqNewsArticle
  • reqHistoricalNews
  • reqHeadTimestamp
  • cancelHeadTimestamp
  • reqHistogramData
  • cancelHistogramData
  • reqPnL
  • cancelPnL
  • reqPnLSingle
  • cancelPnLSingle
  • reqHistoricalTicks
  • reqTickByTickData
  • cancelTickByTickData

Installation

Add this line to your application's Gemfile:

gem 'interactive_brokers'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install interactive_brokers

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/interactive_brokers. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the InteractiveBrokers project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About

Interactive brokers API Access through HTTP

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published