Move details assignements to static declaration

ems_to_bidir_streaming
Tyler Goodlet 2021-06-10 08:24:51 -04:00
parent b06cb5bb5a
commit a9cbacd8aa
1 changed files with 3 additions and 7 deletions

View File

@ -1352,12 +1352,10 @@ async def trades_dialogue(
'contract': asdict(fill.contract), 'contract': asdict(fill.contract),
'execution': asdict(fill.execution), 'execution': asdict(fill.execution),
'commissions': asdict(fill.commissionReport), 'commissions': asdict(fill.commissionReport),
'broker_time': execu.time, # supposedly IB server fill time
'name': 'ib',
} }
# supposedly IB server fill time
details['broker_time'] = execu.time
details['name'] = 'ib'
msg = BrokerdFill( msg = BrokerdFill(
# should match the value returned from `.submit_limit()` # should match the value returned from `.submit_limit()`
reqid=execu.orderId, reqid=execu.orderId,
@ -1369,7 +1367,7 @@ async def trades_dialogue(
broker_details=details, broker_details=details,
# XXX: required by order mode currently # XXX: required by order mode currently
broker_time=details['execution']['time'], broker_time=details['broker_time'],
) )
@ -1391,9 +1389,7 @@ async def trades_dialogue(
elif event_name == 'position': elif event_name == 'position':
msg = pack_position(item) msg = pack_position(item)
# msg = BrokerdPosition(**item)
# if msg.get('reqid', 0) < -1:
if getattr(msg, 'reqid', 0) < -1: if getattr(msg, 'reqid', 0) < -1:
# it's a trade event generated by TWS usage. # it's a trade event generated by TWS usage.