Skip to content

docs: Update quant scripting docs for Navi#1169

Merged
huacnlee merged 2 commits into
mainfrom
quant-navi
Jul 20, 2026
Merged

docs: Update quant scripting docs for Navi#1169
huacnlee merged 2 commits into
mainfrom
quant-navi

Conversation

@huacnlee

Copy link
Copy Markdown
Member

longbridge quant run now defaults to Navi (longbridge-terminal#267), so the CLI docs and the longbridge skill are rewritten around it.

Scope

  • docs/{en,zh-CN,zh-HK}/docs/cli/quant/index.md — language section and all examples
  • docs/{en,zh-CN,zh-HK}/docs/cli/quant/backtest.md — 4 strategy scripts and the strategy() settings table
  • skills/longbridge/references/cli/quant.md — 11 examples

Every example script is new Navi source and passes navi lint.

Errors this surfaced

These were already broken before the rewrite:

  • jq paths were wrong. Docs used .data.report_json; the report is at .report_json. Every documented backtest one-liner returned null.
  • The Bollinger example was needlessly manual. It stated ta.bbands was unavailable and built bands from ta.sma + ta.stdev. Navi's ta.bb returns (basis, upper, lower) directly.
  • strategy() settings named PineScript symbolsstrategy.commission.percent, strategy.fixed, strategy.percent_of_equity — which in Navi are CommissionType / DefaultQtyType variants.
  • Indicator outputs were stale. The six indicator examples now show real quant run output.

Syntax highlighting

Replaces the OpenPine TextMate grammar with the official Navi grammar from navi-docs, registered as navi with an nv alias. The pine alias is dropped, and all fences use nv.

Note on remaining stale values

The JSON figures under Backtesting in backtest.md are carried over unverified — the quant API has been returning code=14 (UNAVAILABLE) and I could not re-run them. Worth re-checking once it recovers. The indicator tables in index.md are freshly captured.

Per-language reference detail is kept deliberately thin: navi-lang.org is authoritative and its API evolves.

🤖 Generated with Claude Code

`longbridge quant run` now defaults to Navi, so the CLI docs and the
longbridge skill were rewritten around it. Every example script is new
Navi source that passes `navi lint`.

Also corrects errors the rewrite surfaced:

- `jq` paths used `.data.report_json`, which no longer resolves; the
  report is at `.report_json`.
- The Bollinger example said `ta.bbands` was unavailable and built the
  bands from `ta.sma` + `ta.stdev`; Navi's `ta.bb` returns basis, upper,
  and lower directly.
- Indicator outputs were stale — they are now real `quant run` output.
- `strategy()` settings referenced `strategy.commission.percent` and
  `strategy.fixed`; these are `CommissionType` and `DefaultQtyType`
  variants in Navi.

Syntax highlighting switches to the official Navi TextMate grammar from
navi-docs, registered as `navi` with an `nv` alias. The `pine` alias is
dropped along with the OpenPine grammar, and all fences now use `nv`.

Per-language reference detail is kept deliberately thin — navi-lang.org
is authoritative and its API evolves.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@huacnlee huacnlee changed the title docs: Switch quant scripting docs from OpenPine to Navi docs: Update quant scripting docs for Navi Jul 20, 2026
huacnlee added a commit to longbridge/skills that referenced this pull request Jul 20, 2026
`longbridge quant run` now defaults to Navi
([longbridge-terminal#267](longbridge/longbridge-terminal#267)).

## Changes to `skills/longbridge-quant/references/quant-cli.md`

- **Refreshed the `--help` dump** — it gained `--language` (`navi`
default, `pine` for PineScript compatibility)
- **Added a Navi example script**, verified with `navi lint`. The
reference had no example script at all before
- **Notes** now point at [navi-lang.org](https://navi-lang.org) as
authoritative and mention `navi lint`, since the API reports script
errors only as an opaque error code
- **Documented a JSON-mode caveat**: `--format json` sets
`exclude_chart`, so series values are absent from the response —
screening has to read the `Last` column from the table output instead

Related:
[longbridge/developers#1169](longbridge/developers#1169)
covers the public docs and the `longbridge` skill.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@huacnlee
huacnlee merged commit 8c082a3 into main Jul 20, 2026
2 checks passed
@huacnlee
huacnlee deleted the quant-navi branch July 20, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant