-
Notifications
You must be signed in to change notification settings - Fork 17
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
Pps postmortem #347
Conversation
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.
).setdefault( | ||
pos_msg['account'], {} | ||
).update(pos_msg) | ||
(broker, sym), |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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..
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.