Skip to content

LingJingMaster/longbridge-comment-sentiment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

longbridge-comment-sentiment

长桥社区实时情绪分析 —— 单标的或多标的组合,基于 longbridge topic CLI。 Real-time community sentiment analysis for Longbridge — single-symbol or multi-symbol portfolio.

语言 / Language: 简体中文 · English


简体中文

一个 AI Skill(SKILL.md),把长桥社区的讨论信息流转成结构化的 看多 / 看空 / 中性 快照,附带经质量过滤的 Top 观点。

支持市场:港股 / 美股 / A 股(沪/深)/ 新加坡 / 加密货币

✨ 核心能力

  • 单标的情绪:看多 % / 看空 % / 中性 % + 一句话综述
  • 组合情绪:组合整体倾向 + 分标的明细 + 驱动标的识别
  • Top 3 观点:按「时效 × 互动」打分排序,自动去重
  • 互动感知过滤:利用 likes_count / comments_count / shares_count 下调低质量帖权重
  • 标准化 JSON 输出:方便下游工具对接

港股新股组合的示例输出:

HK 新股打新组合 组合社区情绪 · 实时
数据窗口: 04-20 09:27 ~ 04-24 01:10

组合整体:
看多 36% · 看空 19% · 中性 45%
(基于 74 条筛选后帖子)

组合综述:
情绪整体偏多但结构分化明显:1879 几乎一边倒打新狂热(0% 看空),
2493 靠 ADC 基本面 + AH 折价主导看多,6810 多空 1:1 对半分,是组合里唯一争议焦点。

分标的情绪:
- 1879.HK: 看多 27% · 看空 0% · 中性 73%
- 2493.HK: 看多 52% · 看空 19% · 中性 29%
- 6810.HK: 看多 32% · 看空 32% · 中性 35%
...

完整示例见 examples/

📦 安装

本 Skill 独立运行,不依赖官方 longbridge/developers Skill。 只需要安装并登录 longbridge CLI 即可。两者可共存,无冲突。

第 1 步 —— 安装并登录长桥 CLI

按平台选择:

macOS(Homebrew)

brew install --cask longbridge/tap/longbridge-terminal

macOS / Linux(curl)

curl -sSL https://open.longbridge.com/longbridge/longbridge-terminal/install | sh

Windows(Scoop)

scoop install https://open.longbridge.com/longbridge/longbridge-terminal/longbridge.json

Windows(PowerShell)

iwr https://open.longbridge.com/longbridge/longbridge-terminal/install.ps1 | iex

登录一次(token 会缓存至 ~/.longbridge/openapi/tokens/<client_id>,后续自动复用):

longbridge auth login

第 2 步 —— 安装 Python 3.8+

JSON 后处理用,python3 需在 PATH 中。

第 3 步 —— 安装本 Skill

方案 A —— 通过 skills CLI(推荐)

# Node.js
npx skills add LingJingMaster/longbridge-comment-sentiment -g -y
# Bun
bunx skills add LingJingMaster/longbridge-comment-sentiment -g -y

方案 B —— 手动安装

git clone https://github.com/LingJingMaster/longbridge-comment-sentiment.git \
  ~/.agents/skills/longbridge-comment-sentiment

也可以把目录直接放进你工具的 skills 目录(如 Claude Code:.claude/skills/)。

任何支持 SKILL.md 的 AI Agent(Warp/Oz、Claude、Cursor、Codex 等)都能自动识别。

验证

对 AI Agent 说:

看看 NVDA 的长桥社区情绪

如果 CLI 已安装并登录,应该能看到渲染好的看多 / 看空 / 中性快照。

🚀 使用

向 AI Agent 发起以下任一请求即可触发:

  • 「看看 NVDA 长桥社区情绪」
  • 「TSLA 最近社区是看多还是看空?」
  • 「分析 01879.HK / 02493.HK / 06810.HK 这三只新股的长桥社区情绪」
  • 「给我做一份港股新股打新组合的社区情绪摘要」

