End User Hub
Install PYNE (pip install hoox-pyne), run CLI/library eval with mode=auto, wire editors (.pyne/.pine), and call Pro API alerts + webhooks.
This page
End User Hub
This track is for people who consume PYNE: parse and reformat Pine Script™, lint before upload, evaluate expressions or full scripts against OHLCV (mode=auto / interpret / compile), export alerts (optional L2 webhooks), wire an editor via LSP (.pyne / .pine), or call the HTTP evaluate contract. Contributor internals (grammar regeneration, AST builder, bar-loop semantics) live under Core, Runtime, and DevOps.
Abstract
PYNE exposes one language pipeline through several thin surfaces:
.pyne / .pine source
→ parse (ANTLR4 + ASDL AST)
→ optional: dump | unparse | lint | walk/transform
→ optional: evaluate (literal_eval | Runtime mode=auto|interpret|compile)
→ plots / fill / events / drawings / alerts / metrics
→ optional L2 webhooks (Pro API / edge)
The desk path is the pyne Click CLI (alias pynescript) and pynescript.ast / pynescript.runtime library API (PyPI distribution name hoox-pyne). The TypeScript desk path is PyneTS (bun add @hoox-sh/pynets). The editor path is pyne-lsp (alias pynescript-lsp; stdio; first-class .pyne association). The HTTP path is the Flask Pro API (POST /run with alerts export + webhooks, POST /optimize, preview, backtest). The optional chart is AXIS; the optional trade mesh is HOOX. Evaluation does not require either. Defaults for mode differ by surface — modes.
Conceptual model
Rendering…
| Surface | Entry | Typical job |
|---|---|---|
| CLI | pyne … (alias pynescript) | One-shot parse, format, lint, compile, run, optimize, prewarm, data |
| Library | from pynescript.ast import parse, unparse | Embed parse/transform/eval in tools |
| PyneTS | import { parse, Runtime } from "@hoox-sh/pynets" | Same names in TypeScript / Bun |
| LSP | pyne-lsp (alias pynescript-lsp) | Diagnostics, completion, hover (.pyne / .pine) |
| Pro API | POST /run · POST /optimize | Evaluate contract + strategy input.* search |
| AXIS | separate product | Chart PWA AXIS over evaluate results |
| HOOX | separate product | Edge execution mesh after strategy events |
Choose your path
1. Getting started
New install, first parse, and environment knobs:
- Installation — PyPI
pip install hoox-pyne(importpynescript), extras (lsp,compile,data,pro), Hatch checkout, smoke checks. - Quick start — Parse → dump → unparse → lint →
literal_evalin under ten minutes. - Configuration — Extras, console scripts, Pro API env vars (
ALERT_WEBHOOK_URL, compile cache), editor settings.
2. Operational guides
Daily workflows against the same pipeline:
- CLI —
check,format,lint,compile,prewarm,run,optimize,data, … - Library API —
parse,unparse,dump,walk, visitors, transformers, linter,optimize.run_study. - Evaluate scripts — Expression eval, bar-loop Runtime (
mode=auto), strategy events, alerts export, mock vs live data. - Editors — VS Code (
.pynefirst-class), Neovim, Zed, Emacs, Helix;clients/snippets. - Pro API usage —
/run(+webhook_url/ L2 webhooks),/run/batch,/optimize, preview, backtest as a consumer. - Troubleshooting — Parse failures, recursion limits, missing extras, CORS, auth.
3. Reference
- CLI commands — Full option trees for every Click command.
- Modes —
interpret/compile/autodefaults: library interpret,POST /runauto,pyne runcompile-only. - Glossary — AST, series, bar-loop, Runtime, ASDL, and related terms.
- FAQ — Version support, TradingView parity, licensing, AXIS/HOOX boundaries.
Interface surface (consumer map)
| Want | Command / import | Docs |
|---|---|---|
| Install core | pip install hoox-pyne (import pynescript) | Installation |
| Install LSP | pip install "hoox-pyne[lsp]" | Editors |
| Install market data deps | pip install "hoox-pyne[data]" | CLI data |
| Parse file | pyne parse-and-dump path.pyne | CLI |
| Normalize source | pyne parse-and-unparse path.pine | CLI |
| Lint | pyne lint path.pine | CLI |
| Library parse | from pynescript.ast import parse, unparse | Library API |
| Expression eval | from pynescript.ast.helper import literal_eval | Evaluate |
| Bar-loop eval | from pynescript.runtime import Runtime (mode default interpret) | Evaluate · modes |
| Incremental interpret | Runtime.create_session → append_bars / update_last_bar (0.6.1) | Evaluate |
| Compile-only smoke | pyne run script.pine --bars 50 | CLI |
| Warm Numba / IR | pyne prewarm / POST /compile/prewarm | CLI |
| Strategy HPO | pyne optimize / POST /optimize / pynescript.optimize.run_study | Optimize |
| Alerts + webhooks | /run → alerts[] / webhook_url | Alerts |
| Start LSP | pyne-lsp (stdio) | Editors |
| Local Pro API | make run / python -m backend.app | Pro API usage |
Preferred console scripts (aliases in parentheses) are registered in pyproject.toml:
| Script | Module | Role |
|---|---|---|
pyne (pynescript) | pynescript.__main__:cli | Desk CLI (Click group) |
pyne-lsp (pynescript-lsp) | pynescript.langserver.__main__:main | Language server (pygls) |
Do not conflate them: lint and parse live on pyne; editor features live on pyne-lsp.
Internals (repo paths)
Consumer-relevant code only — deeper design is linked from each guide:
| Path | Role |
|---|---|
src/pynescript/__main__.py | Click CLI: check, format, lint, compile, prewarm, run, optimize, data, info |
src/pynescript/ast/helper.py | Public parse, unparse, dump, walk, literal_eval |
src/pynescript/ast/linter.py | lint_script / PineLinter |
src/pynescript/ast/evaluator/ | Bar-aware and literal evaluators |
src/pynescript/runtime/ | Package Runtime SoT (bar-loop host, series, CustomEvaluator) |
src/pynescript/langserver/ | LSP features and server |
src/pynescript/util/data.py | Historical data providers (mock, yahoo, alphavantage, ccxt) |
backend/app.py | Flask Pro API entry (/run, auth, blueprints) |
backend/runtime.py | Compat shim → pynescript.runtime |
examples/ | Worked scripts (parse, RSI strategy, datafeed) |
clients/ | Editor client configs (Neovim, Zed, Emacs) |
vscode-extension/ | VS Code extension package |
Invariants & edge cases
- Round-trip is first-class.
parse→unparseshould preserve semantics; use it to normalize formatting, not as a semantic rewrite. - Mode split.
parse(..., mode="exec")yields a script tree;mode="eval"parses a single expression (used byliteral_eval). - No proprietary host required. Evaluation works offline with mock or supplied OHLCV; AXIS/HOOX are optional.
- Extras are opt-in. Core parse/lint needs only base deps (
antlr4-python3-runtime,click, …). LSP needs[lsp]; CCXT paths need[data]/[datafeed]. - Optional example dir.
pinescript_filepathonly expands when--example-scripts-dirpoints at local*.pinefiles; no third-party corpus is shipped.
Worked examples
Minimal library round-trip:
from pynescript.ast import parse, unparse
source = """
//@version=6
indicator("My RSI")
plot(ta.rsi(close, 14))
"""
tree = parse(source)
print(unparse(tree))
Minimal CLI:
pip install hoox-pyne
pyne parse-and-dump examples/rsi_strategy.pine
pyne lint examples/rsi_strategy.pine
Minimal HTTP evaluate (local server running):
curl -s http://127.0.0.1:5002/ \
| python -m json.tool
Failure modes
| Symptom | Likely cause | Where to go |
|---|---|---|
pyne: command not found | Package not on PATH / venv inactive | Installation |
pyne-lsp missing | Installed without [lsp] extra | Editors |
SyntaxError on parse | Grammar mismatch or truncated source | Troubleshooting |
/run 400 NO_DATA | Missing OHLCV list | Pro API usage |
| Numerical drift vs TradingView | Builtin / series edge case | Compatibility |
See also
- PYNE product map — full stack overview
- Installation
- Quick start
- Runtime modes
- Evaluate contract (API)
- AXIS docs — optional chart
- HOOX docs — optional edge trade mesh