← Back to Skills Marketplace
miio-jinglin

China Stock Quant

by Miio-Jinglin · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
182
Downloads
0
Stars
3
Active Installs
1
Versions
Install in OpenClaw
/install china-stock-quant
Description
A-share quantitative analysis toolkit. Use when user wants to analyze Chinese stocks, backtest trading strategies, calculate technical indicators (MACD/KDJ/R...
README (SKILL.md)

A股量化分析

基于 akshare(免费无需token)的A股量化分析工具包。

快速开始

pip install akshare pandas numpy matplotlib

工作流

1. 获取数据

from scripts.fetch_data import *
# ETF日线
df = fetch_etf_daily("159915", "20250101", "20260301")
# 个股日线
df = fetch_stock_daily("000001", "20250101", "20260301")
# ETF分时(日内做T)
df = fetch_etf_intraday("159915")
# 实时行情
df = fetch_realtime("159915")

详见 references/api-reference.md

2. 计算技术指标

from scripts.technical_indicators import *
# 单指标
df['macd'], df['signal'], df['hist'] = calc_macd(df['close'])
df['k'], df['d'], df['j'] = calc_kdj(df['high'], df['low'], df['close'])
df['rsi'] = calc_rsi(df['close'], period=14)
df['upper'], df['mid'], df['lower'] = calc_bollinger(df['close'])
df['vol_ratio'] = calc_volume_ratio(df['volume'])
# 一键全部
df = add_all_indicators(df)
# 信号检测
signals = detect_signals(df)

3. 策略回测

from scripts.backtest import *
result = run_backtest(
    df,
    strategy="grid",           # grid / ma_cross / bollinger
    initial_capital=100000,
    grid_num=10,               # 网格数(grid策略)
    ma_short=5, ma_long=20,    # 均线参数(ma_cross策略)
    stop_loss=0.05,            # 止损比例
    take_profit=0.10,          # 止盈比例
)
print(result.summary())

4. 风险评估

from scripts.backtest import assess_risk
risk = assess_risk(df['close'])
# returns: max_drawdown, sharpe_ratio, annual_volatility, calmar_ratio

策略库

ETF日内做T策略详解见 references/strategies.md,包含:

策略 适用场景 核心逻辑
网格交易 震荡市 价格跌破网格线买入,涨回卖出
均线交叉 趋势市 短均线上穿长均线买入,下穿卖出
布林带回归 均值回归 触下轨买入,触上轨卖出
波动率突破 突破行情 ATR放大+价格突破时追入

风控参数(内置默认值)

RISK_PARAMS = {
    "max_position_pct": 0.25,    # 单只持仓上限
    "stop_loss": 0.05,           # 止损线 5%
    "take_profit": 0.10,         # 止盈线 10%
    "max_daily_turnover": 0.05,  # 日内做T最大换手
    "min_trade_amount": 10000,   # 最低交易金额(元)
    "max_drawdown_limit": 0.15,  # 最大回撤警戒线
}

资源文件

  • scripts/fetch_data.py — 数据获取
  • scripts/technical_indicators.py — 技术指标计算
  • scripts/backtest.py — 回测引擎+风险评估
  • references/strategies.md — 策略库详解
  • references/api-reference.md — akshare接口速查
Usage Guidance
This package appears to do what it says: fetch Chinese market data (via akshare), compute indicators, and run backtests. Things to consider before installing: 1) akshare scrapes public data sources — it will make outbound network requests; if you must restrict network access, run in a sandbox. 2) pip installing packages runs third‑party code from PyPI — consider pinning versions (e.g., akshare==<version>) and review package histories. 3) No credentials are requested, so do not supply API keys or trading credentials to this skill. 4) Test on cached or small datasets before using real capital; backtest code is a simple simulator and may not cover execution slippage, fees, or real-world constraints. If you want extra assurance, run the provided scripts in an isolated environment and inspect akshare's behavior or pin its version.
Capability Analysis
Type: OpenClaw Skill Name: china-stock-quant Version: 1.0.0 The 'china-stock-quant' skill bundle is a legitimate quantitative analysis toolkit for the Chinese A-share and ETF markets. It utilizes the well-known 'akshare' library for data retrieval and provides standard implementations for technical indicators (MACD, KDJ, RSI) and backtesting strategies (Grid, MA Crossover) across files like scripts/fetch_data.py and scripts/backtest.py. No evidence of data exfiltration, malicious execution, or harmful prompt injection was found; the code and documentation are strictly aligned with the stated purpose of financial analysis.
Capability Assessment
Purpose & Capability
Name/description match the included Python scripts: fetch_data.py (akshare calls), technical_indicators.py (MACD/KDJ/RSI/Bollinger/etc.), and backtest.py (grid/MA/Bollinger backtests and risk metrics). Required libraries (akshare, pandas, numpy, matplotlib) are appropriate for the stated functionality.
Instruction Scope
SKILL.md instructs installing common Python packages and using the provided scripts; runtime instructions only reference stock/ETF data, indicator calculation, and backtests. There are no instructions to read unrelated local files, environment secrets, or to send data to external endpoints beyond the normal network calls used by akshare.
Install Mechanism
No install spec in the registry (instruction-only). SKILL.md suggests pip installing well-known packages (akshare/pandas/numpy/matplotlib). This is standard for a Python data-analysis toolkit; there are no downloads from unknown URLs or archive extraction steps in the skill metadata.
Credentials
The skill requests no environment variables or credentials. It uses akshare, which performs web requests/scraping to fetch market data — network access is required but is proportional to the skill's purpose. No secrets or unrelated credentials are requested.
Persistence & Privilege
The skill is not always-enabled and does not request elevated persistence. It does not modify other skills or system-wide settings. Agent autonomous invocation remains allowed (platform default) but is not combined with other concerning flags.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install china-stock-quant
  3. After installation, invoke the skill by name or use /china-stock-quant
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release
Metadata
Slug china-stock-quant
Version 1.0.0
License MIT-0
All-time Installs 3
Active Installs 3
Total Versions 1
Frequently Asked Questions

What is China Stock Quant?

A-share quantitative analysis toolkit. Use when user wants to analyze Chinese stocks, backtest trading strategies, calculate technical indicators (MACD/KDJ/R... It is an AI Agent Skill for Claude Code / OpenClaw, with 182 downloads so far.

How do I install China Stock Quant?

Run "/install china-stock-quant" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is China Stock Quant free?

Yes, China Stock Quant is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does China Stock Quant support?

China Stock Quant is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created China Stock Quant?

It is built and maintained by Miio-Jinglin (@miio-jinglin); the current version is v1.0.0.

💬 Comments