tradingview-reader

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

TradingView Reader (Read-Only)

TradingView 读取器(只读模式)

Reads TradingView's desktop macOS app for quotes, options chains, and chart state via opencli and a CDP attach to the running TradingView.app process. Powered by the
tradingview
plugin in this repo's
opencli-plugins/tradingview
tree (a separate plugin from opencli's built-in adapters, installed via opencli's monorepo subpath syntax).
This skill is read-only. Designed for analysis: pulling options chains, checking IV/greeks, capturing chart state. It does NOT place trades, post ideas, modify watchlists, or change chart layouts.
Important: Unlike browser-based opencli readers (twitter, linkedin), this one talks directly to a running TradingView desktop app over Chrome DevTools Protocol. The user must (a) have
TradingView.app
installed, and (b) be logged in inside that app. The plugin handles relaunching with the debug port.
How it works: data commands harvest session cookies via CDP
Storage.getCookies
, then fire HTTP requests from Node directly. Page-context fetch is blocked by browser CORS preflight even from TradingView's own pages — the desktop app uses Electron's main process (Node network stack) to bypass this, and we replicate that path. No Browser Bridge extension required, no
apps.yaml
registration needed.

通过opencli和连接到运行中TradingView.app进程的CDP(Chrome DevTools Protocol),读取TradingView macOS桌面应用中的报价、期权链和图表状态。本技能由本仓库
opencli-plugins/tradingview
目录下的
tradingview
插件提供支持(该插件独立于opencli的内置适配器,需通过opencli的单仓库子路径语法安装)。
本技能为只读模式,专为数据分析设计:可提取期权链、查看隐含波动率(IV)/希腊值、捕获图表状态。不支持下单交易、发布观点、修改观察列表或更改图表布局。
重要说明:与基于浏览器的opencli读取器(如Twitter、LinkedIn读取器)不同,本工具通过Chrome DevTools Protocol直接与运行中的TradingView桌面应用通信。用户必须满足两个条件:(a) 已安装
TradingView.app
;(b) 已在该应用中登录。插件会自动处理带调试端口的重启操作。
工作原理:数据命令通过CDP的
Storage.getCookies
获取会话Cookie,然后由Node直接发送HTTP请求。即使是TradingView自身页面,页面上下文的fetch也会被浏览器CORS预检阻止——桌面应用使用Electron的主进程(Node网络栈)绕过此限制,我们复刻了这一实现路径。无需安装Browser Bridge扩展,也无需注册
apps.yaml

Step 1: Ensure opencli + Plugin Are Installed and Ready

步骤1:确保opencli及插件已安装并就绪

Current environment status:
!`(command -v opencli && opencli tradingview status 2>&1 | head -5 && echo "READY" || echo "SETUP_NEEDED") 2>/dev/null || echo "NOT_INSTALLED"`
If the status above shows
READY
, skip to Step 2. Otherwise:
当前环境状态:
!`(command -v opencli && opencli tradingview status 2>&1 | head -5 && echo "READY" || echo "SETUP_NEEDED") 2>/dev/null || echo "NOT_INSTALLED"`
如果上述状态显示
READY
,请跳至步骤2。否则:

NOT_INSTALLED — Install opencli

NOT_INSTALLED — 安装opencli

bash
npm install -g @jackwener/opencli
Requires Node.js >= 21 (or Bun >= 1.0).
bash
npm install -g @jackwener/opencli
需要Node.js ≥ 21(或Bun ≥ 1.0)。

SETUP_NEEDED — Install the TradingView plugin and launch with CDP

SETUP_NEEDED — 安装TradingView插件并通过CDP启动

The TradingView adapter is not built into opencli — it's a separate plugin:
bash
undefined
TradingView适配器未内置在opencli中,是一个独立插件:
bash
undefined

Install the plugin

安装插件

opencli plugin install github:himself65/finance-skills/tradingview
opencli plugin install github:himself65/finance-skills/tradingview

Relaunch TradingView.app with CDP enabled (one-time per session)

启用CDP重启TradingView.app(每次会话只需执行一次)

opencli tradingview launch

