Skip to content
@ib-ruby

ib-ruby

IB-Ruby

Ruby Implementation of the Interactive Brokers Trader Workstation (TWS) API.

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

A plain vanilla access is provided through ib-api.
ib-api sends Messages to the TWS-API and stores the response in a received-array. The program just waits for the correct response

the_stock =  IB::Stock.new symbol: 'GE'
limit_order = IB::Order.new  limit_price: 35, order_type: 'LMT',  total_quantity: 100, action: :buy
ib.send_message :PlaceOrder,
        :order => limit_order,
        :contract => the_stock,
        :local_id => ib.next_local_id

# wait until the orderstate message returned
ib.wait_for :OrderStatus

Alternatively, its possible to subscribe to certain messages

ib.subscribe(:Alert, :ContractData, :ContractDataEnd ) do |msg| 
	case msg
	when Messages::Incoming::Alert
		  # do something asynchronous
	when Messages::Incoming::ContractDataEnd 
       # do something asyncronous
  else
      # asynchronous response to ContractData
  end  
 end
 # perform request
 request_id = ib.send_message :RequestContractData, :contract => Stock.new(symbol: 'T')

IB-Gateway

To ease the access of the data on the tws-servers, ib-extensions provides helpers and macros

  • Verifiyng of contracts
  • get Market-Price, Option-Greeks from a single contract
  • load EOD-Data
  • define Ordertypes, ie. Limit.order, Stop.order ...
  • easily define Straddles, Strangles, Calendars, Butterflies and other option-spreads

Popular repositories

  1. ib-ruby ib-ruby Public archive

    Historic Ruby interface to Interactive Brokers' TWS API

    Ruby 124 59

  2. ib-api ib-api Public

    Lightweight Ruby interface to Interactive Brokers' TWS API

    Ruby 17 9

  3. ib-container ib-container Public

    Provides a Container executing TWS/Gateway in an isolated environment.

    Shell 10 1

  4. simple-monitor simple-monitor Public

    Web Interface to a IB-Account(s). Can be accessed with a terminal.

    Ruby 7 2

  5. ib-trading-system ib-trading-system Public

    Automatic trading on interactive brokers tws

    Ruby 4

  6. ib-technical-analysis ib-technical-analysis Public

    A library for performing technical analysis

    Ruby 2 1

Repositories

Showing 10 of 14 repositories

Top languages

Loading…

Most used topics

Loading…