PYNE
An independent open toolchain for the Pine Script™ language: ANTLR4 grammar, ASDL AST, dual-engine bar-loop runtime, language server, and HTTP evaluate surface.
Pine is usually executed inside a host chart. PYNE models the language as an inspectable pipeline — source through parse, AST, and deterministic bar-loop evaluation — so the same scripts can be analysed and run outside any particular UI. Import pynescript. CLIs: pyne, pyne-lsp, pyne-mcp (aliases pynescript, pynescript-lsp).
0.7.2 · PyPI hoox-pyne
PYNE is the language engine. HOOX is the execution mesh; AXIS is the charting PWA. All three publish under hoox.sh.
Pipeline
flowchart LR
S["Source<br/>.pyne / .pine"] --> P["ANTLR4 lexer / parser"]
P --> A["ASDL AST"]
A --> R["Bar-loop<br/>interpret · compile · auto"]
R --> O["Plots · fills · drawings<br/>strategy events · alerts"]
O --> C["CLI"]
O --> L["LSP"]
O --> H["Pro API"]
O --> Y["Pyodide"]
O --> W["Cloudflare Workers"]
The same contract underlies the desk CLI, pyne-lsp, Flask POST /run, AXIS in-browser Pyodide, and pyne-worker (POST /run at the edge). Coverage and gaps: compatibility · missing features. Vendored OpenPineScript TradingView goldens live in tests/fixtures/tv_goldens/. Community set0x corpora and official TradingView builtin_scripts stay local-only.
Features
| Area | What you get |
|---|---|
| Parser | ANTLR4 v5/v6 grammar, ASDL AST, parse ↔ unparse, structural linter |
| Runtime | Deterministic bar-loop interpret + Numba compile (auto), sessions, strategies, alerts, drawings |
| Language server | Diagnostics, completion (~800+ builtins), hover, navigation, semantic tokens, formatting, Convert to v6 |
| CLI | check, format, lint, compile, run, execute, data, prewarm, mcp |
| MCP | Stdio server + pyne mcp call for parse / lint / convert / compile / run |
| Backends | Flask Pro API (/run, batch, preview, backtest, optimize), Cloudflare Workers, Pyodide |
| Editors | VS Code (AXIS Void / Hoox Signal / PYNE Volt themes), Neovim, Zed, Emacs |
| Parity | 112 / 112 TradingView golden columns (OpenPineScript harnesses, ~2,475 daily bars, rel 1e-6) |
Surfaces
| Surface | Role |
|---|---|
CLI (pyne) |
Check, format, lint, compile, run (compile smoke), execute (Runtime.run), data, prewarm, MCP call |
LSP (pyne-lsp) |
Diagnostics, completion (~800+ builtins), hover, navigation, semantic tokens, formatting |
MCP (pyne-mcp / pyne mcp) |
Stdio server and in-process pyne mcp call — parse / lint / convert / compile / Runtime.run |
| VS Code | First-class .pyne / .pine (extension) |
| Pro API | HTTP evaluate, batch, chart preview, quick backtest, /optimize, datafeed |
| Editors | Neovim, Zed, Emacs under clients/ |
| PyneTS | TypeScript / Bun library @hoox-sh/pynets |
Front-end. Approximate Pine v5–v6 via ANTLR4 resource grammars; ASDL AST with visitor/transformer; parse → unparse; structural linter.
Runtime. Deterministic indicator and strategy evaluation on OHLCV. Dual engine: interpret (AST walk) and compile (Numba nopython with object-mode fallback); mode ∈ {auto, compile, interpret}. Persistent sessions (Runtime.create_session, append_bars, update_last_bar). Alerts with documented frequency. Strategy entries/exits, commission/slippage, drawing GC. request.security same-symbol simple OHLCV and allowlisted ta.*; foreign or complex security resolves to na.
Install
pip install hoox-pyne # library + CLI
pip install "hoox-pyne[lsp]" # language server
pip install "hoox-pyne[compile]" # Numba path
pip install "hoox-pyne[data]" # market data
pip install "hoox-pyne[pro]" # Flask Pro API
pip install "hoox-pyne[mcp]" # stdio MCP (pyne mcp call needs no extra)
git clone https://github.com/hoox-sh/pyne.git
cd pyne
pip install -e ".[lsp,pro]"
Editors: the VS Code extension lives in its own repo —
hoox-sh/pyne-lsp-vsce. It is a thin
client for pyne-lsp and ships no server of its own; install
hoox-pyne[lsp] (or let the extension prompt for it). Neovim / Zed / Emacs
configs are in clients/.
GHCR multi-arch images on v* tags:
docker pull ghcr.io/hoox-sh/pyne/cli:0.6.31
docker run --rm -v "$PWD:/work" -w /work ghcr.io/hoox-sh/pyne/cli:0.6.31 check script.pine
docker pull ghcr.io/hoox-sh/pyne/lsp:0.6.31
docker run --rm -i -v "$PWD:/work" -w /work ghcr.io/hoox-sh/pyne/lsp:0.6.31
docker pull ghcr.io/hoox-sh/pyne/api:0.6.31
docker run --rm -p 5002:8080 -e ADMIN_TOKEN=… ghcr.io/hoox-sh/pyne/api:0.6.31
docker pull ghcr.io/hoox-sh/pyne/mcp:0.6.31
docker run --rm -p 5003:8080 ghcr.io/hoox-sh/pyne/mcp:0.6.31
Packages: ghcr.io/hoox-sh/pyne.
Edge POST /run (thin Workers host, separate repo):
Read pyne-worker limitations before deploying.
Quickstart
from pynescript.ast.helper import parse, unparse, literal_eval
source = """
//@version=6
indicator("My RSI")
plot(ta.rsi(close, 14))
"""
print(unparse(parse(source)))
literal_eval("1 + 2 * 3") # 7
pyne check script.pine
pyne format script.pine -w
pyne lint script.pine
pyne execute script.pine --mode interpret --bars 50
pyne compile script.pine --emit
pyne data AAPL --provider yahoo --period 6mo
pyne mcp tools
pyne mcp call lint script.pine
pip install "hoox-pyne[lsp]"
pyne-lsp
pip install "hoox-pyne[mcp]"
pyne mcp config # mcpServers JSON
pyne mcp # stdio
pyne mcp call execute script.pine --arg bars=50 --arg mode=interpret
MCP catalog: tools. Editors: VS Code; Neovim / Zed / Emacs in clients/. CLI map: commands.
Pro API
make run binds :5002. POST /run accepts mode ∈ {auto, compile, interpret} and returns plots, series, events, drawings, alerts (error_kind / error_bar on failure). Optional webhook_url / ALERT_WEBHOOK_URL for last-bar alert firings.
make run
curl -s http://127.0.0.1:5002/run \
-H 'Content-Type: application/json' \
-d '{
"script": "//@version=6\nindicator(\"demo\")\nplot(close)",
"data": [{"open":1,"high":2,"low":0.5,"close":1.5,"time":1,"volume":1}],
"mode": "auto"
}'
Also: /run/batch, /compile/prewarm, /preview/chart, /backtest/quick, /optimize, /lsp/*, CCXT datafeed, optional hosted runner (PYNE_RUNNER=1). Docs: POST /run · API.
MCP
PYNE ships a Model Context Protocol server so agents and editors can parse, lint, convert, compile, and run Pine without shelling out.
pip install "hoox-pyne[mcp]"
pyne mcp tools # list every tool
pyne mcp config # print the mcpServers JSON
pyne mcp # stdio server (pyne-mcp)
pyne mcp call lint script.pine # in-process call, no server
| Tool | Purpose |
|---|---|
pyne_parse / pyne_check |
Parse source → AST / diagnostics |
pyne_lint / pyne_format |
Structural lint and format |
pyne_convert |
Convert Pine v1–v5 toward v6 |
pyne_compile / pyne_prewarm |
Compile to the Numba IR / warm caches |
pyne_run / pyne_execute |
Runtime.run over OHLCV (interpret / compile / auto) |
pyne_hover / pyne_complete / pyne_signature |
Language intelligence for editors |
pyne_optimize |
Strategy HPO |
pyne_runner_* |
Hosted script registry + bar-close ticks |
Client config (pyne mcp config prints this):
{
"mcpServers": {
"pyne": { "command": "pyne-mcp" }
}
}
Full catalog: MCP tools · MCP guide.
TradingView goldens
Nine Pine harnesses were run inside TradingView on BINANCE:BTCUSDT 1D. The Pine Logs exports — OHLCV plus every plot column — ship in-tree. PYNE replays the same scripts on those bars.
112 columns · ~2,475 bars each · rel 1e-6 / abs 1e-9 · all agree
That is the same fixture set OpenPineScript uses: ta.*, math.*, strategy broker timing, and control-flow / loop probes, compared against TradingView's own per-bar output. Coverage of that slice is 112 / 112. Chart host, remaining builtins, and live data are tracked under compatibility / missing features.
make tv-goldens # 112 columns vs the vendored exports
make tv-goldens-strict # fail on any divergence
Recipe, provenance, and GPL-3.0 notice: tests/fixtures/tv_goldens/.
Compatibility
The goldens above are the numerical check against the platform on that fixture set. Interpret ↔ compile plot parity is gated on first-party TA goldens; official TradingView builtin scripts report 0 MISMATCH when they are present locally.
Foreign / complex request.security resolves to na. TV Supertrend band ratchet, tick-path broker, and pixel chart UI are out of scope. Map: compatibility · missing features.
Results are for research, development, and self-hosted evaluation. They are not financial advice and are not provided by TradingView, Inc.
Documentation
Canonical docs: hoox.sh/pyne/docs
| Topic | Link |
|---|---|
| Install · quick start | Getting started |
| CLI | Guide · commands |
| MCP | Guide · tools |
| Runtime | Evaluate · alerts · compiler |
| Pro API | API |
| LSP | Hub · VS Code |
| Coverage | Compatibility · missing |
| TradingView goldens | fixture README · COMPATIBILITY.md |
| In-tree | CHANGELOG · CONTRIBUTING · SECURITY |
make install # editable + LSP
make test # pytest
make lint # ruff
make tv-goldens # 112 columns vs vendored TradingView exports
Ecosystem
https://hoox.sh
┌──────────────┼──────────────┐
▼ ▼ ▼
HOOX PYNE AXIS
(edge execution) (Pine engine) (charting UI)
| Product | Role | Docs |
|---|---|---|
| HOOX | Signal in → risk → CEX / DEX hop → notify | docs.hoox.sh |
| PYNE | Pine Script™ grammar, AST, dual-engine runtime, LSP, Pro API | hoox.sh/pyne/docs |
| AXIS | Installable charting PWA (Solid + Vite; offline via Pyodide) | hoox.sh/axis/docs |
Satellites: PyneTS, pyne-worker, pyne-agent-worker, pyne-lsp / pyne-vscode (in this tree), axis-plugin-boilerplate. HOOX isolate list: hoox-sh/hoox.
License
SPDX: AGPL-3.0-or-later · Copyright (C) 2024–2026 jango_blockchained · LICENSE.
Educational and research use. Trading involves substantial risk of loss. This is not financial advice.
Pine Script™ and TradingView® are trademarks of TradingView, Inc.; Cloudflare® is a trademark of Cloudflare, Inc. PYNE is an independent, unofficial implementation. It is not affiliated with, authorized by, sponsored by, or endorsed by TradingView, Inc. or Cloudflare, Inc.
Metadata
Release files for hoox-pyne 0.7.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hoox_pyne-0.7.2.tar.gz | 5.0 MB | Without provenance | Details for hoox_pyne-0.7.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| hoox_pyne-0.7.2-py3-none-any.whl | Python 3 | none | any | Details for hoox_pyne-0.7.2-py3-none-any.whl |
Total release size: 6.7 MB
Release files / hoox_pyne-0.7.2.tar.gz
| Download URL | hoox_pyne-0.7.2.tar.gz |
|---|---|
| Size | 5.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fdd0d19aa382793677f91f0857c4f4b8cf06be62bc6f59b6e6f121917b0c611
|
|
BLAKE2b-256 checksum How to use checksums |
2e6e88759427bae0d0583c99e15814edc07580f224586ab154cac975205b6347
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / hoox_pyne-0.7.2-py3-none-any.whl
| Download URL | hoox_pyne-0.7.2-py3-none-any.whl |
|---|---|
| Size | 1.7 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
87ed559486fbc77be4316c1d991793f0964a84784e62dcf35e20cc551f0805b0
|
|
BLAKE2b-256 checksum How to use checksums |
a78af0da94666d08d59eddabef29698ce4230e4479e94b7dc6b6f2466e0fc06f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for hoox-pyne 0.7.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.