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 point | Use it when | Notes |
|---|---|---|
Account | You want a running ledger of long, short, cover, sell, and hold actions | Exported at the package root |
update_account() | You want to record the next simulated action at a given price | The core mutating method on Account |
Adjacent modules
limen.backtest.BacktestSequentialis the main consumer of this package.limen.logandlimen.backtest.backtest_snapshotare 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, andhold, even though the common sequential backtest path is long-only. - The
amountsemantics 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.