Skip to content

Commit

Permalink
update commission stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Carver committed Mar 19, 2024
1 parent 9e62731 commit 0de9d4e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sysbrokers/IB/client/ib_orders_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
13 changes: 9 additions & 4 deletions sysbrokers/IB/ib_broker_commissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from sysobjects.contracts import futuresContract

from syslogging.logger import *
from syscore.genutils import quickTimer

class ibFuturesContractCommissionData(brokerFuturesContractCommissionData):
"""
Expand Down Expand Up @@ -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"

0 comments on commit 0de9d4e

Please sign in to comment.