@hoox-sh/pynets 0.8.0 → 0.10.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/CHANGELOG.md +32 -0
- package/README.md +17 -1
- package/dist/browser.js +63 -63
- package/dist/index.js +408 -39
- package/package.json +1 -1
- package/src/cli/rich.ts +1 -1
- package/src/index.ts +1 -1
- package/src/runtime/array.ts +19 -0
- package/src/runtime/clone.ts +26 -0
- package/src/runtime/compile/collections.ts +13 -0
- package/src/runtime/compile/emit.ts +19 -1
- package/src/runtime/compile/emit_call.ts +15 -0
- package/src/runtime/compile/types.ts +2 -0
- package/src/runtime/interpret.ts +293 -36
- package/src/runtime/map.ts +25 -0
- package/src/runtime/matrix.ts +25 -0
- package/src/runtime/series.ts +6 -0
- package/src/runtime/strategy.ts +32 -0
- package/src/runtime/ta.ts +28 -0
- package/src/runtime/udt.ts +22 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.10.0] - 2026-11-04
|
|
11
|
+
|
|
12
|
+
Multi-tick realtime windows, reference `varip`, and list subscripts.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `RuntimeOptions.realtimeTicks` / `realtimeBars` / `realtimeFromBar` — Python `realtime_ticks` / `realtime_bars` / `realtime_from_bar` realtime windows with `_resolve_realtime_first` precedence (`realtimeFromBar` > `realtimeBars` > last-bar flags).
|
|
16
|
+
- Per-tick rollback for intermediate realtime ticks: `var` scope, container contents (array/map/UDT/matrix, in place so aliases keep identity), UDF-site `var` state and series pushes, plot cells, TA windows, and broker state — matching Python `_run_batch`.
|
|
17
|
+
- `barstate.isnew` is `0` after the first realtime tick; `barstate.isconfirmed` is `0` on intermediate ticks; `once` and `alert.freq_once_per_bar_close` commit on confirmed bars only, `alert.freq_all` fires every tick.
|
|
18
|
+
- List subscript `g[0]` on array-valued names (Python `visit_Subscript` newest-first semantics: `value[-(offset + 1)]`, OOB → na), on both interpret and JS compile, for names bound from `ta.gamma_levels`, `array.from`, `array.new*`, `array.copy`, `array.concat`, `array.slice`.
|
|
19
|
+
- `TaEngine.snapshot`/`restore`, `StrategyBook.snapshot`/`restore`, and `snapshotContents`/`restoreContents`/`clone` on `PineArray`/`PineMap`/`UdtInstance`/`PineMatrix`; `PineSeries.truncate`; shared `cloneValue`.
|
|
20
|
+
- Exported `resolveRealtimeWindow`.
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- `varip` now initializes once and persists across historical bars (previously re-initialized every bar like a plain assignment), and re-runs its initializer on every realtime tick (reference `varip`) — matching Python `visit_Assign` `ast.VarIp` handling.
|
|
24
|
+
|
|
25
|
+
## [0.9.0] - 2026-11-04
|
|
26
|
+
|
|
27
|
+
Realtime stream session API and forming-bar semantics.
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- `RuntimeStream.updateLastBar(bar)` — re-tick the forming last bar without advancing `barCount`; `once`, TA state, and broker fills recompute from the revised history.
|
|
31
|
+
- `RuntimeStream.appendBars(bars)` and `RuntimeStream.barCount`.
|
|
32
|
+
- `RuntimeOptions.realtimeLastBar` / `Runtime.run(..., { realtimeLastBar: true })` — last bar sees `barstate.isrealtime=1`, `ishistory=0`, `islastconfirmedhistory=0`.
|
|
33
|
+
- `RuntimeStream.push` uses realtime last-bar semantics; `close()` confirms the last bar.
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- `barstate.ishistory` is `1` on historical bars (including the last), matching PYNE; the realtime forming bar is `0`.
|
|
37
|
+
- `once` commits its fired flag only on a confirmed bar, ready for multi-tick rollback.
|
|
38
|
+
|
|
39
|
+
### Fixed
|
|
40
|
+
- README stream example used the non-existent `stream.end()`; it now uses `close()`.
|
|
41
|
+
|
|
10
42
|
## [0.8.0] - 2026-11-04
|
|
11
43
|
|
|
12
44
|
Full builtin surface: every name registered by PYNE's `BuiltinEvaluator`
|
package/README.md
CHANGED
|
@@ -178,7 +178,23 @@ const stream = rt.stream(source);
|
|
|
178
178
|
stream.on("bar", (out) => { /* one result per push */ });
|
|
179
179
|
stream.push({ close: 1 });
|
|
180
180
|
stream.push({ close: 2 });
|
|
181
|
-
|
|
181
|
+
|
|
182
|
+
// Re-tick the forming last bar (does not advance barCount):
|
|
183
|
+
// barstate.isrealtime is 1, ishistory 0; once/TA/broker state recomputes.
|
|
184
|
+
stream.updateLastBar({ open: 2, high: 3, low: 1, close: 2.5 });
|
|
185
|
+
stream.appendBars([{ close: 3 }, { close: 4 }]);
|
|
186
|
+
stream.close(); // confirm the last bar (realtimeLastBar: false)
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
`Runtime.run(src, bars, { realtimeLastBar: true })` exposes the same flag for a
|
|
190
|
+
single call. Multi-tick realtime windows work too (Python `realtime_ticks` /
|
|
191
|
+
`realtime_bars` / `realtime_from_bar`):
|
|
192
|
+
|
|
193
|
+
```ts
|
|
194
|
+
// Visit bars 12.. as realtime, 3 ticks per bar: intermediate ticks roll back
|
|
195
|
+
// var / TA / broker / plot state (varip persists, plots capture the final tick).
|
|
196
|
+
rt.run(src, bars, { realtimeFromBar: 12, realtimeTicks: 3 });
|
|
197
|
+
rt.run(src, bars, { realtimeBars: 5, realtimeTicks: 2 });
|
|
182
198
|
```
|
|
183
199
|
|
|
184
200
|
### Bars you actually have
|