Skip to main content

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.6.24 · 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

Source (.pyne / .pine)
  → ANTLR4 lexer / parser
  → ASDL AST
  → bar-loop  (interpret | compile | auto)
  → plots · fills · drawings · strategy events · alerts
  → CLI · LSP · Pro API · Pyodide · 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. This tree does not ship third-party script corpora or TradingView® builtin downloads.

Corpus snapshot (set01–04 · local · 2026-08-09)

Open-source Pine regression sets (2477 scripts at snapshot time; not in git) under parse+unparse and Runtime interpret (50 bars, 12 s timeout). Newer runs use SETS=set05 (Makefile corpus-flow) — re-measure before quoting live coverage.

Suite Rate Detail
Parse + unparse 99.96% 2476 / 2477 OK — residual is one intentional invalid line-wrap demo
Runtime interpret 100% excl. EXPECTED 2466 OK + 11 intentional demos (runtime.error guards, lower-TF security, pathological loops)
set01 Runtime 100% 249 / 249 OK

Internal interpret ↔ compile series alignment is harness-tested. That is engine consistency, not TradingView® platform certification.


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]"

GHCR multi-arch images on v* tags:

docker pull ghcr.io/hoox-sh/pyne/cli:0.6.24
docker run --rm -v "$PWD:/work" -w /work ghcr.io/hoox-sh/pyne/cli:0.6.24 check script.pine

docker pull ghcr.io/hoox-sh/pyne/lsp:0.6.24
docker run --rm -i -v "$PWD:/work" -w /work ghcr.io/hoox-sh/pyne/lsp:0.6.24

docker pull ghcr.io/hoox-sh/pyne/api:0.6.24
docker run --rm -p 5002:8080 -e ADMIN_TOKEN=… ghcr.io/hoox-sh/pyne/api:0.6.24

Packages: ghcr.io/hoox-sh/pyne.

Edge POST /run (thin Workers host, separate repo):

Deploy to Cloudflare

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.


Compatibility

PYNE targets practical runtime fidelity against first-party fixtures, unit tests, and (when present locally) open-source corpus sets. It does not claim TradingView® certification, complete platform parity (chart host, data model, every builtin, closed UI), or bar-for-bar agreement with the TradingView® platform.

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
In-tree CHANGELOG · CONTRIBUTING · SECURITY
make install   # editable + LSP
make test      # pytest
make lint      # ruff

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.6.25

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hoox-pyne 0.6.25
File Size Uploaded Provenance Actions
hoox_pyne-0.6.25.tar.gz 6.1 MB Without provenance Details for hoox_pyne-0.6.25.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hoox-pyne 0.6.25
File Interpreter ABI Platform Actions
hoox_pyne-0.6.25-py3-none-any.whl Python 3 none any Details for hoox_pyne-0.6.25-py3-none-any.whl

Total release size: 7.6 MB

Release files / hoox_pyne-0.6.25.tar.gz

Download URL hoox_pyne-0.6.25.tar.gz
Size 6.1 MB
Tags Source
SHA-256 checksum
How to use checksums
45d49c43493a29d77c65efb52393686acdd2cd22306eba821fa095d5c36cba9f
BLAKE2b-256 checksum
How to use checksums
101d435a0b4ca9e1fba6abe9ebd70da460c165a6e22f53afb56f27a7ec00b35f
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.6.25-py3-none-any.whl

Download URL hoox_pyne-0.6.25-py3-none-any.whl
Size 1.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5c631221faa0eed7eb7b40757cf0cf9c7806a811a72d4609f45d9540d9b399f7
BLAKE2b-256 checksum
How to use checksums
b90eca3120e0878b76a439af6f506359093f2bb71b7cadfc2ed05d51007c0dfe
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.6.25

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.

Release history Release notifications | RSS feed

This release

0.6.25 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page