piker/piker/accounting
Gud Boi 6fc1484d23 Use `__name__` for loggers across most sub-mods
Change most sub-modules to use `get_logger(name=__name__)` for
per-leaf-module `log` instances vs previous subpkg-level/shared refs.

Primary changes,
- import `get_[console_]logger()` from top-level `piker.log` across leaf
  mods.
- change any `<subsys>._util.log` logger-instances as well (though this
  approach should no longer be used since it masks the endpoint module's
  emissions.

Also,
- add a defaulted `loglevel: str` param to all `open_trade_dialog()`
  endpoints, anticipating it being passed in by `.clearing`-engine.
- call `get_console_log(level=loglevel, name=__name__)` in each trade
  dialog ep to enable per-`brokerd`-backend console writing.
- drop `get_logger` from `.brokers.__all__` exports
- fix type annotations: `str|None` vs `str | None`
- add TODOs for,
  * comments in `._util` about multi-subsys logging
  * `.accounting.__init__` about console log setup

(this commit msg was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
2026-02-22 18:18:06 -05:00
..
README.rst Officially drop `Position.size` 2023-08-03 16:57:02 -04:00
__init__.py Use `__name__` for loggers across most sub-mods 2026-02-22 18:18:06 -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 Use `__name__` for loggers across most sub-mods 2026-02-22 18:18:06 -05:00
calc.py accounting.calc: `.error()` on bad txn-time fields.. 2026-01-07 14:05:23 -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.