Sha256: ba59891c5850a291a781d7be8172c94ef350dd9254e904e68cbb0917844d7d8d
Contents?: true
Size: 1009 Bytes
Versions: 1
Compression:
Stored size: 1009 Bytes
Contents
#!/usr/bin/env ruby # # The Head Time Stamp -Request returns the first available date for historical data requests require 'bundler/setup' require 'ib/symbols' # First, connect to IB TWS and subscribe for events. ib = IB::Connection.new :client_id => 1112 do | gw | #, :port => 7497 # TWS # Subscribe to TWS alerts/errors gw.subscribe(:Alert, :HeadTimeStamp) { |msg| puts msg.to_human } # Set log level gw.logger.level = Logger::FATAL # DEBUG -- INFO -- WARN -- ERROR -- FATAL end # # We demonstrate it with Apple # ib.send_message :RequestHeadTimeStamp, contract: IB::Symbols::Stocks.aapl ib.wait_for :HeadTimeStamp puts " First datatset for #{IB::Symbols::Stocks.aapl.description} : #{ib.received[:HeadTimeStamp].date.join( " " )} " Thread.new do sleep 1 puts "\n******** Press <Enter> to quit *********\n\n" end STDIN.gets puts "\n *** canceling Reqest ..." ib.send_message :CancelHeadTimeStamp # .. puts "Printing all gathered data \n\n" pp ib.received[ :HeadTimeStamp ]
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ib-symbols-1.0 | examples/head_time_stamp |