Expand description
§wickra-benchmark-core
The deterministic core of wickra-benchmark: a curated suite of
(strategy, dataset, expected report, hash) cases you recompute and confirm
byte-for-byte. Given a BenchmarkCase, run_case recomputes the report
from the embedded strategy and candle data with the pinned wickra-backtest
engine, hashes it with the same canonicalization wickra-proof uses, and
reports two independent booleans: passed (the recomputed report is
byte-exact equal to the frozen expected) and hash_match (its canonical
hash equals expected_hash).
run_suite (path-based, for the CLI) and run_suite_inline (data
supplied inline, for the FFI boundary) fan out over a Suite and re-sort
the results by id, so a SuiteReport is byte-identical across all ten
language bindings and between the parallel (rayon) and sequential (WASM)
runners. Benchmark exposes the command_json boundary the bindings
forward verbatim; canonicalize/hash are the single source of hash
stability.
Structs§
- Backtest
Report - The result of a backtest run.
- Benchmark
- A stateless benchmark handle. It carries no state — the case, suite and data arrive with each command — but is handle-shaped so the ten language bindings share the same surface as the other Wickra products.
- Benchmark
Case - A single golden-verified case. Its
strategyis an embedded wickra-backtestStrategySpec(kept as raw JSON so wickra-benchmark-core stays decoupled from the engine’s struct internals across the FFI boundary); itsexpectedreport andexpected_hashare frozen when the case is blessed and are byte-exact thereafter. Running the case recomputes the report fromstrategy+ the dataset and checks it against both. - Candle
- One OHLCV bar.
timeis the bar’s open time (engine-defined epoch unit; it is passed straight through to indicators that need a timestamp). - Case
Result - The outcome of running one case: whether the recomputed report matches the
expectation (
passed) and its frozen hash (hash_match), plus the recomputed report and its hash for inspection. - Config
- Reserved runner options. Currently carries no fields; parsing
{}yields the default. - Strategy
Spec - A complete strategy specification.
- Suite
- A curated suite of cases. The case order in the file is irrelevant — the
runner sorts results by
id— but everyidmust be unique. - Suite
Report - The result of running a whole suite: the per-case results (sorted by
id) and the pass/fail tally. A case counts as passing only when it bothpassedandhash_match.
Enums§
- Error
- Everything that can go wrong while running a case or a suite.
Functions§
- canonicalize
- Produce the canonical string form of any serializable value (a report, a
case, or a suite report). The value is first converted to a
serde_json::Valueand then canonicalized, so the output is independent of struct field order and depends only on the data. - hash
- The lowercase 64-hex blake3 of a canonical string (no prefix). Pairs with
canonicalize:hash(&canonicalize(x)?)is the stable digest ofx. - hash_
report - The canonical blake3 hash of a serializable value (typically a
BacktestReport):hash(&canonicalize(value)?). This is exactly how a case’sexpected_hashis defined, so a recomputed report that matches the expectation reproduces the frozen hash. - load_
candles - Load a candle CSV (
time,open,high,low,close,volume, an optional header row,volumeoptional per row). Rows are trusted repo data; a malformed row is aError::Data. - run_
case - Recompute
case’s report from its strategy and the supplied candledata, then check it against the frozen expectation. Returns aCaseResultwith two independent booleans:passed(the recomputed report is byte-exact equal tocase.expected) andhash_match(its canonical hash equalscase.expected_hash). - run_
suite - Run every case in
suite, loading each case’s dataset fromdata_root/<dataset_ref>as CSV. Used by the CLI, which has filesystem access. - run_
suite_ inline - Run every case in
suiteagainst datasets supplied inline, keyed bydataset_ref. Used across the FFI boundary, which has no filesystem. Must produce the same report asrun_suitefor the same data. - version
- The wickra-benchmark-core crate version.
Type Aliases§
- Result
- The result of a wickra-benchmark-core operation.