diff --git a/sysbrokers/IB/client/ib_orders_client.py b/sysbrokers/IB/client/ib_orders_client.py index 52ea136894..4f65bd521c 100644 --- a/sysbrokers/IB/client/ib_orders_client.py +++ b/sysbrokers/IB/client/ib_orders_client.py @@ -140,7 +140,7 @@ def _build_ib_order( ) -> ibOrder: ib_BS_str, ib_qty = resolveBS_for_list(trade_list) - if order_type is market_order_type: + if order_type == market_order_type: ib_order = ibMarketOrder(ib_BS_str, ib_qty) elif order_type is limit_order_type: if limit_price is None: diff --git a/sysbrokers/IB/ib_broker_commissions.py b/sysbrokers/IB/ib_broker_commissions.py index cfd57387bb..a2f5052699 100644 --- a/sysbrokers/IB/ib_broker_commissions.py +++ b/sysbrokers/IB/ib_broker_commissions.py @@ -6,6 +6,7 @@ from sysobjects.contracts import futuresContract from syslogging.logger import * +from syscore.genutils import quickTimer class ibFuturesContractCommissionData(brokerFuturesContractCommissionData): """ @@ -48,11 +49,15 @@ def get_commission_for_contract(self, futures_contract: futuresContract) -> floa order = self.execution_stack.put_what_if_order_on_stack(broker_order) - while not self.execution_stack.is_completed(order.order.order_id): + timer = quickTimer(5) + while timer.unfinished: ## could last forever! - continue + commission = order.order.commission + commission_ccy = order.order.trade_with_contract_from_ib - order_from_stack = self.execution_stack.get_order_with_id_from_stack(order_id=order.order.order_id) - return order_from_stack.commission / 10.0 + print(commission) + print(commission_ccy) + + return commission / 10.0 test_commission_strategy = "testCommmission"