Skip to content

Commit

Permalink
Reset the clears table on zero size conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Jun 22, 2022
1 parent 2452f45 commit 20ca7c4
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions piker/pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 20ca7c4

Please sign in to comment.