The `launch` step quits the running TradingView and reopens it with `--remote-debugging-port=9222`. **Warn the user to save chart layouts first** if they have unsaved drawings.
opencli tradingview launch

`launch`步骤会关闭正在运行的TradingView,并以`--remote-debugging-port=9222`参数重新打开。**提醒用户:如果有未保存的图表绘图,请先保存布局**。

Common setup issues

常见安装问题

SymptomFix
opencli: command not found
npm install -g @jackwener/opencli
(Node ≥ 22 for built-in WebSocket)
Unknown command: tradingview
opencli plugin install github:himself65/finance-skills/tradingview
Cannot reach CDP at http://127.0.0.1:9222
App not launched with debug port — run
opencli tradingview launch
No tradingview.com cookies found
App is open but logged out — log in inside the desktop app
No TradingView tab found
Open any chart or symbol page in TradingView, then retry
Empty chain / 0 contractsSubscription tier on the logged-in account doesn't include options for this symbol

症状解决方法
opencli: command not found
执行
npm install -g @jackwener/opencli
(Node ≥ 22支持内置WebSocket)
Unknown command: tradingview
执行
opencli plugin install github:himself65/finance-skills/tradingview
Cannot reach CDP at http://127.0.0.1:9222
应用未以调试端口启动——执行
opencli tradingview launch
No tradingview.com cookies found
应用已打开但未登录——在桌面应用中登录账号
No TradingView tab found
在TradingView中打开任意图表或代码页面,然后重试
期权链为空 / 0合约当前登录账户的订阅 tier 不包含该代码的期权数据

Step 2: Identify What the User Needs

步骤2:明确用户需求

Setup / chart inspection

配置 / 图表检查

User RequestCommandKey Flags
Setup / connection check
opencli tradingview status
Relaunch app with CDP
opencli tradingview launch
--port 9222
What's on the chart
opencli tradingview chart-state
--tab <id>
Screenshot a chart
opencli tradingview screenshot --output ~/charts/nvda.png
--tab <id>
用户请求命令关键参数
配置 / 连接检查
opencli tradingview status
通过CDP重启应用
opencli tradingview launch
--port 9222
查看当前图表内容
opencli tradingview chart-state
--tab <id>
图表截图
opencli tradingview screenshot --output ~/charts/nvda.png
--tab <id>

Quotes + options

报价 + 期权

User RequestCommandKey Flags
Spot quote
opencli tradingview quote --ticker X
--exchange NASDAQ
Options chain (full)
opencli tradingview options-chain --ticker X
--exchange
Options chain (one expiry, ATM band)
opencli tradingview options-chain --ticker X --expiry YYYY-MM-DD
--type call|put
,
--strikes-around-spot N
List expiries
opencli tradingview options-expiries --ticker X
用户请求命令关键参数
现货报价
opencli tradingview quote --ticker X
--exchange NASDAQ
完整期权链
opencli tradingview options-chain --ticker X
--exchange
单到期日期权链(平值区间)
opencli tradingview options-chain --ticker X --expiry YYYY-MM-DD
--type call|put
,
--strikes-around-spot N
列出到期日
opencli tradingview options-expiries --ticker X

Screener

筛选器

User RequestCommandKey Flags
Generic screener (stocks/crypto/forex/futures/bonds)
opencli tradingview screener --market america --columns ...
--filter <json>
,
--sort field:desc
,
--limit N
,
--label-product
US stocks with RSI < 30, sorted by volume
opencli tradingview screener --market america --columns "name,close,RSI|60,volume" --filter '[{"left":"RSI|60","operation":"less","right":30}]' --sort volume:desc
Top crypto by market cap
opencli tradingview screener --market coin --columns "name,close,change,market_cap_calc" --sort market_cap_calc:desc --limit 50
Symbol search / autocomplete
opencli tradingview search --query "nvidia"
--type stock|funds|crypto|...
,
--exchange
,
--country
用户请求命令关键参数
通用筛选器(股票/加密货币/外汇/期货/债券)
opencli tradingview screener --market america --columns ...
--filter <json>
,
--sort field:desc
,
--limit N
,
--label-product
RSI < 30的美股,按成交量排序
opencli tradingview screener --market america --columns "name,close,RSI|60,volume" --filter '[{"left":"RSI|60","operation":"less","right":30}]' --sort volume:desc
按市值排序的顶级加密货币
opencli tradingview screener --market coin --columns "name,close,change,market_cap_calc" --sort market_cap_calc:desc --limit 50
代码搜索 / 自动补全
opencli tradingview search --query "nvidia"
--type stock|funds|crypto|...
,
--exchange
,
--country

News

新闻

User RequestCommandKey Flags
Global news headlines
opencli tradingview news --limit 25
--category
,
--area
,
--section
,
--provider
News for a specific ticker
opencli tradingview news --symbol NASDAQ:AAPL
--limit
,
--section analysis|press_release|...
Full story by id
opencli tradingview news --id <story-id>
--lang en
用户请求命令关键参数
全球新闻头条
opencli tradingview news --limit 25
--category
,
--area
,
--section
,
--provider
特定代码的新闻
opencli tradingview news --symbol NASDAQ:AAPL
--limit
,
--section analysis|press_release|...
通过ID查看完整新闻
opencli tradingview news --id <story-id>
--lang en

Watchlists + alerts

观察列表 + 警报

User RequestCommandKey Flags
List all watchlists
opencli tradingview watchlists
Symbols in one watchlist
opencli tradingview watchlists --id <wl-id>
Colored-flag list (red/orange/yellow/green/blue/purple)
opencli tradingview watchlists --color red
List all alerts
opencli tradingview alerts --type list
Active alerts
opencli tradingview alerts --type active
Recently triggered alerts
opencli tradingview alerts --type triggered
Alerts that fired while offline
opencli tradingview alerts --type offline
Full alert log
opencli tradingview alerts --type log

用户请求命令关键参数
列出所有观察列表
opencli tradingview watchlists
单个观察列表中的代码
opencli tradingview watchlists --id <wl-id>
彩色标记列表(红/橙/黄/绿/蓝/紫)
opencli tradingview watchlists --color red
列出所有警报
opencli tradingview alerts --type list
活跃警报
opencli tradingview alerts --type active
最近触发的警报
opencli tradingview alerts --type triggered
离线时触发的警报
opencli tradingview alerts --type offline
完整警报日志
opencli tradingview alerts --type log

Step 3: Execute the Command

步骤3:执行命令

General pattern

通用格式

bash
undefined
bash
undefined

Use -f json or -f yaml for structured output

使用-f json或-f yaml获取结构化输出

opencli tradingview options-chain --ticker SNDK --expiry 2026-05-22 -f json opencli tradingview options-chain --ticker NVDA --strikes-around-spot 8 -f csv opencli tradingview quote --ticker SPY --exchange NYSEARCA -f json
undefined
opencli tradingview options-chain --ticker SNDK --expiry 2026-05-22 -f json opencli tradingview options-chain --ticker NVDA --strikes-around-spot 8 -f csv opencli tradingview quote --ticker SPY --exchange NYSEARCA -f json
undefined

Key rules

