Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pps postmortem #347

Merged
merged 5 commits into from
Jul 4, 2022
Merged

Pps postmortem #347

merged 5 commits into from
Jul 4, 2022

Conversation

goodboy
Copy link
Contributor

@goodboy goodboy commented Jul 2, 2022

Repairs from #336 mostly in the Position.minimize_clears() logic which was previously incorrect: the arithmetic needed to be inverted and the final zero-ing event included.

Some further tiny cleanups in the ib backend code.
Oh, and a change to the ems's position caching table / relaying to prep for #346.

goodboy added 4 commits July 2, 2022 16:14
This was just implemented totally wrong but somehow worked XD

The idea was to include all trades that contribute to ongoing position
size since the last time the position was "net zero", i.e. no position
in the asset. Adjust arithmetic to *subtract* from the current size
until a zero size condition is met and then keep all those clears as
part of the "current state" clears table.

Additionally this fixes another bug where the positions freshly loaded
from a ledger *were not* being merged with the current `pps.toml` state.
@goodboy goodboy added clearing auction and mm tech: EMS, OMS, algo-trading ledger trade, accounts and other user focal event history tracking, management and storage labels Jul 2, 2022
@goodboy goodboy requested review from guilledk and iamzoltan July 2, 2022 20:19
@goodboy goodboy marked this pull request as ready for review July 2, 2022 20:19
).setdefault(
pos_msg['account'], {}
).update(pos_msg)
(broker, sym),
Copy link
Contributor Author

@goodboy goodboy Jul 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So instead of a table of tables we just do a flat table with a tuple[str, str] of the broker and symbol.

'''
size: float = 0
size: float = self.size
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the subtract change below were the main issue with getting the pps.toml clears tables per position correct..

@goodboy goodboy merged commit 479ad1b into master Jul 4, 2022
@goodboy goodboy deleted the pps_postmortem branch July 4, 2022 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clearing auction and mm tech: EMS, OMS, algo-trading ledger trade, accounts and other user focal event history tracking, management and storage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants