wickra-backtest-wasm 0.1.7 → 0.1.9
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/README.md +5 -5
- package/package.json +1 -1
- package/wickra_backtest_wasm.d.ts +5 -5
- package/wickra_backtest_wasm_bg.js +21 -21
- package/wickra_backtest_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
<p align="center">
|
|
2
|
-
<a href="https://wickra.org"><img src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/wickra-banner.
|
|
2
|
+
<a href="https://wickra.org"><img src="https://raw.githubusercontent.com/wickra-lib/.github/main/profile/wickra-banner.svg?v=514-8" alt="Wickra Backtest — backtest and live are byte-identical" width="100%"></a>
|
|
3
3
|
</p>
|
|
4
4
|
|
|
5
|
-
[](https://github.com/wickra-lib/wickra)
|
|
6
|
+
[](https://github.com/wickra-lib/wickra-backtest)
|
|
7
7
|
[](https://github.com/wickra-lib/wickra-backtest/actions/workflows/ci.yml)
|
|
8
8
|
[](https://github.com/wickra-lib/wickra-backtest/actions/workflows/codeql.yml)
|
|
9
9
|
[](https://codecov.io/gh/wickra-lib/wickra-backtest)
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
[](https://github.com/wickra-lib/wickra-backtest/attestations)
|
|
22
22
|
[](https://backtest.wickra.org)
|
|
23
23
|
[](golden/)
|
|
24
|
-
[](https://backtest-live.wickra.org)
|
|
25
25
|
|
|
26
26
|
---
|
|
27
27
|
|
|
@@ -82,7 +82,7 @@ The two reports are byte-identical. That is the whole claim, and a shared
|
|
|
82
82
|
|
|
83
83
|
## Status
|
|
84
84
|
|
|
85
|
-
**0.1.
|
|
85
|
+
**0.1.9 — the current release.** The engine, the data-driven `StrategySpec`, the
|
|
86
86
|
full execution and cost model, the microstructure feeds and all ten language
|
|
87
87
|
bindings are implemented and tested; a shared [golden corpus](golden/) pins the
|
|
88
88
|
cross-language equality byte-for-byte.
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"kingchenc <support@wickra.org>"
|
|
6
6
|
],
|
|
7
7
|
"description": "WebAssembly bindings for the wickra-backtest streaming backtester — backtest in the browser.",
|
|
8
|
-
"version": "0.1.
|
|
8
|
+
"version": "0.1.9",
|
|
9
9
|
"license": "MIT OR Apache-2.0",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -41,11 +41,6 @@ export class StreamingBacktest {
|
|
|
41
41
|
* Build from a JSON strategy spec and starting capital.
|
|
42
42
|
*/
|
|
43
43
|
constructor(spec_json: string, capital: number);
|
|
44
|
-
/**
|
|
45
|
-
* Advance by one OHLCV bar. `volume` defaults to 0 and `time` to the number
|
|
46
|
-
* of bars fed so far.
|
|
47
|
-
*/
|
|
48
|
-
step(open: number, high: number, low: number, close: number, volume?: number | null, time?: number | null): void;
|
|
49
44
|
/**
|
|
50
45
|
* Advance by one bar described as a request document:
|
|
51
46
|
* `{"candle": {...}, "feeds": {...}}`, where `feeds` optionally carries this
|
|
@@ -53,6 +48,11 @@ export class StreamingBacktest {
|
|
|
53
48
|
* This is the only form that can drive a strategy reading a side feed.
|
|
54
49
|
*/
|
|
55
50
|
stepJson(step_json: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* Advance by one OHLCV bar. `volume` defaults to 0 and `time` to the number
|
|
53
|
+
* of bars fed so far.
|
|
54
|
+
*/
|
|
55
|
+
step(open: number, high: number, low: number, close: number, volume?: number | null, time?: number | null): void;
|
|
56
56
|
/**
|
|
57
57
|
* Whether the run has been finished or closed.
|
|
58
58
|
*/
|
|
@@ -168,19 +168,18 @@ export class StreamingBacktest {
|
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
/**
|
|
171
|
-
* Advance by one
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* @param {
|
|
176
|
-
* @param {number} close
|
|
177
|
-
* @param {number | null} [volume]
|
|
178
|
-
* @param {number | null} [time]
|
|
171
|
+
* Advance by one bar described as a request document:
|
|
172
|
+
* `{"candle": {...}, "feeds": {...}}`, where `feeds` optionally carries this
|
|
173
|
+
* bar's `reference` / `deriv` / `orderbook` / `trades` / `cross_section`.
|
|
174
|
+
* This is the only form that can drive a strategy reading a side feed.
|
|
175
|
+
* @param {string} step_json
|
|
179
176
|
*/
|
|
180
|
-
|
|
177
|
+
stepJson(step_json) {
|
|
181
178
|
try {
|
|
182
179
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
183
|
-
|
|
180
|
+
const ptr0 = passStringToWasm0(step_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
181
|
+
const len0 = WASM_VECTOR_LEN;
|
|
182
|
+
wasm.streamingbacktest_stepJson(retptr, this.__wbg_ptr, ptr0, len0);
|
|
184
183
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
185
184
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
186
185
|
if (r1) {
|
|
@@ -191,18 +190,19 @@ export class StreamingBacktest {
|
|
|
191
190
|
}
|
|
192
191
|
}
|
|
193
192
|
/**
|
|
194
|
-
* Advance by one bar
|
|
195
|
-
*
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
* @param {
|
|
193
|
+
* Advance by one OHLCV bar. `volume` defaults to 0 and `time` to the number
|
|
194
|
+
* of bars fed so far.
|
|
195
|
+
* @param {number} open
|
|
196
|
+
* @param {number} high
|
|
197
|
+
* @param {number} low
|
|
198
|
+
* @param {number} close
|
|
199
|
+
* @param {number | null} [volume]
|
|
200
|
+
* @param {number | null} [time]
|
|
199
201
|
*/
|
|
200
|
-
|
|
202
|
+
step(open, high, low, close, volume, time) {
|
|
201
203
|
try {
|
|
202
204
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
203
|
-
|
|
204
|
-
const len0 = WASM_VECTOR_LEN;
|
|
205
|
-
wasm.streamingbacktest_stepJson(retptr, this.__wbg_ptr, ptr0, len0);
|
|
205
|
+
wasm.streamingbacktest_step(retptr, this.__wbg_ptr, open, high, low, close, !isLikeNone(volume), isLikeNone(volume) ? 0 : volume, !isLikeNone(time), isLikeNone(time) ? 0 : time);
|
|
206
206
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
207
207
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
208
208
|
if (r1) {
|
|
@@ -319,11 +319,11 @@ export function version() {
|
|
|
319
319
|
wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);
|
|
320
320
|
}
|
|
321
321
|
}
|
|
322
|
-
export function
|
|
322
|
+
export function __wbg_Error_67e7344beaa85059(arg0, arg1) {
|
|
323
323
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
324
324
|
return addHeapObject(ret);
|
|
325
325
|
}
|
|
326
|
-
export function
|
|
326
|
+
export function __wbg___wbindgen_throw_5d9e815e6fdf150f(arg0, arg1) {
|
|
327
327
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
328
328
|
}
|
|
329
329
|
const StreamingBacktestFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
Binary file
|