关键规则

  1. Run
    opencli tradingview status
    first
    if connectivity is uncertain — it reports CDP connection state and active TradingView tabs.
  2. Use
    -f json
    for programmatic processing (LLM context, downstream skills).
  3. Filter by expiry and
    --strikes-around-spot
    — full chains can be 3,000+ rows; an unfiltered dump is rarely what the user wants.
  4. Default
    --exchange NASDAQ
    for US equities; require explicit
    --exchange
    for ETFs (e.g. SPY = NYSEARCA, QQQ = NASDAQ) or non-US listings.
  5. For
    screener
    ,
    --columns
    is critical
    — it controls both the request and the output table. Include
    name
    and any field used in
    --filter
    or
    --sort
    . Append
    |TF
    for an indicator's timeframe, e.g.
    RSI|60
    for 1-hour RSI. The default columns are sensible for stocks but should be replaced for crypto / forex / futures (different field catalogs).
  6. For
    screener
    ,
    --filter
    is JSON
    — array of
    {left, operation, right}
    clauses. Always single-quote the JSON in shell to avoid escaping issues. See
    references/commands.md
    for the operations cheat sheet.
  7. For
    news
    , narrow the feed early
    — the global feed is firehose-level. Use
    --symbol
    ,
    --category
    ,
    --section
    , or
    --provider
    before raising
    --limit
    .
  8. For
    search
    , prefer it over guessing
    — when the user gives an ambiguous ticker (e.g. "SPY" without exchange), run
    search --query SPY
    first to confirm the listing, then pass
    --exchange
    to subsequent commands.
  9. For
    watchlists
    and
    alerts
    , default to summary
    — a user asking "what's in my watchlists?" wants list names + counts, not every symbol.
  10. NEVER call any write operation. This skill is read-only — no trades, no watchlist edits, no alert creation/deletion, no chart writes. The plugin intentionally does not expose write endpoints (
    /append
    ,
    /replace
    ,
    /create_alert
    , etc.).
  1. 如果连接不确定,先运行
    opencli tradingview status
    ——它会报告CDP连接状态和活跃的TradingView标签页。
  2. 使用
    -f json
    ——适合程序化处理(LLM上下文、下游技能)。
  3. 按到期日和
    --strikes-around-spot
    筛选
    ——完整期权链可能有3000+行;未过滤的输出很少是用户需要的。
  4. 美国股票默认
    --exchange NASDAQ
    ——ETF(如SPY=NYSEARCA、QQQ=NASDAQ)或非美国上市代码需显式指定
    --exchange
  5. 对于
    screener
    --columns
    至关重要
    ——它控制请求和输出表格。需包含
    name
    以及
    --filter
    --sort
    中使用的所有字段。为指标添加
    |TF
    指定时间框架,例如
    RSI|60
    表示1小时RSI。默认列适用于股票,但针对加密货币/外汇/期货需替换(字段目录不同)。
  6. 对于
    screener
    --filter
    为JSON格式
    ——是
    {left, operation, right}
    子句的数组。在shell中务必用单引号包裹JSON以避免转义问题。查看
    references/commands.md
    获取操作速查表。
  7. 对于
    news
    ,尽早缩小范围
    ——全球新闻流信息量极大。在提高
    --limit
    之前,先使用
    --symbol
    --category
    --section
    --provider
    筛选。
  8. 对于
    search
    ,优先使用搜索而非猜测
    ——当用户给出模糊代码(如未指定交易所的"SPY"),先运行
    search --query SPY
    确认上市信息,再在后续命令中传递
    --exchange
  9. 对于
    watchlists
    alerts
    ,默认返回摘要
    ——用户询问“我的观察列表里有什么?”时,需要的是列表名称+数量,而非所有代码。
  10. 切勿调用任何写入操作——本技能为只读模式,不支持交易、编辑观察列表、创建/删除警报、修改图表。插件故意未暴露写入端点(
    /append
    /replace
    /create_alert
    等)。

Output format flag (
-f
)

输出格式参数(
-f
)

FormatFlagBest for
Table
-f table
(default)
Human-readable terminal output
JSON
-f json
Programmatic processing, LLM context
YAML
-f yaml
Structured output, readable
Markdown
-f md
Documentation, reports
CSV
-f csv
Spreadsheet export
格式参数最佳用途
表格
-f table
(默认)
人类可读的终端输出
JSON
-f json
程序化处理、LLM上下文
YAML
-f yaml
结构化输出、可读性强
Markdown
-f md
文档、报告
CSV
-f csv
导出到电子表格

Output columns

