Not sure this didn't get caught in usage, but basically real-time
updates got broken by a rework of update_ledger_from_api_trades().
The issue is that the ledger was being updated before calling
piker.pp.update_pps_conf() which resulted in the Position.size
not being updated correctly since the [latest added] clears passed
in via the trade_records arg were already found in the .clears table
and thus were causing the loop to skip the Position.lifo_update()
call..
The solution here is to not update the ledger until after we call
update_pps_conf() - it's more read/writes but it's correct and we
figure out a less io heavy way to do the file writing later.
Further this includes a fix to avoid double emitting a pp update caused
by non-thorough logic that waits for a commission report to arrive
during a fill event; previously we were emitting the same message twice
due to the lack of a check for an existing comms report in the case
where the report arrives after the fill.
Not sure this didn't get caught in usage, but basically real-time updates got broken by a rework of
update_ledger_from_api_trades()
. The issue is that the ledger was being updated before callingpiker.pp.update_pps_conf()
which resulted in thePosition.size
not being updated correctly since the [latest added] clears passed in via thetrade_records
arg were already found in the.clears
table and thus were causing the loop to skip thePosition.lifo_update()
call..The solution here is to not update the ledger until after we call
update_pps_conf()
- it's more read/writes but it's correct and we figure out a less io heavy way to do the file writing later.Further this includes a fix to avoid double emitting a pp update caused by non-thorough logic that waits for a commission report to arrive during a fill event; previously we were emitting the same message twice due to the lack of a check for an existing comms report in the case where the report arrives after the fill.