piker/piker/accounting
Tyler Goodlet b0e2db902e Don't override `Account.pps: dict` entries..
Despite a `.bs_mktid` ideally being a bijection with `MktPair.fqme`
values, apparently some backends (cough IB) will switch the .<venue>`
part in txn records resulting in multiple account-conf-file sections for
the same dst asset. Obviously that means we can't allocate new
`Position` entries keyed by that `bs_mktid`, instead be sure to **update
them instead**!

Deats,
- add case logic to avoid pp overwrites using a `pp_objs.get()` check.
- warn on duplicated pos entries whenever the current account-file
  entry's `mkt` doesn't match the pre-existing position's.
- mk `Position.add_clear()` return a `bool` indicating if the record was
  newly added, warn when it was already existing/added prior.

Also,
- drop the already deprecated `open_pps()`, also from sub-pkg exports.
- draft TODO for `Position.summary()` idea as a replacement for
  `BrokerdPosition`-msgs.
2026-01-02 20:44:46 -05:00
..
README.rst Officially drop `Position.size` 2023-08-03 16:57:02 -04:00
__init__.py Don't override `Account.pps: dict` entries.. 2026-01-02 20:44:46 -05:00
_allocate.py Bleh, move `.data.types` back up to top level pkg 2023-08-05 15:57:10 -04:00
_ledger.py `.accounting._ledger`: typing anda more multiline styling 2026-01-02 16:49:16 -05:00
_mktinfo.py Finally drop `Symbol` 2026-01-02 16:49:16 -05:00
_pos.py Don't override `Account.pps: dict` entries.. 2026-01-02 20:44:46 -05:00
calc.py ib-related: cope with invalid txn timestamps 2026-01-02 18:19:50 -05:00
cli.py Drop some bps and style logic to multiline 2026-01-02 16:49:16 -05:00

README.rst

.accounting

A subsystem for transaction processing, storage and historical measurement.

.pnl

BEP, the break even price: the price at which liquidating a remaining position results in a zero PnL since the position was "opened" in the destination asset.

PPU: price-per-unit: the "average cost" (in cumulative mean terms) of the "entry" transactions which "make a position larger"; taking a profit relative to this price means that you will "make more profit then made prior" since the position was opened.