输出列

  • quote
    symbol
    ,
    close
    ,
    change
    ,
    change_abs
    ,
    currency
    ,
    time
  • options-chain
    expiry
    ,
    dte
    ,
    strike
    ,
    type
    ,
    bid
    ,
    ask
    ,
    mid
    ,
    iv
    ,
    delta
    ,
    gamma
    ,
    theta
    ,
    vega
    ,
    rho
    ,
    theo
    ,
    bid_iv
    ,
    ask_iv
    ,
    symbol
  • options-expiries
    expiry
    ,
    dte
    ,
    contracts_count
  • screener
    — dynamic; one column per
    --columns
    entry, plus
    symbol
    . (Default:
    name
    ,
    close
    ,
    change
    ,
    volume
    ,
    market_cap_basic
    ,
    sector.tr
    .)
  • search
    symbol
    ,
    description
    ,
    type
    ,
    exchange
    ,
    country
    ,
    currency
  • news
    (list mode) —
    id
    ,
    published
    ,
    provider
    ,
    title
    ,
    urgency
    ,
    related_symbols
    ,
    link
  • news
    (story mode,
    --id
    set) —
    id
    ,
    published
    ,
    provider
    ,
    title
    ,
    body
    ,
    tags
    ,
    link
  • watchlists
    id
    ,
    name
    ,
    symbol_count
    ,
    symbols
  • alerts
    id
    ,
    name
    ,
    symbol
    ,
    type
    ,
    condition
    ,
    value
    ,
    active
    ,
    status
    ,
    fired_at
  • chart-state
    layout_id
    ,
    symbol
    ,
    interval
    ,
    url
  • screenshot
    path
    ,
    bytes

  • quote
    symbol
    ,
    close
    ,
    change
    ,
    change_abs
    ,
    currency
    ,
    time
  • options-chain
    expiry
    ,
    dte
    ,
    strike
    ,
    type
    ,
    bid
    ,
    ask
    ,
    mid
    ,
    iv
    ,
    delta
    ,
    gamma
    ,
    theta
    ,
    vega
    ,
    rho
    ,
    theo
    ,
    bid_iv
    ,
    ask_iv
    ,
    symbol
  • options-expiries
    expiry
    ,
    dte
    ,
    contracts_count
  • screener
    — 动态列;每个
    --columns
    对应一列,外加
    symbol
    。(默认:
    name
    ,
    close
    ,
    change
    ,
    volume
    ,
    market_cap_basic
    ,
    sector.tr
    。)
  • search
    symbol
    ,
    description
    ,
    type
    ,
    exchange
    ,
    country
    ,
    currency
  • news
    (列表模式) —
    id
    ,
    published
    ,
    provider
    ,
    title
    ,
    urgency
    ,
    related_symbols
    ,
    link
  • news
    (文章模式,指定
    --id
    ) —
    id
    ,
    published
    ,
    provider
    ,
    title
    ,
    body
    ,
    tags
    ,
    link
  • watchlists
    id
    ,
    name
    ,
    symbol_count
    ,
    symbols
  • alerts
    id
    ,
    name
    ,
    symbol
    ,
    type
    ,
    condition
    ,
    value
    ,
    active
    ,
    status
    ,
    fired_at
  • chart-state
    layout_id
    ,
    symbol
    ,
    interval
    ,
    url
  • screenshot
    path
    ,
    bytes

Step 4: Present the Results

