def broker_limit_price(self): self.ibclient.refresh() ib_broker_order = create_broker_order_from_trade_with_contract( self.trade_with_contract_from_IB, self.order.instrument_code) if ib_broker_order.limit_price == 0.0: broker_limit_price = None else: broker_limit_price = ib_broker_order.limit_price return broker_limit_price
def update_order(self): # Update the broker order using the control object # Can be used when first submitted, or when polling objects # Basically copies across the details from the control object that are # likely to be updated self.ibclient.refresh() ib_broker_order = create_broker_order_from_trade_with_contract( self.trade_with_contract_from_IB, self.order.instrument_code) updated_broker_order = add_trade_info_to_broker_order( self.order, ib_broker_order) self._order = updated_broker_order
def __init__(self, trade_with_contract_from_ib: tradeWithContract, ibclient: ibOrdersClient, broker_order: brokerOrder = None, instrument_code: str = None, ticker_object: tickerObject = None): if broker_order is None: # This might happen if for example we are getting the orders from # IB broker_order = create_broker_order_from_trade_with_contract( trade_with_contract_from_ib, instrument_code) super().__init__(control_object=trade_with_contract_from_ib, broker_order=broker_order, ticker_object=ticker_object) self._ibclient = ibclient