@hoox-sh/pynets 0.3.0 → 0.4.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 +17 -0
- package/README.md +5 -5
- package/dist/browser.js +66 -66
- package/dist/index.js +1532 -38
- 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 +81 -1
- package/src/runtime/compile/emit_call.ts +312 -9
- package/src/runtime/compile/runtime.ts +20 -0
- package/src/runtime/compile/strategy.ts +253 -1
- package/src/runtime/interpret.ts +151 -0
- package/src/runtime/ta.ts +392 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.4.0] - 2026-09-27
|
|
11
|
+
|
|
12
|
+
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.
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- `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).
|
|
16
|
+
- 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.
|
|
17
|
+
- Compile emit for `timenow` / `timenow()`, `max_bars_back`, `alertcondition`, `plot.linestyle_*`, bare `random`, bare `security_lower_tf`.
|
|
18
|
+
- Compile emit for drawing getters and remaining setters, `*.all`, `*.copy`, `chart.point.*`, and `line.fill`.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- Compile `array.from` collects its arguments. It no longer lowers to `array.new(size, initial)`.
|
|
22
|
+
|
|
23
|
+
### Notes
|
|
24
|
+
- 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`.
|
|
25
|
+
- Footprint / `volume_row`, realtime `once` rollback, and the extension-analytics `ta.*` list are still open.
|
|
26
|
+
|
|
10
27
|
## [0.3.0] - 2026-09-23
|
|
11
28
|
|
|
12
29
|
`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,17 @@ 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`. `timenow` is the dataset last-bar time on every bar.
|
|
148
148
|
|
|
149
149
|
---
|
|
150
150
|
|