步骤4:展示结果

  1. Lead with the structure summary — for an options chain, state spot price, expiry being shown, ATM strike, and IV regime first; then the table. For a screener, lead with the count of matches and the filters applied.
  2. Filter aggressively before showing — never paste a 3,000-row chain or a 500-row screener. Default to ATM ± 6 strikes per expiry for chains; for screeners cap to top 20 unless the user asks for more.
  3. Highlight skew — when showing both calls and puts, note IV skew direction if material.
  4. For chart-state, report layout id + symbol + interval + URL succinctly; offer to screenshot.
  5. For news (list mode), group by provider and lead with timestamps in the user's likely timezone (or always UTC ISO if uncertain). Include the link so the user can open the story. For story mode (
    --id
    set), the body is plain text — present it as-is, optionally trimmed.
  6. For watchlists, summarize counts before listing symbols (e.g. "3 watchlists: Earnings (24 syms), AI plays (12 syms), Hedges (8 syms)"). Don't dump 100-symbol watchlist contents unless asked.
  7. For alerts, group by status (active vs triggered/fired) and order recent firings by
    fired_at
    desc. Don't expose alert ids unless the user explicitly asks.
  8. For screener results, surface the top movers / extreme values in plain prose first (e.g. "highest market cap NVDA at $4.2T, 12 names below the RSI<30 threshold"), then the table.
  9. Treat sessions as private — never expose CDP target IDs, cookies, or layout IDs unless the user asks.
  10. Cross-reference with Funda when the user is making a trade decision — TradingView's options/screener data is convenient but can lag; for trade entry analysis, also fetch from the
    funda-data
    skill and reconcile.

  1. 先呈现结构摘要——对于期权链,先说明现货价格、显示的到期日、平值行权价和隐含波动率区间,再展示表格。对于筛选器,先说明匹配数量和应用的筛选条件。
  2. 展示前严格筛选——绝不粘贴3000行的期权链或500行的筛选结果。期权链默认显示每个到期日的平值±6行权价;筛选器默认显示前20条结果,除非用户要求更多。
  3. 突出隐含波动率偏斜——同时显示看涨和看跌期权时,若偏斜明显需标注方向。
  4. 对于chart-state——简洁报告布局ID+代码+时间周期+URL;主动提供截图服务。
  5. 对于news(列表模式)——按提供商分组,优先显示用户所在时区的时间戳(若不确定则统一使用UTC ISO格式)。包含链接方便用户打开文章。对于文章模式(指定
    --id
    ),正文为纯文本——直接呈现,可选择性截断。
  6. 对于watchlists——先汇总数量再列出代码(例如:"3个观察列表:财报股(24只)、AI概念股(12只)、对冲股(8只)")。除非用户要求,否则不要输出包含100只代码的观察列表内容。
  7. 对于alerts——按状态分组(活跃 vs 已触发/已执行),最近触发的警报按
    fired_at
    降序排列。除非用户明确要求,否则不要暴露警报ID。
  8. 对于筛选器结果——先用自然语言突出表现最极端的结果(例如:"最高市值为NVDA的4.2万亿美元,有12只股票RSI<30"),再展示表格。
  9. 会话数据视为隐私——绝不暴露CDP目标ID、Cookie或布局ID,除非用户要求。
  10. 当用户做交易决策时,交叉参考Funda数据——TradingView的期权/筛选器数据虽便捷但可能滞后;对于交易入场分析,还需调用
    funda-data
    技能获取数据并核对。

Step 5: Diagnostics

步骤5:诊断

bash
opencli tradingview status
Returns CDP connection state and active TradingView tabs. If CDP is down, run
opencli tradingview launch
to relaunch with the debug port.

bash
opencli tradingview status
返回CDP连接状态和活跃的TradingView标签页。如果CDP连接中断,执行
opencli tradingview launch
以调试端口重启应用。

Error Reference

错误参考

ErrorCauseFix
Unknown command: tradingview
Plugin not installed
opencli plugin install github:himself65/finance-skills/tradingview
Cannot reach CDP at http://127.0.0.1:9222
App launched without debug port
opencli tradingview launch
No tradingview.com cookies found
Logged out of TradingViewLog in inside the desktop app
No TradingView tab found
App open but no TradingView page loadedOpen any chart or symbol page, then retry
scanner 400 / Empty chain / totalCount=0
Subscription tier doesn't cover this symbol's optionsCheck account tier in the desktop app
Symbol not found
Wrong exchangePass
--exchange
explicitly, or run
opencli tradingview search --query <name>
first
Rate limitedToo many requestsWait a few seconds, then retry

错误原因解决方法
Unknown command: tradingview
未安装插件执行
opencli plugin install github:himself65/finance-skills/tradingview
Cannot reach CDP at http://127.0.0.1:9222
应用未以调试端口启动执行
opencli tradingview launch
No tradingview.com cookies found
未登录TradingView在桌面应用中登录账号
No TradingView tab found
应用已打开但未加载TradingView页面打开任意图表或代码页面,然后重试
scanner 400 / Empty chain / totalCount=0
订阅 tier 不包含该代码的期权数据在桌面应用中检查账户等级
Symbol not found
交易所错误显式传递
--exchange
,或先执行
opencli tradingview search --query <名称>
速率限制请求过于频繁等待几秒后重试

Reference Files

参考文件

  • references/commands.md
    — Every command with all flags, output examples, and analyst workflows
  • references/commands.md
    — 包含所有命令、参数、输出示例和分析师工作流