Only log about pps once in order mode code

rekt_pps
Tyler Goodlet 2023-04-05 11:58:52 -04:00
parent 5ee044e418
commit 1d2d4b40a8
1 changed files with 7 additions and 5 deletions

View File

@ -871,7 +871,6 @@ async def open_order_mode(
# the expected symbol key in its positions msg. # the expected symbol key in its positions msg.
for (broker, acctid), msgs in position_msgs.items(): for (broker, acctid), msgs in position_msgs.items():
for msg in msgs: for msg in msgs:
log.info(f'Loading pp for {acctid}@{broker}:\n{pformat(msg)}')
await process_trade_msg( await process_trade_msg(
mode, mode,
book, book,
@ -956,13 +955,16 @@ async def process_trade_msg(
): ):
sym = mode.chart.linked.symbol sym = mode.chart.linked.symbol
pp_msg_symbol = msg['symbol'].lower() pp_msg_symbol = msg['symbol'].lower()
fqsn = sym.fqme fqme = sym.fqme
broker = sym.broker broker = sym.broker
if ( if (
pp_msg_symbol == fqsn pp_msg_symbol == fqme
or pp_msg_symbol == fqsn.removesuffix(f'.{broker}') or pp_msg_symbol == fqme.removesuffix(f'.{broker}')
): ):
log.info(f'{fqsn} matched pp msg: {fmsg}') log.info(
f'Loading position for `{fqme}`:\n'
f'{fmsg}'
)
tracker = mode.trackers[msg['account']] tracker = mode.trackers[msg['account']]
tracker.live_pp.update_from_msg(msg) tracker.live_pp.update_from_msg(msg)
tracker.update_from_pp(set_as_startup=True) # status/pane UI tracker.update_from_pp(set_as_startup=True) # status/pane UI