@hoox-sh/pynets 0.3.0 → 0.5.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 +30 -0
- package/README.md +7 -5
- package/dist/browser.js +66 -66
- package/dist/index.js +2009 -47
- package/package.json +1 -1
- package/src/cli/rich.ts +1 -1
- package/src/runtime/compile/collections.ts +4 -0
- package/src/runtime/compile/draw.ts +609 -19
- package/src/runtime/compile/emit.ts +98 -1
- package/src/runtime/compile/emit_call.ts +366 -10
- package/src/runtime/compile/runtime.ts +71 -1
- package/src/runtime/compile/strategy.ts +253 -1
- package/src/runtime/footprint.ts +272 -0
- package/src/runtime/interpret.ts +325 -8
- package/src/runtime/request.ts +19 -4
- package/src/runtime/ta.ts +392 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,36 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.5.0] - 2026-09-27
|
|
11
|
+
|
|
12
|
+
Python `Runtime.run` footprint mock, plot style / alert frequency tokens, and `alert()` gating. Compile emits the same names.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `request.footprint` Python mock on interpret and compile. `footprint.*` and `volume_row.*` accessors (call form). `request.seed` seeds the mock RNG so numbers match Python.
|
|
16
|
+
- `plot.style_line` … `plot.style_circles` and `alert.freq_once_per_bar` / `once_per_bar_close` / `all` on interpret and compile.
|
|
17
|
+
- `alert()` frequency gating: default once per bar, `"all"` every call, zero-arg is a no-op.
|
|
18
|
+
|
|
19
|
+
### Notes
|
|
20
|
+
- Realtime `once` rollback and the extension-analytics `ta.*` list are still open.
|
|
21
|
+
- Chart-series plots that Python leaves `na` stay unwired (`ta.beta`, `ta.skewness`, `ta.parkinson`, and the rest of that list).
|
|
22
|
+
|
|
23
|
+
## [0.4.0] - 2026-09-27
|
|
24
|
+
|
|
25
|
+
Interpret and compile for the next Python `Runtime.run` slice: bar-mode `ta.*` detectors, strategy field emit, drawing-book emit, and host helpers. `array.from` on the compile path collects its arguments.
|
|
26
|
+
|
|
27
|
+
### Added
|
|
28
|
+
- `ta.hammer`, `ta.gap_detector`, `ta.macd_signal`, `ta.acceleration_factor`, `ta.stoch_smooth`, `ta.engulfing`, `ta.inside_bar_pattern`, `ta.double_top_bottom`, `ta.voi`, `ta.bid_ask_imbalance`, `ta.rsi_oversold_overbought`, `ta.rsi_divergence`, `ta.cumulative_delta`, `ta.volume_momentum`, `ta.volume_profile_high`, `ta.volume_profile_low`, `ta.volume_thrust` (interpret and compile; v3/v4 bare aliases). Several are Python’s bar-mode sentinels (`ta.engulfing` is false every bar; `ta.stoch_smooth` is `na` unless both smooth lengths are 1).
|
|
29
|
+
- Compile emit for `strategy.cash` free cash, trade-history getters, and `oca` / `direction` / `commission` constants. `default_qty_type=strategy.cash` still sizes entries as cash.
|
|
30
|
+
- Compile emit for `timenow` / `timenow()`, `max_bars_back`, `alertcondition`, `plot.linestyle_*`, bare `random`, bare `security_lower_tf`.
|
|
31
|
+
- Compile emit for drawing getters and remaining setters, `*.all`, `*.copy`, `chart.point.*`, and `line.fill`.
|
|
32
|
+
|
|
33
|
+
### Changed
|
|
34
|
+
- Compile `array.from` collects its arguments. It no longer lowers to `array.new(size, initial)`.
|
|
35
|
+
|
|
36
|
+
### Notes
|
|
37
|
+
- Still unwired because a chart-series plot is `na` on every bar: `ta.skewness`, `ta.kurtosis`, `ta.sma_weighted`, `ta.atr_normalized`, `ta.parkinson`, `ta.garman_klass`, `ta.volume_weighted_momentum`, and `ta.beta`, `ta.r_squared`, `ta.comovement`, `ta.apo`.
|
|
38
|
+
- Footprint / `volume_row`, realtime `once` rollback, and the extension-analytics `ta.*` list are still open.
|
|
39
|
+
|
|
10
40
|
## [0.3.0] - 2026-09-23
|
|
11
41
|
|
|
12
42
|
`once` / multi-value `switch`, and a Python `Runtime.run` interpret parity slice (drawings, strategy fields, host helpers, TA/matrix). Compile emit for the TA/matrix/host names from that slice.
|
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ TypeScript / Bun library for **Pine Script**: parse, unparse, and interpret.
|
|
|
15
15
|
Same public names as Python [`pynescript`](https://github.com/hoox-sh/pyne): `parse`, `unparse`, `Runtime.run`.
|
|
16
16
|
Python `pynescript.runtime` is the **source of truth**. When semantics disagree, Python wins. This is not a TradingView platform certification.
|
|
17
17
|
|
|
18
|
-
**Docs (hoox.sh):** [PyneTS](https://hoox.sh/pyne/docs/pynets) · [install](https://hoox.sh/pyne/docs/pynets/install) · [runtime](https://hoox.sh/pyne/docs/pynets/runtime) · [CLI](https://hoox.sh/pyne/docs/pynets/cli) · [JS compile](https://hoox.sh/pyne/docs/pynets/compile) · [parity](https://hoox.sh/pyne/docs/pynets/parity) · [ecosystem](https://hoox.sh/pyne/docs/reference/ecosystem)
|
|
18
|
+
**Docs (hoox.sh):** [PyneTS](https://hoox.sh/pyne/docs/pynets) · [install](https://hoox.sh/pyne/docs/pynets/install) · [runtime](https://hoox.sh/pyne/docs/pynets/runtime) · [CLI](https://hoox.sh/pyne/docs/pynets/cli) · [JS compile](https://hoox.sh/pyne/docs/pynets/compile) · [parity](https://hoox.sh/pyne/docs/pynets/parity) · [missing features](https://hoox.sh/pyne/docs/pynets/missing-features) · [ecosystem](https://hoox.sh/pyne/docs/reference/ecosystem)
|
|
19
19
|
|
|
20
20
|
```ts
|
|
21
21
|
import { parse, unparse, Runtime } from "@hoox-sh/pynets";
|
|
@@ -134,17 +134,19 @@ Wired through one dispatcher (`src/runtime/interpret.ts`). Not a second engine.
|
|
|
134
134
|
|
|
135
135
|
**Language** — `var` / `varip` / `:=`, tuples, `if` / `for` / `while` / `switch`, UDFs, `type` / `enum`, `import`, `library()`.
|
|
136
136
|
|
|
137
|
-
**`ta.*`** — SMA/EMA/RMA/WMA/VWMA/HMA/ALMA/DEMA/TEMA/KAMA/SWMA, RSI, ATR, Supertrend, Keltner, BB/BBW, MACD, Stoch, CCI, WPR, DMI/ADX, SAR, MFI, CMO, TSI, COG, stdev/dev/variance, highest/lowest, crossover/crossunder, volume (OBV, PVT, AD, WAD, NVI/PVI, III, WVAD), pivots, barssince, valuewhen, percentiles, and the v3/v4 bare names.
|
|
137
|
+
**`ta.*`** — SMA/EMA/RMA/WMA/VWMA/HMA/ALMA/DEMA/TEMA/KAMA/SWMA, RSI, ATR, Supertrend, Keltner, BB/BBW, MACD, Stoch, CCI, WPR, DMI/ADX, SAR, MFI, CMO, TSI, COG, stdev/dev/variance, highest/lowest, crossover/crossunder, volume (OBV, PVT, AD, WAD, NVI/PVI, III, WVAD), pivots, barssince, valuewhen, percentiles, and the v3/v4 bare names. Also `uo`, `rci`, `dpo`, `kst`, `stochrsi`, `donchian`, `ichimoku`, `bb_pct`, `emv`, `fractal`, `atr_stop`, `zigzag`, and the Python bar-mode detectors (`hammer`, `gap_detector`, `macd_signal`, `acceleration_factor`, `stoch_smooth`, `engulfing`, `inside_bar_pattern`, `double_top_bottom`, `voi`, `bid_ask_imbalance`, `rsi_oversold_overbought`, `rsi_divergence`, `cumulative_delta`, `volume_momentum`, `volume_profile_high` / `low`, `volume_thrust`). Compile emits the same names. A chart-series plot that Python leaves `na` (`beta`, `r_squared`, `comovement`, `apo`, `skewness`, `kurtosis`, `parkinson`, `garman_klass`, and the same class) stays unwired.
|
|
138
138
|
|
|
139
139
|
**`math.*` / `str.*` / `color.*` / `input.*` / `log.*`** — the Python set, including `nz`, `iff`, `fixnan`, `timestamp`, `weekofyear`, `time_tradingday`.
|
|
140
140
|
|
|
141
141
|
**`array.*`** — new/from, get/set, push/pop/shift/unshift, slice/copy/concat, sort/search (binary + leftmost/rightmost), aggregates (avg/min/max/sum/median/mode/range/stdev/variance/covariance), percentiles, standardize, sort_indices.
|
|
142
142
|
|
|
143
|
-
**`matrix.*`** — shape ops, predicates, `mult` / `inv` / **`pinv`** / `pow` / `kron` / `rank` / **eigenvalues / eigenvectors
|
|
143
|
+
**`matrix.*`** — shape ops, predicates, `mult` / `inv` / **`pinv`** / `pow` / `kron` / `rank` / **eigenvalues / eigenvectors**, plus row/col `sum` / `avg` / `min` / `max` / `mode`, fill, reverse, copy, `stdev`, `variance`.
|
|
144
144
|
|
|
145
|
-
**`strategy.*`** — entry/exit/order, pending limit/stop, commission/slippage/pyramiding, open/closed trade accessors, **`strategy.risk.*`**, **OCA cancel/reduce**.
|
|
145
|
+
**`strategy.*`** — entry/exit/order, pending limit/stop, commission/slippage/pyramiding, open/closed trade accessors, **`strategy.risk.*`**, **OCA cancel/reduce**. `strategy.cash` is free cash and still selects cash sizing for `default_qty_type`.
|
|
146
146
|
|
|
147
|
-
**Drawings / alerts** — `line` / `label` / `box` / `table`
|
|
147
|
+
**Drawings / alerts** — `line` / `label` / `box` / `table` / `polyline` / `linefill` getters and setters, `*.all`, `*.copy`, `chart.point.*`; `alert` / `alertcondition` with Python frequency tokens (`alert.freq_*`). `plot.style_*` tokens. `timenow` is the dataset last-bar time on every bar.
|
|
148
|
+
|
|
149
|
+
**`request.*`** — same-symbol `security` passthrough; foreign / HTF without a feed is `na`. `request.footprint` is Python’s mock object (`footprint.*` / `volume_row.*`); `request.seed` seeds that mock.
|
|
148
150
|
|
|
149
151
|
---
|
|
150
152
|
|