Skip to main content

Crate rungbot_backtest

Crate rungbot_backtest 

Source
Expand description

rungbot-backtest — the ladder replayed over history.

Four backtests and a set of historical replays, all pure computation: price history and a starting book go in, a report comes out. Reading caches and fetching candles is the CLI’s job (rungbot backtest ...).

  • invariants — scripted price paths through the live ladder, asserting its rules.
  • window — the ladder as configured over a trailing window of real prices, with dollar bookkeeping, per-pair minimum notional and rollback of skipped trades.
  • sweep — A/B variants of the ladder over the same window and book.
  • monthly — several windows plus the sweep and per-coin band probes, rolled into one verdict and an expectation file a divergence check can steer against.
  • replay — cycle studies: bull-confirmation replays, cycle-top anatomy, the bull sell policy over past tops, current market microstate.

The report formats are a contract. The monthly verdict reads the window and sweep reports back with patterns, so every line is produced with Python’s exact number formatting (py) and pinned by golden tests against the reference implementation.

Modules§

exact
Exact rational mean of floats, rounded once — what statistics.mean returns.
invariants
Scripted price paths through the live ladder, asserting its documented rules.
monthly
Several trailing windows, their variant sweeps and per-coin band probes, rolled into one verdict.
py
Python’s number formatting, rounding and value printing, reproduced exactly.
replay
Historical replays: cycle studies over daily candles.
sweep
A/B variants of the ladder over the same window and the same start book.
window
The ladder as configured, replayed over a trailing window of real prices.

Macros§

pydict
Build an ordered dict: dict![("a", 1.0), ("b", "x")].

Structs§

Book
The starting book: holdings per coin, free stable per venue, each pair’s minimum order notional, and how many coins share each venue’s stable bag.
History
Hourly or daily prices per coin, [(epoch_seconds, price)], in file order.

Functions§

entry_text
How a configured cost basis prints. A whole number was written as one.
named_get
named_set

Type Aliases§

Named
An ordered name -> number map, as the book file stores it.