金融与交易
用 OKX CLI 查询加密货币新闻与情绪分析(需 API…
当用户询问加密新闻、市场动态、币种情绪、社交热度或趋势排名时,用 okx news 系列命令获取新闻与情绪数据。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 38/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 60/100 ×0.15
适用场景
用 OKX CLI 查询加密货币新闻与情特定
解决思路
- 安装 CLI:npm install -g @okx_ai/okx-trade-cli,并在 ~/.okx/config.toml 配置凭证,用 okx news latest --limit 3 验证。
- 所有命令默认静默使用 --profile live;仅在报错时提及。若遇 'not available in demo' 错误,告知用户新闻模块不支持 demo 模式,引导其使用 --profile live 或通过 okx config add-profile AK=<key> SK=<secret> PP=<passphrase> name=live 创建 live 配置。
- 最新/重要新闻:okx news latest;重大突发新闻用 okx news important;指定时间范围用 --begin/--end(Unix 毫秒)。
- 按币种查新闻:okx news by-coin --coins BTC(多个用逗号分隔,如 ETH,SOL)。
- 关键词搜索:okx news search --keyword "SEC ETF",可加 --coins、--sentiment、--sort-by latest|relevant 等过滤。
- 按情绪浏览新闻:okx news by-sentiment --sentiment bullish|bearish|neutral。
- 获取全文:okx news detail <id>(id 来自之前结果)。
- 币种情绪快照:okx news coin-sentiment --coins BTC,可加 --period 1h|4h|24h(默认 24h)。
- 情绪趋势:okx news coin-trend <coin>(位置参数,非 --coins),--period 1h|4h|24h,--points 显式指定(1h→24,4h→6,24h→7)。
- 情绪排名:okx news sentiment-rank,--sort-by hot|bullish|bearish,--limit 最大 50。
- 情绪异动检测(多币种):采用先广后深的方法,先扫描所有币种找异动,再用新闻关联深挖,遵循 references/workflows.md 中的多阶段工作流,不要只挑几个币分析。
- 按来源过滤:先用 okx news platforms 解析准确的 platform_id,再用 --platform <platform_id> 过滤,--limit 用 10–20,保持默认 --importance low。
- 来源过滤若返回少于约 5 条或 0 条,先将 --begin 放宽到 7 天,再放宽到 30 天,再下结论。
- --importance 默认 low(返回全部新闻);仅当用户明确要求重大/突发新闻时才传 --importance high。
- 币种符号规范化:API 只接受标准大写 ticker(如 BTC、ETH、SOL),需将全名、缩写、俚语解析为正确 ticker,歧义时先向用户确认。
- 空结果回退顺序:①若用了 --platform,先放宽 --begin 到 7 天再 30 天;②去掉 --importance high;③放宽 --begin/--end;④去掉 --coins 取通用新闻;⑤用 web search 补充(如 "<topic> news site:coindesk.com OR site:cointelegraph.com OR site:theblock.co");⑥透明告知用户哪些来自 OKX API、哪些来自 web search。
- 分页用 --after <cursor>,cursor 来自响应的 nextCursor。
- 语言根据用户消息推断:中文用 --lang zh-CN,英文用 --lang en-US(默认)。
- 所有命令支持 --json 输出原始 JSON。
- 历史搜索限制:okx news search 和 by-coin 主要索引近期文章,--begin/--end 超过约 7 天前可能返回空;历史分析优先用 okx news coin-trend(保留更长时间序列)。
适用边界 · 注意事项
- 不用于查询市场价格/K线(用 okx-cex-market)、下单(用 okx-cex-trade)或账户信息(用 okx-cex-portfolio)。
- 新闻模块不支持 demo 模式,demo 凭证下不可用。
- 需要 API 凭证(OAuth2.1),无凭证时无法使用。