wickra-verify 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE-APACHE +201 -0
- package/LICENSE-MIT +21 -0
- package/README.md +338 -0
- package/index.d.ts +18 -0
- package/index.js +704 -0
- package/package.json +67 -0
- package/wickra-verify.darwin-arm64.node +0 -0
- package/wickra-verify.darwin-x64.node +0 -0
- package/wickra-verify.linux-arm64-gnu.node +0 -0
- package/wickra-verify.linux-x64-gnu.node +0 -0
- package/wickra-verify.win32-arm64-msvc.node +0 -0
- package/wickra-verify.win32-x64-msvc.node +0 -0
package/LICENSE-APACHE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or Derivative
|
|
95
|
+
Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 kingchenc and the Wickra contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 kingchenc and the Wickra contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://wickra.org"><img src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/wickra-banner.webp?v=514" alt="Wickra Verify — deterministically confirm or refute a claimed backtest report against its strategy and data, in ten languages" width="100%"></a>
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
[](https://github.com/wickra-lib/wickra)
|
|
6
|
+
[](https://github.com/wickra-lib/wickra-verify)
|
|
7
|
+
[](https://github.com/wickra-lib/wickra-verify/actions/workflows/ci.yml)
|
|
8
|
+
[](https://github.com/wickra-lib/wickra-verify/actions/workflows/codeql.yml)
|
|
9
|
+
[](https://codecov.io/gh/wickra-lib/wickra-verify)
|
|
10
|
+
[](https://github.com/wickra-lib/wickra-verify/releases/latest)
|
|
11
|
+
[](https://crates.io/crates/wickra-verify-cli)
|
|
12
|
+
[](https://pypi.org/project/wickra-verify/)
|
|
13
|
+
[](https://www.npmjs.com/package/wickra-verify)
|
|
14
|
+
[](https://www.nuget.org/packages/Wickra.Verify)
|
|
15
|
+
[](https://central.sonatype.com/artifact/org.wickra/wickra-verify)
|
|
16
|
+
[](https://pkg.go.dev/github.com/wickra-lib/wickra-verify-go)
|
|
17
|
+
[](https://wickra-lib.r-universe.dev)
|
|
18
|
+
[](#license)
|
|
19
|
+
[](https://scorecard.dev/viewer/?uri=github.com/wickra-lib/wickra-verify)
|
|
20
|
+
[](https://www.bestpractices.dev)
|
|
21
|
+
[](https://github.com/wickra-lib/wickra-verify/attestations)
|
|
22
|
+
[](https://wickra.org)
|
|
23
|
+
[](golden/)
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Wickra Verify
|
|
28
|
+
|
|
29
|
+
**Verify any backtest. Hand over a `(strategy, data, claimed report)` triple and
|
|
30
|
+
get a deterministic verdict — confirmed or refuted — that anyone can recompute in
|
|
31
|
+
ten languages.**
|
|
32
|
+
|
|
33
|
+
> **Part of the [Wickra ecosystem](https://github.com/wickra-lib).** Built on the
|
|
34
|
+
> same deterministic backtest engine and ten-language binding surface as
|
|
35
|
+
> [wickra-backtest](https://github.com/wickra-lib/wickra-backtest),
|
|
36
|
+
> [wickra-proof](https://github.com/wickra-lib/wickra-proof) and the rest.
|
|
37
|
+
|
|
38
|
+
`wickra-verify` takes a **claim** — a strategy spec, the candle data it was run
|
|
39
|
+
over, and the `BacktestReport` someone says that run produced — and **recomputes
|
|
40
|
+
the report** with the pinned [`wickra-backtest`](https://github.com/wickra-lib/wickra-backtest)
|
|
41
|
+
engine. It then compares the claimed report against the fresh one, field by
|
|
42
|
+
field, within an explicit tolerance, and returns a **verdict**: `matches: true`
|
|
43
|
+
if every metric agrees, or a stable, sorted list of the exact mismatches if not.
|
|
44
|
+
|
|
45
|
+
It is a **free anti-fraud tool against doctored backtests** — not a hosted
|
|
46
|
+
service, not a SaaS, not a backend. A CLI plus ten language bindings, and an
|
|
47
|
+
optional **static** in-browser WASM demo. Nothing you submit ever leaves your
|
|
48
|
+
machine.
|
|
49
|
+
|
|
50
|
+
```rust
|
|
51
|
+
use wickra_verify_core::{verify, Claim, DatasetRef};
|
|
52
|
+
|
|
53
|
+
// A claim is the strategy, the candles it ran over, and the report someone
|
|
54
|
+
// says that run produced. `verify` recomputes the report and compares.
|
|
55
|
+
let claim = Claim {
|
|
56
|
+
strategy: strategy_json,
|
|
57
|
+
dataset_ref: DatasetRef::Inline { data: candles_by_symbol.clone() },
|
|
58
|
+
claimed_report: claimed_report_json,
|
|
59
|
+
};
|
|
60
|
+
let verdict = verify(&claim, &candles_by_symbol)?;
|
|
61
|
+
|
|
62
|
+
// `matches` is the whole answer; `mismatches` names every field that differs.
|
|
63
|
+
// The same triple yields the same verdict in all ten languages, byte for byte.
|
|
64
|
+
assert!(!verdict.matches);
|
|
65
|
+
assert_eq!(verdict.mismatches[0].field, "fees_paid");
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The same call from the command line, against the doctored claim shipped in
|
|
69
|
+
`examples/data` (exit 2 = refuted, which is what a CI gate wants):
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
cargo run -p wickra-verify -- \
|
|
73
|
+
--claim examples/data/claims/fudged.json \
|
|
74
|
+
--data examples/data/candles
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Determinism is the product
|
|
78
|
+
|
|
79
|
+
- **Recompute, never trust** — the verdict comes from re-running the backtest,
|
|
80
|
+
not from comparing two supplied numbers. A fudged Sharpe, an inflated PnL, a
|
|
81
|
+
quietly-changed parameter all surface as a concrete mismatch.
|
|
82
|
+
- **Explicit tolerance** — floats are compared within a fixed
|
|
83
|
+
`atol + rtol·max(|a|,|b|)` tolerance (the `numpy.allclose` rule), never
|
|
84
|
+
bitwise, so legitimate last-ULP noise never causes a false refutal.
|
|
85
|
+
- **Stable, sorted mismatches** — the mismatch list is ordered by field, so the
|
|
86
|
+
verdict is byte-identical across all ten languages.
|
|
87
|
+
- **Canonical hashes** — every verdict carries the blake3 hashes of the claimed
|
|
88
|
+
report, the recomputed report and the full inputs, under the same
|
|
89
|
+
canonicalization [`wickra-proof`](https://github.com/wickra-lib/wickra-proof)
|
|
90
|
+
uses; a verdict's `inputs_hash` equals the proof hash of the same inputs.
|
|
91
|
+
|
|
92
|
+
## Status
|
|
93
|
+
|
|
94
|
+
**Pre-release — functionally complete, CI-verified, not yet published.** The
|
|
95
|
+
core, the CLI, all ten language bindings, the byte-exact golden corpus, the
|
|
96
|
+
property + fuzz suites, the benchmarks and one runnable example per language are
|
|
97
|
+
built and green across Linux, macOS and Windows. Packages are not yet on the
|
|
98
|
+
registries. Track progress in [ROADMAP.md](ROADMAP.md).
|
|
99
|
+
|
|
100
|
+
## Documentation
|
|
101
|
+
|
|
102
|
+
- [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) — how the pieces fit together.
|
|
103
|
+
- [`docs/CLAIM_FORMAT.md`](docs/CLAIM_FORMAT.md) — the `Claim` and its embedded
|
|
104
|
+
`StrategySpec` / `BacktestReport`.
|
|
105
|
+
- [`docs/VERDICT.md`](docs/VERDICT.md) — the `Verdict`, mismatches and tolerance.
|
|
106
|
+
- [`docs/CANONICALIZATION.md`](docs/CANONICALIZATION.md) — the hashing contract
|
|
107
|
+
shared with wickra-proof.
|
|
108
|
+
- [`docs/DETERMINISM.md`](docs/DETERMINISM.md) — why the verdict is identical
|
|
109
|
+
everywhere.
|
|
110
|
+
- [`docs/Cookbook.md`](docs/Cookbook.md) — recipes, including "gate a claim in
|
|
111
|
+
CI: exit 2 = fraud".
|
|
112
|
+
|
|
113
|
+
## Quickstart
|
|
114
|
+
|
|
115
|
+
`--claim` is a JSON/TOML Claim; `--data` a CSV or a directory of `<SYMBOL>.csv`
|
|
116
|
+
files (omit `--data` when the claim carries its candles inline). Exit 0 =
|
|
117
|
+
verified, 2 = refuted (CI-friendly), 1 = error; `--explain` renders the
|
|
118
|
+
mismatches and forces exit 0.
|
|
119
|
+
|
|
120
|
+
The example claim inflates `fees_paid`, so the verdict is **refuted** and names
|
|
121
|
+
the `fees_paid` mismatch — a fabricated number cannot pass a recomputation.
|
|
122
|
+
|
|
123
|
+
## Claim format
|
|
124
|
+
|
|
125
|
+
A **claim** is the assertion to be checked — "this strategy on this data produced
|
|
126
|
+
this report":
|
|
127
|
+
|
|
128
|
+
- **`strategy`** — the embedded [`wickra-backtest`](https://github.com/wickra-lib/wickra-backtest)
|
|
129
|
+
`StrategySpec` (indicators, entry/exit rules, sizing, costs, risk).
|
|
130
|
+
- **`dataset_ref`** — where the candles come from: `inline` (embedded per symbol,
|
|
131
|
+
fully self-contained) or `files` (named symbols resolved out of band).
|
|
132
|
+
- **`claimed_report`** — the `BacktestReport` the claimant asserts this run
|
|
133
|
+
produced. **Untrusted**: verification recomputes and compares, so a doctored
|
|
134
|
+
`claimed_report` cannot pass.
|
|
135
|
+
|
|
136
|
+
Full schema in [`docs/CLAIM_FORMAT.md`](docs/CLAIM_FORMAT.md).
|
|
137
|
+
|
|
138
|
+
## Verdict and tolerance
|
|
139
|
+
|
|
140
|
+
`verify` returns a `Verdict`:
|
|
141
|
+
|
|
142
|
+
- **`matches`** — `true` iff every compared field agrees within tolerance.
|
|
143
|
+
- **`mismatches`** — a field-sorted list of `{field, claimed, actual, delta}`.
|
|
144
|
+
- **`claimed_report_hash` / `actual_report_hash` / `inputs_hash`** — 64-hex
|
|
145
|
+
blake3 digests over the canonical forms.
|
|
146
|
+
- **`engine_version`** — the `wickra-backtest` version the verdict was reached
|
|
147
|
+
under.
|
|
148
|
+
|
|
149
|
+
Two floats count as equal when `|a − b| ≤ atol + rtol·max(|a|,|b|)`, with tight
|
|
150
|
+
defaults (`atol = 1e-9`, `rtol = 1e-6`) that absorb last-bit float noise and
|
|
151
|
+
nothing more. See [`docs/VERDICT.md`](docs/VERDICT.md).
|
|
152
|
+
|
|
153
|
+
## Canonicalization and hashing
|
|
154
|
+
|
|
155
|
+
The hashes are only as trustworthy as the serialization they run over, so
|
|
156
|
+
canonicalization is byte-for-byte the contract
|
|
157
|
+
[`wickra-proof`](https://github.com/wickra-lib/wickra-proof) uses (see
|
|
158
|
+
[`crates/wickra-verify-core/src/canon.rs`](crates/wickra-verify-core/src/canon.rs)): keys
|
|
159
|
+
sorted by code point, no structural whitespace, floats quantized to `1e-8` with
|
|
160
|
+
trailing zeros trimmed and whole values collapsed to integers, no `NaN`/`±inf`.
|
|
161
|
+
`blake3` over that canonical string yields each 64-hex hash. A verdict's
|
|
162
|
+
`inputs_hash` therefore equals the wickra-proof hash of the same inputs — the two
|
|
163
|
+
products share one determinism moat. See
|
|
164
|
+
[`docs/CANONICALIZATION.md`](docs/CANONICALIZATION.md).
|
|
165
|
+
|
|
166
|
+
## Anti-fraud use in CI
|
|
167
|
+
|
|
168
|
+
Because a refuted claim exits `2`, verification drops straight into a pipeline:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Fails the job (exit 2) if the committed report does not match a fresh run.
|
|
172
|
+
wickra-verify --claim claim.json --data candles/
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Wire this into a strategy repo's CI and a doctored `claimed_report` can never be
|
|
176
|
+
merged — the recomputation is the gate. Recipes in
|
|
177
|
+
[`docs/Cookbook.md`](docs/Cookbook.md).
|
|
178
|
+
|
|
179
|
+
## Use in any language
|
|
180
|
+
|
|
181
|
+
The core is a JSON-over-C-ABI data API (`Verifier::command`) exposed natively in
|
|
182
|
+
Rust, Python, Node.js and WASM, and over the C ABI hub in C, C++, C#, Go, Java
|
|
183
|
+
and R. Every binding drives the same `verify` / `explain` / `canonicalize` /
|
|
184
|
+
`version` commands and returns the core's canonical response verbatim; the
|
|
185
|
+
cross-language golden tests assert byte-for-byte equality. One runnable example
|
|
186
|
+
per language lives under [`examples/`](examples); per-binding quickstarts are in
|
|
187
|
+
each `bindings/<lang>/README.md`.
|
|
188
|
+
|
|
189
|
+
| Language | Binding | Package |
|
|
190
|
+
| -------- | ------- | ------- |
|
|
191
|
+
| Rust | `wickra-verify-core` (native) | crates.io |
|
|
192
|
+
| Python | PyO3 (native) | PyPI |
|
|
193
|
+
| Node.js | napi (native) | npm |
|
|
194
|
+
| WASM | wasm-bindgen (native) | npm |
|
|
195
|
+
| C / C++ | C ABI | header + library |
|
|
196
|
+
| C# | C ABI (P/Invoke) | NuGet |
|
|
197
|
+
| Go | C ABI (cgo) | Go module |
|
|
198
|
+
| Java | C ABI (FFM/Panama) | Maven |
|
|
199
|
+
| R | C ABI (`.Call`) | R-universe |
|
|
200
|
+
|
|
201
|
+
## Project layout
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
crates/wickra-verify-core the library: claim + compare + canonicalize + verify
|
|
205
|
+
crates/wickra-verify-cli reference CLI (verify), binary `wickra-verify`
|
|
206
|
+
crates/verify-bench Criterion benchmarks
|
|
207
|
+
bindings/{c,python,node,wasm,go,csharp,java,r} ten-language surface
|
|
208
|
+
golden/ fixed claims -> expected verdicts (byte-exact)
|
|
209
|
+
examples/ runnable per-language demos + static web demo
|
|
210
|
+
fuzz/ cargo-fuzz targets (claim parse, compare, canonicalize, verify)
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Building everything from source
|
|
214
|
+
```bash
|
|
215
|
+
cargo build --workspace
|
|
216
|
+
cargo test --workspace --all-features
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Each binding builds with its own toolchain; see `bindings/<lang>/README.md`. The
|
|
220
|
+
C-ABI consumers (C/C++, C#, Go, Java, R) need the C ABI library first:
|
|
221
|
+
`cargo build --release -p wickra-verify-c`.
|
|
222
|
+
|
|
223
|
+
## Testing
|
|
224
|
+
|
|
225
|
+
Run the suites with the commands in
|
|
226
|
+
[Building everything from source](#building-everything-from-source).
|
|
227
|
+
|
|
228
|
+
- **`wickra-verify-core`** — unit tests for canonicalization (key ordering, float
|
|
229
|
+
quantization, whitespace), the verify/round-trip path, tamper detection, and
|
|
230
|
+
the engine-version pin. The golden fixtures in `golden/` are the anchor: the
|
|
231
|
+
same `(spec, data)` pair must fold to the same canonical bytes and the same
|
|
232
|
+
blake3 hash here as in every binding.
|
|
233
|
+
- **Every binding** asserts the *same* golden bytes. That is the whole
|
|
234
|
+
cross-language claim, so it is checked the same way in each one rather than
|
|
235
|
+
approximated per language: Python with pytest, Node with `node --test`, WASM
|
|
236
|
+
with `wasm-bindgen-test`, C and C++ through `ctest`, C# with `dotnet test`,
|
|
237
|
+
Go with `go test`, Java with JUnit, and R with the shipped `tests/smoke.R`
|
|
238
|
+
plus the repository-level `tests/run_tests.R`.
|
|
239
|
+
- **`fuzz/`** — libfuzzer targets over the JSON boundary, run as a time-boxed
|
|
240
|
+
smoke in CI. The goal is catching a regression in the harness, not
|
|
241
|
+
discovering novel bugs; long campaigns belong on dedicated infrastructure.
|
|
242
|
+
- **Repository checks** — `scripts/check_version_sync.py`,
|
|
243
|
+
`check_license_copies.py` and `check_readme_links.py` run in CI and assert
|
|
244
|
+
what the repository ships rather than what it computes.
|
|
245
|
+
|
|
246
|
+
## Requirements
|
|
247
|
+
|
|
248
|
+
Rust **1.86** (workspace) / **1.88** (Node binding). Per-binding toolchains:
|
|
249
|
+
Python 3.9+, Node.js 22+, .NET 8, JDK 22+, Go 1.23+, R ≥ 2.10, and a C11/C++14
|
|
250
|
+
compiler with CMake for the C example.
|
|
251
|
+
|
|
252
|
+
## Benchmarks
|
|
253
|
+
|
|
254
|
+
Criterion benchmarks for `verify`, `compare` and `canonicalize` live in
|
|
255
|
+
`crates/verify-bench`; numbers and methodology are in
|
|
256
|
+
[BENCHMARKS.md](BENCHMARKS.md).
|
|
257
|
+
|
|
258
|
+
## Ecosystem
|
|
259
|
+
|
|
260
|
+
Part of the [Wickra](https://github.com/wickra-lib/wickra) family — each one a
|
|
261
|
+
data-driven core with a CLI and the same ten-language binding surface:
|
|
262
|
+
|
|
263
|
+
- [**wickra**](https://github.com/wickra-lib/wickra) — main library (Rust core + Python / Node.js / WASM bindings + a C ABI for C / C++ / C# / Go / Java / R)
|
|
264
|
+
- [**wickra-playground**](https://github.com/wickra-lib/wickra-playground) — a polyglot strategy playground: one StrategySpec live side by side in Python, Rust, JS and Go, entirely in the browser
|
|
265
|
+
- [**wickra-exchange**](https://github.com/wickra-lib/wickra-exchange) — unified market-data + execution across ten crypto exchanges
|
|
266
|
+
- [**wickra-backtest**](https://github.com/wickra-lib/wickra-backtest) — event-driven backtester over the Wickra core
|
|
267
|
+
- [**wickra-terminal**](https://github.com/wickra-lib/wickra-terminal) — the trading terminal: a TUI and a browser renderer over the stack
|
|
268
|
+
- [**wickra-screener**](https://github.com/wickra-lib/wickra-screener) — parallel multi-symbol screening over 514 streaming indicators
|
|
269
|
+
- [**wickra-radar**](https://github.com/wickra-lib/wickra-radar) — perp-universe alert radar: OI delta, funding flip, book imbalance, liquidation clusters, OI/price divergence
|
|
270
|
+
- [**wickra-copilot**](https://github.com/wickra-lib/wickra-copilot) — local market copilot grounded in real order-book, liquidation and funding microstructure
|
|
271
|
+
- [**wickra-shazam**](https://github.com/wickra-lib/wickra-shazam) — match an asset's current microstructure fingerprint against its entire history
|
|
272
|
+
- [**wickra-benchmark**](https://github.com/wickra-lib/wickra-benchmark) — reproducible, golden-verified benchmark suite — recompute any (strategy, dataset, report) in ten languages and confirm it byte-for-byte
|
|
273
|
+
- [**wickra-strategy-ci**](https://github.com/wickra-lib/wickra-strategy-ci) — Jest for trading strategies: golden-pin the report, catch regressions in CI, property-test against fuzzed data
|
|
274
|
+
- [**wickra-verify**](https://github.com/wickra-lib/wickra-verify) — confirm or refute a claimed backtest report against its strategy and data, in ten languages
|
|
275
|
+
- [**wickra-proof**](https://github.com/wickra-lib/wickra-proof) — Proof-of-Backtest: deterministic (spec, data) → report + blake3 hash, recomputable byte-for-byte in ten languages
|
|
276
|
+
- [**wickra-zk**](https://github.com/wickra-lib/wickra-zk) — prove a backtest zero-knowledge — on-chain-verifiable performance without revealing the data or the strategy
|
|
277
|
+
- [**wickra-impact**](https://github.com/wickra-lib/wickra-impact) — the backtester that knows you would have moved the market: agent-based fills on the real historical L2 order book
|
|
278
|
+
- [**wickra-darwin**](https://github.com/wickra-lib/wickra-darwin) — evolutionary strategy search at millions of backtests per second, mutating and crossing JSON specs across the 514-indicator space
|
|
279
|
+
- [**wickra-gym**](https://github.com/wickra-lib/wickra-gym) — a Gymnasium-compatible, microstructure-aware backtest environment with O(1) steps for deterministic RL rollouts
|
|
280
|
+
- [**wickra-feature-store**](https://github.com/wickra-lib/wickra-feature-store) — OHLCV and microstructure streams into ML-ready feature matrices over 514 O(1) streaming indicators
|
|
281
|
+
- [**wickra-genome**](https://github.com/wickra-lib/wickra-genome) — a vector database of the whole market: every asset a 514-dim live vector, for similarity search, clustering and anomaly detection
|
|
282
|
+
- [**wickra-timemachine**](https://github.com/wickra-lib/wickra-timemachine) — scrub the whole market like a video — every symbol, full order book, rewound to any moment via deterministic re-fold
|
|
283
|
+
- [**wickra-synth**](https://github.com/wickra-lib/wickra-synth) — deterministic synthetic market microstructure: OHLCV, order book, trades and funding from a single seed
|
|
284
|
+
- [**wickra-compile**](https://github.com/wickra-lib/wickra-compile) — compile a strategy spec into a standalone deployable: a WASM module, a self-contained binary, or a `no_std` artifact
|
|
285
|
+
- [**wickra-embed**](https://github.com/wickra-lib/wickra-embed) — allocation-free, `no_std` streaming indicators for bare-metal and HFT, byte-for-byte identical to the core
|
|
286
|
+
- [**wickra-pico**](https://github.com/wickra-lib/wickra-pico) — the O(1) indicator core running bare-metal on a $5 Raspberry Pi Pico — the LED blinks on the EMA cross
|
|
287
|
+
|
|
288
|
+
Docs at [docs.wickra.org](https://docs.wickra.org); the marketing site and
|
|
289
|
+
in-browser demo at [wickra.org](https://wickra.org).
|
|
290
|
+
|
|
291
|
+
## Contributing
|
|
292
|
+
|
|
293
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) and the
|
|
294
|
+
[Code of Conduct](CODE_OF_CONDUCT.md). Every change runs the full CI matrix (all
|
|
295
|
+
ten languages × three OSes) plus CodeQL, Scorecard and zizmor.
|
|
296
|
+
|
|
297
|
+
## Security
|
|
298
|
+
|
|
299
|
+
Report vulnerabilities per [SECURITY.md](SECURITY.md). The threat model is in
|
|
300
|
+
[THREAT_MODEL.md](THREAT_MODEL.md).
|
|
301
|
+
|
|
302
|
+
## License
|
|
303
|
+
|
|
304
|
+
Dual-licensed under either [MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE), at
|
|
305
|
+
your option.
|
|
306
|
+
|
|
307
|
+
## Disclaimer
|
|
308
|
+
|
|
309
|
+
`wickra-verify` is research and engineering tooling, not financial advice. A
|
|
310
|
+
verdict attests only that a claimed report is (or is not) the deterministic
|
|
311
|
+
result of a given strategy over given data — it makes no claim about the quality,
|
|
312
|
+
profitability or future performance of any strategy, nor about whether the data
|
|
313
|
+
itself is genuine. Trading carries risk; you are responsible for your own
|
|
314
|
+
decisions. `wickra-verify` is free software you run yourself: no hosted service,
|
|
315
|
+
no data collection, no warranty.
|
|
316
|
+
|
|
317
|
+
---
|
|
318
|
+
|
|
319
|
+
<p align="center">
|
|
320
|
+
<a href="https://github.com/wickra-lib/wickra-verify">
|
|
321
|
+
<img alt="GitHub stars" src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/badges/wickra-verify/stars.svg">
|
|
322
|
+
</a>
|
|
323
|
+
<a href="https://github.com/wickra-lib/wickra-verify/network/members">
|
|
324
|
+
<img alt="GitHub forks" src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/badges/wickra-verify/forks.svg">
|
|
325
|
+
</a>
|
|
326
|
+
<a href="https://github.com/wickra-lib/wickra-verify/issues">
|
|
327
|
+
<img alt="GitHub issues" src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/badges/wickra-verify/issues.svg">
|
|
328
|
+
</a>
|
|
329
|
+
</p>
|
|
330
|
+
|
|
331
|
+
<p align="center">
|
|
332
|
+
Built on <a href="https://github.com/wickra-lib/wickra">Wickra</a>. If it saved you time, the cheapest way to say thanks is to ⭐ the repo.
|
|
333
|
+
</p>
|
|
334
|
+
|
|
335
|
+
<p align="center">
|
|
336
|
+
<img alt="wickra-verify star history" width="640"
|
|
337
|
+
src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/badges/wickra-verify/star-history.svg">
|
|
338
|
+
</p>
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* auto-generated by NAPI-RS */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/** A verifier driven by JSON commands. */
|
|
4
|
+
export declare class Verifier {
|
|
5
|
+
/**
|
|
6
|
+
* Create a verifier from a config JSON (`{"atol":..,"rtol":..}`); missing
|
|
7
|
+
* fields fall back to the defaults. Omit the argument (or pass `"{}"`) for
|
|
8
|
+
* the default tolerances.
|
|
9
|
+
*/
|
|
10
|
+
constructor(configJson?: string | undefined | null)
|
|
11
|
+
/** Apply a command JSON and return the resulting response JSON. */
|
|
12
|
+
command(cmdJson: string): string
|
|
13
|
+
/** The library version. */
|
|
14
|
+
version(): string
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The library version. */
|
|
18
|
+
export declare function version(): string
|