
Trading Quant
Pull live A-share, US, HK, and commodity quotes with multi-factor scores and capital-flow screens without wiring Bloomberg-style APIs yourself.
Overview
Trading-quant is an agent skill most often used in Idea (also Grow, Operate) that fetches multi-market quotes and 5-dimension stock scores via a unified Python CLI.
Install
npx skills add https://github.com/lanyasheng/trading-quant --skill trading-quantWhat is this skill?
- Unified CLI entry: python3.12 quant.py with 15+ tool subcommands (stock_analysis, market_scan, northbound_flow, global_o
- 5-dimension scoring: technical 25%, capital 30%, plus fundamental and flow dimensions via MACD/RSI/KDJ, volume ratio, an
- Multi-market coverage: A-shares intraday snapshot, US/HK symbols, commodities, gold analysis, and margin/LHB/main-flow t
- Market anomaly tooling: limit-up/down pools, top turnover, capital_flow per code, and maintenance commands warm_klines,
- Aggregated data sources: Tencent, Sina, East Money, and Tonghuashun-style feeds for resilient realtime quotes
- 5-dimension scoring system with documented weights (e.g. technical 25%, capital 30%)
- 15+ quant.py tool subcommands across A-share, global, and maintenance categories
Adoption & trust: 683 installs on skills.sh; 9 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
You need consistent A-share, US, HK, and commodity analytics in the agent session without manually juggling exchange sites and spreadsheets.
Who is it for?
Solo builders and indie traders automating research briefs, anomaly scans, and cross-market dashboards from the terminal inside an AI coding agent.
Skip if: Teams that need licensed execution, audited compliance workflows, or strategies that require sub-second co-located feeds rather than aggregated retail APIs.
When should I use this skill?
Query any stock realtime quote and score; analyze A-share limit-up/down anomalies; view northbound flows; US/HK/precious-metal quotes; global market overview; per-symbol capital flow analysis.
What do I get? / Deliverables
You get scored snapshots, flow screens, and market scans as CLI JSON/text the agent can compare, rank, and fold into watchlists or daily operating notes.
- Terminal market snapshots and scored symbol reports
- Anomaly and flow tables suitable for agent summaries
- Optional persisted daily klines via save_daily maintenance
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Canonical shelf is Idea because traders and indie builders typically install this to research symbols, anomalies, and flows before committing capital or product bets. Research subphase fits discovery workflows: stock scoring, limit-up pools, northbound flows, and global overview answer “what looks interesting right now?”
Where it fits
Run stock_analysis and market_scan to shortlist high-score names before writing a strategy note.
Cross-check margin_data and global_overview when sanity-checking a fintech or macro-dependent SaaS bet.
Track top_amount and capital_flow trends to feed weekly investor or newsletter metrics.
Schedule warm_klines, save_daily, and system_health while watching live positions or alert rules.
How it compares
Use instead of ad-hoc web scraping prompts when you want repeatable quant.py commands and a fixed scoring rubric per symbol.
Common Questions / FAQ
Who is trading-quant for?
It is for solo and indie builders who trade or model markets and want agent-driven quotes, scores, and flow data for China A-shares plus US, HK, and metals—without building scrapers from scratch.
When should I use trading-quant?
Use it during Idea research to screen stocks and read global overview; during Validate when pricing or macro context matters; during Grow or Operate when monitoring northbound flow, limit pools, intraday snapshots, or running save_daily and system_health maintenance.
Is trading-quant safe to install?
It runs local Python against external market data APIs and needs network access; review the Security Audits panel on this page and treat outputs as informational, not fiduciary advice.
SKILL.md
READMESKILL.md - Trading Quant
# 量化交易数据分析 通过腾讯/新浪/东财/同花顺多数据源获取实时行情,提供5维评分体系。 ## 工具列表 所有工具统一入口: ```bash python3.12 {baseDir}/scripts/quant.py <tool> [args...] ``` ### A股分析 ```bash python3.12 {baseDir}/scripts/quant.py stock_analysis [codes] python3.12 {baseDir}/scripts/quant.py intraday_snapshot ``` ### 全球市场 ```bash python3.12 {baseDir}/scripts/quant.py us_stock [symbols] python3.12 {baseDir}/scripts/quant.py hk_stock [codes] python3.12 {baseDir}/scripts/quant.py commodity [codes] python3.12 {baseDir}/scripts/quant.py global_overview ``` ### 市场数据 ```bash python3.12 {baseDir}/scripts/quant.py market_anomaly python3.12 {baseDir}/scripts/quant.py market_scan python3.12 {baseDir}/scripts/quant.py top_amount [N] python3.12 {baseDir}/scripts/quant.py capital_flow [codes] python3.12 {baseDir}/scripts/quant.py northbound_flow python3.12 {baseDir}/scripts/quant.py gold_analysis python3.12 {baseDir}/scripts/quant.py margin_data [code] python3.12 {baseDir}/scripts/quant.py lhb [date] python3.12 {baseDir}/scripts/quant.py main_flow [codes] ``` ### 维护 ```bash python3.12 {baseDir}/scripts/quant.py warm_klines python3.12 {baseDir}/scripts/quant.py save_daily python3.12 {baseDir}/scripts/quant.py system_health ``` ## 评分体系 | 维度 | 权重 | 指标 | |------|------|------| | 技术面 | 25% | MACD/RSI/KDJ/均线/布林 | | 资金面 | 30% | 量比/换手率/量价/主力资金 | | 基本面 | 10% | PE/PB/市值 | | 消息面 | 20% | LLM 根据新闻原文判断 | | 情绪面 | 15% | LLM 根据市场数据判断 | ### 信号等级 STRONG_BUY(>=80) > BUY(>=65) > WATCH(>=50) > HOLD(>=35) > SELL(>=20) > STRONG_SELL(<20) ## 数据源 | 市场 | 主源 | 降级链 | |------|------|--------| | A股 | 腾讯 | 新浪→东财→同花顺 | | 美股 | 腾讯 | yfinance | | 港股 | 腾讯 | - | | 商品 | 新浪期货 | - | ## 规则 1. 必须使用工具获取数据,禁止凭记忆回答行情 2. PE>100 或 PB<0.8 时必须标注风险 3. 涨停>30只时提示市场情绪亢奋 4. 北向净流出>50亿时提示外资撤离 __pycache__/ *.py[cod] .DS_Store *.log venv/ *.bak.* cache/ """Capital flow analysis — volume/turnover/bid-ask based scoring.""" from __future__ import annotations import logging from dataclasses import dataclass, field from data_sources.base import QuoteData logger = logging.getLogger(__name__) @dataclass class CapitalSignal: """Capital flow analysis result.""" score: float = 50.0 signals: list[str] = field(default_factory=list) metrics: dict = field(default_factory=dict) def compute_capital(quote: QuoteData, avg_volume: float = 0, avg_amount: float = 0, main_force_data: dict = None) -> CapitalSignal: """Compute capital flow score from real-time quote data. Uses volume ratio, turnover rate, bid-ask spread, and amount anomaly. avg_volume/avg_amount: 5-day average for comparison. Args: main_force_data: 主力资金数据 (来自主力接口) { "main_net_inflow_wan": -10653, # 主力净流入 (万) "super_big_net_wan": -15104, # 超大单 "big_net_wan": 4451, # 大单 "signal": "主力流出" } """ score = 50.0 signals = [] metrics = {} chg_pct = quote.change_pct if quote.change_pct is not None else 0.0 # Volume ratio (量比) vr = quote.volume_ratio if quote.volume_ratio is not None else 0 if vr > 0: metrics["volume_ratio"] = round(vr, 2) if vr > 5: score += 8 signals.append(f"量比{vr:.1f}极度放量+8") elif vr > 3: score += 5 signals.append(f"量比{vr:.1f}显著放量+5") elif vr > 1.5: score += 2 signals.append(f"量比{vr:.1f}温和放量+2") elif vr < 0.5: score -= 3 signals.append(f"量比{vr:.1f}缩量-3") # Turnover rate (换手率) tr = quote.turnover_rate if quote.turnover_rate is not None else 0 if tr > 0: metrics["turnover_rate"] = round(tr, 2) if tr > 15: score += 3 signals.append(f"换手率{tr:.1f}%高度活跃+3") elif tr > 8: score += 1