Sha256: df7d6eadefabc30e006fdcf3611650048f9d8112af2c5c487793f888ad854702
Contents?: true
Size: 837 Bytes
Versions: 1
Compression:
Stored size: 837 Bytes
Contents
#!/usr/bin/env ruby # # This script places WFC buy order for 100 lots require 'rubygems' require 'pathname' require 'bundler/setup' require 'ib-ruby' # First, connect to IB TWS. Arbitrary :client_id is used to identify your script ib = IB::Connection.new :client_id => 1112 #, :port => 7496 # TWS # Subscribe to TWS alerts/errors and order-related messages ib.subscribe(:Alert, :OpenOrder, :OrderStatus) { |msg| puts msg.to_human } wfc = IB::Symbols::Stocks[:wfc] buy_order = IB::Order.new :total_quantity => 100, :limit_price => 1 + rand().round(2), :action => 'BUY', :order_type => 'LMT' ib.wait_for :NextValidId ib.place_order buy_order, wfc ib.send_message :RequestAllOpenOrders puts "\n******** Press <Enter> to cancel... *********\n\n" STDIN.gets
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ib-ruby-0.7.4 | bin/place_order |