Skip to content

ib-ruby/ib-extensions

Repository files navigation

IB/Extensions


Documentation: https://ib-ruby.github.io/ib-doc/

Questions, Contributions, Remarks: Discussions are opened in ib-api


Helpers and Macros that ease the usage of the TWS-API of Interactive Brokers

To activate use

gem 'ib-extensions'

in the Gemfile and require the extensions as needed

Include all

(except gateway)

require 'ib-api'
require 'ib/extensions'

Verify

require 'ib-api'
require 'ib/verify'

Verifies a given contract, for details refer to the documentation

Market Price

require 'ib-api'
require 'ib/market-price'

Returns the most recent market-price of a given contract ( documentation )

Historical Data (EOD)

require 'ib-api'
require 'ib/eod'

puts IB::Symbols.Index.estx.eod( duration: '10 d' )

Fetch historical data with just one line of code (documentation )

Order Prototypes

require 'ib-api'
require 'ib/order-prototypes'

order = IB::Limit.order size: 100, price: 10, action: :buy
order = IB::StopLimit.order size: 100, price: 10, stop_price: 9.5

then transmit the order through the place_order method of IB::Connection or Account-based preview, place, modify and cancel methods of IB::Gateway.

More details in the documentation

Spread Prototypes

require 'ib-api'
require 'ib/spread-prototypes'

Compose most common spreads through

s = IB::Straddle.build from: IB::Symbols::Index.stoxx, 
                            strike: 2400, 
                            expiry: 202103 
                            
s = IB::Strangle.build from: IB::Symbols::Index.stoxx, 
                            c: 2400, p: 2200, 
                            expiry: 202103 

and use the speads like any other contract. (documentation

Gateway

require 'ib-gateway'

IB::Gateway is an alternative to IB::Connection. Upon initialization, it detects active accounts and stores them in a thread safe array. Details in the documentation

Its used in Simple Monitor

Contributing

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

Code of Conduct

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

About

Helpers and Macros that ease the usage of the TWS-API of Interactive Brokers through IB-Ruby

Topics

Resources

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages