Expand description
Data-driven core of Wickra Strategy-CI.
A StrategyTest carries an opaque StrategySpec sub-JSON that is forwarded
verbatim to the wickra-backtest
engine. The resulting BacktestReport is golden-pinned and asserted against
per-field Tolerances, checked for invariant Propertys, and fuzzed with
seeded data Perturbations. The Session command_json boundary is the
single JSON entry point every language binding drives, so results are
byte-identical across languages and between the parallel and sequential paths.
Structs§
- Candle
- The OHLCV candle type, re-exported from the backtest engine so tests, data and
bindings all speak the exact same JSON.
One OHLCV bar.
timeis the bar’s open time (engine-defined epoch unit; it is passed straight through to indicators that need a timestamp). - Config
- Per-session configuration. The runner is stateless with respect to tests and data, so the session holds only configuration; this is the extension point for future runtime knobs (report-hash policy, output formatting, …).
- Field
Diff - One field that differs between the golden and the actual report.
- Fuzz
Failure - A property that failed on a specific fuzz run.
- Fuzz
Spec - A fuzz axis: perturb the data
runstimes fromseedand re-check properties. - Property
Result - The outcome of one property check.
- Session
- A stateless handle over the test runner. It holds only configuration; tests and data are passed in with each command.
- Strategy
Test - A single strategy test: a strategy, the dataset it runs on, an optional golden report with tolerances, invariant properties, and an optional fuzz axis.
- Suite
Result - The result of running a whole suite, sorted by test id.
- Test
Result - The full result of running one test.
Enums§
- Diff
Kind - The nature of a field-level difference between two reports.
- Error
- Everything that can go wrong while running a strategy test.
- Perturbation
- How the input data is perturbed for a fuzz run.
- Property
- An invariant that must hold for a run, independent of any golden value.
- Tolerance
- A per-field tolerance for the golden diff.
Constants§
- VERSION
- The crate version, surfaced through the
versioncommand andcrate::Session::version.
Functions§
- bless
- Re-run a test and return a copy with its
expectedgolden set to the freshly produced (rounded) report. - check
- Check a single property against a flattened report.
- check_
all - Check every property against
report, returning one result each (in the order the properties were given). - diff_
reports - Diff two reports into the list of fields that differ. A perfect match yields an
empty vector. Values are rounded to eight decimals before comparison, and the
BTreeMapiteration order makes the output deterministic. - flatten_
report - Flatten a report into a sorted map of numeric leaves. A scalar
xmaps to its key;equity_curve[i]maps to"equity_curve[i]"; a nested objecta.bmaps to"a.b". Non-numeric leaves (strings, bools, null) are ignored — only f64 values are compared. TheBTreeMapmakes iteration order deterministic. - round8
- Round to eight decimals — the canonical numeric precision for diffs and for the values stored in a blessed golden.
- run_
suite - Run a suite of tests, sorted by id. Tests are independent, so with the
parallelfeature they run concurrently; the sorted output is identical either way. - run_
test - Run one strategy test to a full
TestResult.
Type Aliases§
- Report
Json - A
BacktestReportas produced by the engine, held schema-agnostically so new report fields flow through without a code change. - Result
- A
Resultspecialized to [Error]. - Strategy
Json - An opaque backtest strategy definition. It is not parsed here; it is
forwarded verbatim to the
wickra-backtestengine, whose schema owns it.