Assert conditions like a nerd

explicit_write_pps_on_exit
jaredgoldman 2023-02-28 13:31:17 -05:00
parent d7317c3710
commit 973c068e96
1 changed files with 9 additions and 6 deletions

View File

@ -122,12 +122,15 @@ def _assert(
''' '''
if assert_entries: if assert_entries:
assert last_msg['broker'] == broker for key, val in [
assert last_msg['account'] == account ('broker', broker),
assert last_msg['symbol'] == fqsn ('account', account),
assert last_msg['size'] == size * executions ('symbol', fqsn),
assert last_msg['currency'] == symbol ('size', size * executions),
assert last_msg['avg_price'] == table.pps[symbol].ppu ('currency', symbol),
('avg_price', table.pps[symbol].ppu)
]:
assert last_msg[key] == val
if assert_pps: if assert_pps:
last_ppu = pps[(broker, account)][-1] last_ppu = pps[(broker, account)][-1]