Agent 会:

  1. 标准化代码为 <CODE>.<MARKET> 格式(如 NVDANVDA.US
  2. 对每个标的执行 longbridge topic <SYMBOL> --count 30 --format json
  3. 过滤低质量 / 跨标的帖子
  4. 对保留下的每条帖子分类为看多 / 看空 / 中性
  5. 聚合并渲染最终 Markdown 报告

🔧 工作原理

用户请求
     │
     ▼
┌──────────────────────┐
│ AI Agent 读取         │
│ SKILL.md(本仓库)    │
└──────────────────────┘
     │
     ▼
┌────────────────────────────────────────┐
│ longbridge topic <SYMBOL> --format json│ ← 长桥 CLI
└────────────────────────────────────────┘
     │
     ▼
过滤低质量 ──► 情绪分类 ──► 聚合
     │
     ▼
单标的或多标的 Markdown 输出 + 标准化 JSON

完整工作流规范见 SKILL.md

📊 实测覆盖

实际测试数据:

代码 拉取帖数(size=50) 时间覆盖 备注
NVDA.US 50 约 4.5 小时 热门美股,发帖密集
1879.HK 50 约 31 小时 新股认购窗口期,活跃度高
2493.HK 39 约 3.5 天 相对冷门标的
6810.HK 48 约 64 小时 中等活跃度

CLI 单次 --count 上限为 50,无原生分页。若需更长历史,建议定时任务本地去重落库。

🧪 已知限制

  • 无时间范围过滤longbridge topic 只返回「最近 N 条」,无法指定日期范围。
  • 跨标的污染:有些帖子虽挂在某代码下,实际在讨论另一只股票(如挂在 1879.HK 但主要聊 6810.HK)。Skill 会在「跨标的过滤」规则下丢弃这类帖子,但不保证覆盖所有细微情况。
  • 情绪分类基于启发式规则,非专门微调模型。对中英文散户词汇效果不错,但对反讽、黑话、小众术语识别有限。
  • 社区样本 ≠ 市场共识:情绪只是讨论样本的瞬时快照,不等同于未来价格方向。

🤝 贡献

欢迎 Issue 和 PR,尤其是:

  • 非中英文语种的分类线索词典
  • 分类出错的边界案例
  • 评测集 / 测试用例

贡献请聚焦于 SKILL.md 规范本身;真正的执行由加载本 Skill 的 AI Agent 完成。

⚖️ 免责声明

本项目为社区自建,与长桥集团无从属关系

Skill 仅从长桥社区公开讨论中聚合样本,用于信息分析。输出不构成投资建议,情绪信号不保证未来价格方向。交易决策前请自行研判。

📄 许可

MIT —— 见 LICENSE


English

An AI Skill (SKILL.md) that turns the Longbridge community discussion feed into a structured bullish / bearish / neutral snapshot with quality-filtered top opinions.

Works for HK / US / CN (SH/SZ) / SG / Crypto markets.

✨ What you get

  • Per-symbol sentiment: bullish % / bearish % / neutral % + one-line summary
  • Portfolio sentiment: group-level tone + per-symbol breakdown + driving-symbol notes
  • Top 3 opinions: ranked by recency × interaction, de-duplicated
  • Interaction-aware filtering: uses likes_count, comments_count, shares_count to down-weight low-quality posts
  • Normalized JSON contract so the output is easy to plug into other tools

Sample output for a three-stock HK IPO portfolio:

HK IPO Portfolio · Community Sentiment · Real Time
Data window: 04-20 09:27 ~ 04-24 01:10

Portfolio:
Bullish 36% · Bearish 19% · Neutral 45%
(Based on 74 retained posts)

Summary:
Overall sentiment skews bullish but structurally split: 1879 is almost
unanimously bullish (0% bearish), 2493 is driven by ADC fundamentals +
AH discount, while 6810 is 1:1 split and the sole contested name.

Per symbol:
- 1879.HK: Bullish 27% · Bearish 0% · Neutral 73%
- 2493.HK: Bullish 52% · Bearish 19% · Neutral 29%
- 6810.HK: Bullish 32% · Bearish 32% · Neutral 35%
...

See examples/ for full sample outputs.

📦 Installation

This skill runs independently of the official longbridge/developers skill. It only needs the longbridge CLI binary to be installed and authenticated. You do not need to install the official skill first — though the two can coexist with no conflict.

Step 1 — Install and authenticate the Longbridge CLI

Pick the installer for your platform:

macOS (Homebrew)

brew install --cask longbridge/tap/longbridge-terminal

macOS / Linux (curl)

curl -sSL https://open.longbridge.com/longbridge/longbridge-terminal/install | sh

Windows (Scoop)

scoop install https://open.longbridge.com/longbridge/longbridge-terminal/longbridge.json

Windows (PowerShell)

iwr https://open.longbridge.com/longbridge/longbridge-terminal/install.ps1 | iex

Then authenticate once:

longbridge auth login

Token is cached at ~/.longbridge/openapi/tokens/<client_id> and reused on every call.

Step 2 — Install Python 3.8+

Used for JSON post-processing (python3 must be on PATH).

Step 3 — Install the skill

Option A — via skills CLI (recommended)

# Node.js
npx skills add LingJingMaster/longbridge-comment-sentiment -g -y
# Bun
bunx skills add LingJingMaster/longbridge-comment-sentiment -g -y

Option B — manual install

git clone https://github.com/LingJingMaster/longbridge-comment-sentiment.git \
  ~/.agents/skills/longbridge-comment-sentiment

Or drop the folder into your tool's skills directory (e.g. Claude Code: .claude/skills/).

Skill is discovered by any SKILL.md-aware AI agent (Warp/Oz, Claude, Cursor, Codex, etc.).

Verification

Ask your AI agent:

Check NVDA community sentiment

If the CLI is installed and authenticated, you should see a rendered bullish / bearish / neutral snapshot.

🚀 Usage

Trigger the skill by asking your AI agent any of:

  • "Check NVDA community sentiment"
  • "Is TSLA community sentiment bullish or bearish lately?"
  • "分析 01879.HK / 02493.HK / 06810.HK 这三只新股的长桥社区情绪"
  • "Create a community sentiment summary for my HK IPO list"

The agent will:

  1. Normalize symbols to <CODE>.<MARKET> format (e.g. NVDANVDA.US)
  2. Run longbridge topic <SYMBOL> --count 30 --format json for each
  3. Filter low-quality / off-symbol posts
  4. Classify each retained post as bullish / bearish / neutral
  5. Aggregate and render the final markdown report

🔧 How it works

User request
     │
     ▼
┌──────────────────────┐
│ AI Agent reads       │
│ SKILL.md (this repo) │
└──────────────────────┘
     │
     ▼
┌────────────────────────────────────────┐
│ longbridge topic <SYMBOL> --format json│ ← Longbridge CLI
└────────────────────────────────────────┘
     │
     ▼
Filter low-quality ──► Classify sentiment ──► Aggregate
     │
     ▼
Single-symbol or multi-symbol markdown output + normalized JSON

Full workflow specification lives in SKILL.md.

📊 Sample Coverage

From real-world testing:

Symbol Posts retrieved (size=50) Time coverage Notes
NVDA.US 50 ~4.5 hours Hot US stock, high-frequency posting
1879.HK 50 ~31 hours Active HK IPO during subscription window
2493.HK 39 ~3.5 days Less active symbol
6810.HK 48 ~64 hours Medium activity

The CLI hard-caps --count at 50 per call; no native pagination. For longer histories, schedule a cron job and persist de-duplicated output locally.

🧪 Limitations & known edge cases

  • No time-range filter: longbridge topic returns only "most recent N". No way to request a date range.
  • Cross-ticker pollution: Some posts tagged at one symbol genuinely reference another (e.g., a post tagged 1879.HK that mostly discusses 6810.HK). The skill drops these under the "off-symbol" filter rule but may miss subtle cases.
  • Sentiment classification is heuristic-based, not a dedicated fine-tuned model. It works well in practice for Chinese+English retail vocabulary but is imperfect on sarcasm, coded language, or niche jargon.
  • Community sample ≠ market view: Sentiment is only a discussion-sample snapshot and does not equal future price direction.

🤝 Contributing

Issues and PRs welcome — especially:

  • Additional classification cue dictionaries for non-Chinese/English languages
  • Edge-case examples where classification got it wrong
  • Eval harness / test cases

Keep contributions focused on the SKILL.md specification; the actual execution is done by the AI agent that loads the skill.

⚖️ Disclaimer

This project is community-built and not affiliated with Longbridge Group.

The skill surfaces public discussion data from the Longbridge community feed for informational analysis only. Output should not be interpreted as investment advice, and sentiment signals do not guarantee future price direction. Always do your own research before making any trading decision.

📄 License

MIT — see LICENSE.

About

Real-time Longbridge community sentiment analysis skill (HK/US/CN/SG/Crypto) — single-symbol or multi-symbol portfolio

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages