Sha256: c26b64840b3931c99b5fe61aeed8cedce9493ae42b3387cfb442951e7612a0d2
Contents?: true
Size: 780 Bytes
Versions: 4
Compression:
Stored size: 780 Bytes
Contents
#!/usr/bin/env ruby # # This script connects to IB API, subscribes to account info and prints out # messages received from IB (update every 3 minute or so) require 'pathname' LIB_DIR = (Pathname.new(__FILE__).dirname + '../lib/').realpath.to_s $LOAD_PATH.unshift LIB_DIR unless $LOAD_PATH.include?(LIB_DIR) require 'rubygems' require 'bundler/setup' require 'ib-ruby' # First, connect to IB TWS. ib = IB::Connection.new :client_id => 0 # Subscribe to TWS alerts/errors and order-related messages @counter = 0 ib.subscribe(:Alert, :OrderStatus) { |msg| puts msg.to_human } ib.subscribe(:OpenOrder) do |msg| @counter += 1 puts "#{@counter}: #{msg.to_human}" end ib.send_message :RequestAllOpenOrders puts "\n******** Press <Enter> to cancel... *********\n\n" STDIN.gets
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ib-ruby-0.5.18 | bin/list_orders |
ib-ruby-0.5.17 | bin/list_orders |
ib-ruby-0.5.16 | bin/list_orders |
ib-ruby-0.5.15 | bin/list_orders |