Reset the clears table on zero size conditions

lifo_pps_ib
Tyler Goodlet 2022-06-22 18:54:23 -04:00
parent f9c4b3cc96
commit 566a54ffb6
1 changed files with 11 additions and 7 deletions

View File

@ -310,13 +310,17 @@ def update_pps(
cost=2*r.cost,
)
# track clearing data
pp.clears[r.tid] = {
'cost': r.cost,
'price': r.price,
'size': r.size,
'dt': str(r.dt),
}
if pp.size == 0:
pp.clears.clear()
else:
# track clearing data
pp.clears[r.tid] = {
'cost': r.cost,
'price': r.price,
'size': r.size,
'dt': str(r.dt),
}
assert len(set(pp.clears)) == len(pp.clears)
return pps