Skip to main content

limen.trading

Provide the account ledger used by sequential backtests to track positions and balances over time.

Canonical docs

What this package owns

Owns the Account bookkeeping primitive used by sequential simulations. Does not own strategy logic, signal generation, or the higher-level backtest orchestration that calls it.

Key entry points

Entry pointUse it whenNotes
AccountYou want a running ledger of long, short, cover, sell, and hold actionsExported at the package root
update_account()You want to record the next simulated action at a given priceThe core mutating method on Account

Adjacent modules

  • limen.backtest.BacktestSequential is the main consumer of this package.
  • limen.log and limen.backtest.backtest_snapshot are downstream alternatives when you do not need a full ledger.

Quick orientation

trading/
└── account.py # Account ledger, position tracking, and overflow guards

Things to know

  • The ledger supports buy, sell, short, cover, and hold, even though the common sequential backtest path is long-only.
  • The amount semantics differ by action, so callers need to be explicit about whether they are expressing a USDT amount or the implied BTC quantity through price.
  • Cached long and short totals exist for performance and are part of the account's correctness model.
  • Precision and overflow guards are intentional. This package prefers explicit failure over silent drift.