python - client terminating earlier in IbPy -


i trying run ibpy in linux server machine, using ibgateway connect api code ib.
ordering limit order, problem ibgateway terminating client connection.
places order connection closed, making me unable order status.
(this same code works when run in windows machine.)

the code using place order:

def place_single_order(self,order_type,action,lmtprice,expiry_date,quantity,conn) :     conn=connection.create(host='localhost', port=7496, clientid=1,receiver=ib, sender=none, dispatcher=none)     conn.connect()       conn.register(self.error_handler, 'error')     conn.register(self.executed_order, message.execdetails)     conn.register(self.validids,message.nextvalidid)     conn.register(self.my_order_status,message.orderstatus)     newcontract = contract()     newcontract.m_symbol = 'es'     newcontract.m_sectype = 'fut'     newcontract.m_exchange = 'globex'     newcontract.m_currency = 'usd'     newcontract.m_expiry = expiry_date     order = order()     order.m_action = action     order.m_totalquantity = quantity     order.m_transmit=true     order.m_ordertype = order_type  if lmtprice != 0 , order_type=='lmt' :         order.m_lmtprice=lmtprice      elif lmtprice != 0 , order_type=='stp' :         order.m_auxprice=lmtprice     else :         pass      oid=self.new_orderid(conn)     #this new orderid ib #     conn.placeorder(oid,newcontract,order) 

i think should add

time.sleep(10) 

after placed order see order status. , of course should register handler response message.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -