Skip to main content

Crate wickra_strategy_ci_core

Crate wickra_strategy_ci_core 

Source
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. time is 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, …).
FieldDiff
One field that differs between the golden and the actual report.
FuzzFailure
A property that failed on a specific fuzz run.
FuzzSpec
A fuzz axis: perturb the data runs times from seed and re-check properties.
PropertyResult
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.
StrategyTest
A single strategy test: a strategy, the dataset it runs on, an optional golden report with tolerances, invariant properties, and an optional fuzz axis.
SuiteResult
The result of running a whole suite, sorted by test id.
TestResult
The full result of running one test.

Enums§

DiffKind
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 version command and crate::Session::version.

Functions§

bless
Re-run a test and return a copy with its expected golden 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 BTreeMap iteration order makes the output deterministic.
flatten_report
Flatten a report into a sorted map of numeric leaves. A scalar x maps to its key; equity_curve[i] maps to "equity_curve[i]"; a nested object a.b maps to "a.b". Non-numeric leaves (strings, bools, null) are ignored — only f64 values are compared. The BTreeMap makes 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 parallel feature they run concurrently; the sorted output is identical either way.
run_test
Run one strategy test to a full TestResult.

Type Aliases§

ReportJson
A BacktestReport as produced by the engine, held schema-agnostically so new report fields flow through without a code change.
Result
A Result specialized to [Error].
StrategyJson
An opaque backtest strategy definition. It is not parsed here; it is forwarded verbatim to the wickra-backtest engine, whose schema owns it.