Sha256: 7c69237bc1bfbb612ea44643ff37b105dcd4912cf41b11f8cdc974cad5e1dfb5
Contents?: true
Size: 975 Bytes
Versions: 10
Compression:
Stored size: 975 Bytes
Contents
#!/usr/bin/env ruby # This script reproduces https://github.com/ib-ruby/ib-ruby/issues/12 require 'rubygems' require 'bundler/setup' $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') require 'ib-ruby' contract = IB::Contract.new :symbol=> 'AAPL', :exchange=> "Smart", :currency=> "USD", :sec_type=> :stock, :description=> "Some stock" # First, connect to IB TWS. Arbitrary :client_id is used to identify your script ib = IB::Connection.new :client_id => 1112 #, :port => 7496 # TWS ib.subscribe(:Alert) { |msg| puts msg.to_human } ib.subscribe(:TickGeneric, :TickString, :TickPrice, :TickSize) { |msg| puts msg.inspect } ib.send_message :RequestMarketData, :id => 123, :contract => contract puts "\nSubscribed to market data" puts "\n******** Press <Enter> to cancel... *********\n\n" gets puts "Cancelling market data subscription.."
Version data entries
10 entries across 10 versions & 1 rubygems