@luxalgo/vela-pinets 0.2.1

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 ADDED
@@ -0,0 +1,44 @@
1
+ # Vela-pinets
2
+
3
+ The PineTS scripting engine for the [Vela](https://github.com/LuxAlgo/Vela) charting
4
+ library — Pine Script indicators **and strategies** executed in-process (`PineEngine`) or
5
+ off the main thread (`PineWorkerEngine`), plugged into Vela's public `ScriptingEngine`
6
+ port. A `strategy()` script also emits its broker-emulator order fills as
7
+ `IndicatorModel.trades` (one marker per fill, at the fill bar and price), which Vela
8
+ paints as on-chart trade markers.
9
+
10
+ ```ts
11
+ import { Vela } from '@luxalgo/vela';
12
+ import { PineEngine } from '@luxalgo/vela-pinets';
13
+
14
+ const chart = new Vela('#chart', { symbol: 'BTCUSDT', timeframe: '60' });
15
+ chart.registerEngine('pine', new PineEngine());
16
+ chart.addIndicator(`//@version=5
17
+ indicator("EMA 20", overlay=true)
18
+ plot(ta.ema(close, 20), color=color.orange)`);
19
+ ```
20
+
21
+ - **`PineEngine`** — in-process: the simplest setup. `pinets` is a peer of the whole
22
+ package (`npm i @luxalgo/vela-pinets pinets`) — the published entry imports it
23
+ unconditionally, so it must resolve whichever engine you pick; the worker only avoids a
24
+ *second* copy by inlining its own at build time.
25
+ - **`PineWorkerEngine`** — the same Pine semantics in a Web Worker (source inlined at
26
+ build time, spawned from a Blob URL): heavy scripts never block the chart.
27
+ - **Browser builds** — `vela-pinets.global.js` / `.global.min.js` expose
28
+ `window.VelaPinets` for script-tag usage; load `vela.global.js` first.
29
+
30
+ ## Development
31
+
32
+ ```
33
+ npm install
34
+ npm run playground # http://localhost:5192 — Vela widget + this engine, HMR
35
+ npm run typecheck && npm run lint && npm run test && npm run build
36
+ ```
37
+
38
+ Vela is consumed as `file:../Vela` (built dist): clone this repo next to
39
+ [Vela](https://github.com/LuxAlgo/Vela) and build Vela first.
40
+
41
+ ## License
42
+
43
+ [AGPL-3.0](LICENSE) — this package depends on `pinets`, which is AGPL-3.0 licensed.
44
+ The Vela charting library itself is Apache-2.0.