Local reference
pip install pynescript. Parse, lint, evaluate, and round-trip Pine Script™-compatible scripts with high fidelity on your machine — see the status matrix for live coverage.
$pip install pynescriptOpen CLI →PYNE is open source under AGPL v3 — grammar, evaluator, workers, and parity harness free to audit, fork, and self-host. An independent, production-oriented runtime for Pine Script™-style strategies with a formal ANTLR4 grammar, high round-trip fidelity, and broad language coverage across 500+ builtins (see the status matrix — not full platform parity). Scripts parse to an inspectable ASDL tree, run in deterministic bar loops, and emit strategy events — on the desk, on Cloudflare® Workers, or in any isolate you control. No artificial history ceilings. No closed interpreter. No paywall around the bar loop.
Unofficial · not affiliated with TradingView, Inc. Pine Script™ and TradingView® are trademarks of TradingView, Inc.
ANTLR4 grammar and ASDL tree — every token inspectable, every node addressable.
Deterministic bar loop on Python, Cloudflare® Workers, or an in-browser isolate.
Strategy events into the HOOX mesh under one wire contract — desk to edge.
Four entry points, one stack. Pick the surface that matches the job — desk, API, edge, or editor.
pip install pynescript. Parse, lint, evaluate, and round-trip Pine Script™-compatible scripts with high fidelity on your machine — see the status matrix for live coverage.
$pip install pynescriptOpen CLI →POST scripts and OHLCV to a stable evaluate contract — same payload on desk, worker, or custom host.
$curl -X POST $HOST/run …API surface →Deploy pyne-worker or pine-worker. Evaluate at the edge; emit strategy events into the HOOX mesh.
$npx wrangler deployWorkers →Install the LSP. Autocomplete 480+ builtins, diagnostics, hover docs, outline — VS Code, Neovim, Zed, Emacs.
$pip install "pynescript[lsp]"LSP setup →Strategies should not die with a tab. Evaluate at the edge or on a server you control.
Multi-year bars on data you store — not a 20k ceiling tied to a subscription.
ANTLR4, ASDL, public builtins. If you cannot inspect the runtime, you cannot trust the fill.
The desk surface. Parse, lint, format, and pull market data without opening a browser.
Core library · parser · evaluator · CLI entrypoints
Print the ASDL tree for inspection and tooling
Format without losing structure
Nine rules — naming, deprecations, style — before upload
Gate pipelines on warnings as well as errors
Fetch OHLCV via Yahoo, Alpha Vantage, or CCXT
Language server + editor clients
Run the language server on standard I/O
from pynescript.ast.helper import parse, unparse
script = """
//@version=6
indicator("My RSI")
plot(ta.rsi(close, 14))
"""
tree = parse(script)
print(unparse(tree))Prefer a library? from pynescript.ast.helper import parse is the same ANTLR4 pipeline the CLI wraps.
Two HTTP surfaces share the same evaluation contract: the Flask Pro API for local/cloud research, and pyne-worker on Cloudflare® for edge production.
| Method | Path | Auth | Role |
|---|---|---|---|
| POST | /run | X-API-Key | Execute Pine Script™ against inline OHLCV or R2-resolved symbol/timeframe. |
| POST | /ingest | X-API-Key | Upload OHLCV bars to R2 (JSONL / gzipped JSONL). |
| GET | /health | None | Worker + R2 + trade-worker binding status. |
| POST | /preview/chart | API key · Pro | Flask Pro: chart thumbnail generation. |
| POST | /backtest/quick | API key · Pro | Flask Pro: quick backtest with equity curve. |
{
"script": "//@version=6\nstrategy(\"Edge\")\n...",
"symbol": "BTCUSDT",
"timeframe": "1d",
"ohlcv": [
{ "open": 100, "high": 105, "low": 95, "close": 102, "time": 1000, "volume": 1e3 }
]
}pynescript is the reference object: a grammar-driven parser and bar-loop evaluator for Pine Script™ v5 and v6 — strong syntactic fidelity and high round-trip fidelity (parse → AST → unparse). Downstream workers are ports, not rewrites of the language. Not a TradingView platform clone.
Pine Script™ v5/v6 grammar surface tracked against open corpora — high coverage on language core, not a guarantee of full hosted-platform parity.
Parse and unparse without losing structure. Formatting and AST round-trips stay faithful to the source.
Shared lexer/parser for v5 and v6. One source of truth for every runtime.
25+ node types. Visitors transform and evaluate without string hacks.
ta.*, math.*, strategy.*, array.*, str.*, matrix.* — namespaces that match author muscle memory.
Fixtures shared with TypeScript. Divergent event lists fail the build.
v5 / v6
ASDL nodes
500+ builtins
Typed intents
HOOX mesh
Two edge surfaces, one contract. Python for production fidelity on Cloudflare® Workers; TypeScript for pure V8 isolates and HOOX service bindings.
Python · Cloudflare® Worker · ~1.1k LOC
HMAC API keys, sliding-window rate limits, R2 OHLCV, structured logs, trade-worker event forwarding. Free-tier viable for retail volume.
TypeScript · isolate · ~8k LOC
Same grammar, TypeScript runtime. Zod AST schemas, core builtin modules, zero-dependency V8, service bindings into the HOOX mesh.
Warm multi-strategy workloads on pyne-worker land in the low hundreds of milliseconds; cold starts remain seconds-class under free-tier realities. Keep the isolate warm if latency is sacred.
*Within Cloudflare® free-tier envelopes. Scale when volume demands it.
Professional editor features for Pine Script™ — not a syntax highlighter with dreams. The language server ships with pynescript and speaks stdio to any LSP client.
Nine lint rules: naming, deprecated APIs, style.
482 builtins across 20 categories (ta.*, strategy.*, array.*, …).
Signatures, docs, examples, see-also links.
Jump to functions, types, and variables.
Every use of a symbol in the buffer.
Hierarchical symbol tree for long strategies.
Full document and range format via the same pipeline.
VS Code, Neovim, Zed, Emacs — one server binary.
$ pip install "pynescript[lsp]" && pynescript-lsp --stdio
Install the pynescript LSP extension; open a .pine file — the language server activates automatically.
code --install-extension pynescript-lsp
Register via nvim-lspconfig.
require('lspconfig').pynescript.setup({})Point language_servers at pynescript-lsp --stdio.
"pynescript": { "command": "pynescript-lsp", "arguments": ["--stdio"] }lsp-mode client with stdio connection.
(lsp-stdio-connection '("pynescript-lsp" "--stdio"))Revenue, if any, is managed hosting and commercial licenses — never a paywall around the evaluator. AGPL v3 for the grammar, runtimes, and parity harness.
AGPL v3 · forever
Ops without the pager
Non-AGPL rights
PhilosophySoftware freedom means the evaluator survives any single company. The code stays open; operators choose the best runtime of the code.
Open source under AGPL v3. High corpus coverage with an honest status matrix. High round-trip fidelity. Parse the language, own the AST, run the bar loop where the edge is cheap — and keep the evaluator free. Leave the barbed wire to those who still believe in fences.