bin/console in ib-extensions-1.2 vs bin/console in ib-extensions-1.3

- old
+ new

@@ -63,11 +63,12 @@ ARGV.clear ## The Block takes instructions which are executed after initializing all instance-variables ## and prior to the connection-process - ## Here we just subscribe to some events + ## Here we just subscribe to some events + begin C = Connection.new client_id: client_id, port: port do |c| # future use__ , optional_capacities: "+PACEAPI" do |c| c.subscribe( :ContractData, :BondContractData) { |msg| c.logger.info { msg.contract.to_human } } c.subscribe( :Alert, :ContractDataEnd, :ManagedAccounts, :OrderStatus ) {| m| c.logger.info { m.to_human } } c.subscribe( :PortfolioValue, :AccountValue, :OrderStatus, :OpenOrderEnd, :ExecutionData ) {| m| c.logger.info { m.to_human }} @@ -75,12 +76,12 @@ # puts "------------------------------- Managed Accounts ----------------------------------" # puts "Detected Accounts: #{msg.accounts.account.join(' -- ')} " # puts # end - c.subscribe( :OpenOrder){ |msg| "Open Order detected and stored: C.received[:OpenOrders] " } - c.logger.level = Logger::INFO + c.subscribe( :OpenOrder){ |msg| c.logger.info "Open Order detected and stored: C.received[:OpenOrders] " } + c.logger.level = Logger::WARN # set to INFO for more verbose output end unless C.received[:OpenOrder].blank? puts "------------------------------- OpenOrders ----------------------------------" puts C.received[:OpenOrder].to_human.join "\n" end @@ -88,7 +89,13 @@ puts puts "----> C points to the connection-instance" puts puts "some basic Messages are subscribed and accordingly displayed" puts '-'* 45 + + rescue IB::TransmissionError => e + Connection.logger.fatal e.message + Connection.logger.fatal "Aborting" + Kernel.exit + end IRB.start(__FILE__)