Xpersona
D

DolphinDB 量化金融技能

CLAWHUB · Unverified

基于 DolphinDB 提供因子计算、策略回测、行情处理、绩效归因及投资组合优化的量化金融专业解决方案。 Skill: DolphinDB 量化金融技能 Owner: ugpoor Summary: 基于 DolphinDB 提供因子计算、策略回测、行情处理、绩效归因及投资组合优化的量化金融专业解决方案。 Tags: backtest:1.1.0, dolphindb:1.4.0, factor:1.1.0, finance:1.4.0, latest:1.4.0, quant:1.4.0 Version history: v1.4.0 | 2026-04-02T07:58:33.398Z | user v1.4.0:添加强制环境检测流程,支持全局包装器调用 v1.1.3 | 2026-03-29T14:43:56.452Z | user 环境检测脚本路径修复,添加 dolphindb-basic 依赖提示 v1.1.2 | 2026-03-25T23:50:58.597Z | auto - 增加了 Python 环境检测和 Dol

62
Rank
84
Safety
1.0k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s177qqrp481qedfn5w9m5nmte183ge14:dolphindb-quant-finance
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-ugpoor-dolphindb-quant-finance/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

58,260 characters of source documentation, loaded on request.

Extracted files

3 files captured from the source.

SKILL.md

# DolphinDB 量化金融技能 v1.1.3

## 🚨 强制流程:使用前必须加载环境

**无论在何种场景下调用此技能(单独运行或被引用),必须先执行环境检测:**

```bash
# 方法 1: 在技能目录内运行(推荐)
cd ~/.jvs/.openclaw/workspace/skills/<skill-name>
source ../dolphindb-skills/scripts/dolphin_wrapper.sh

# 方法 2: 在任何位置运行(推荐)
source ~/.jvs/.openclaw/workspace/skills/dolphindb-skills/scripts/dolphin_global.sh

# 方法 3: 手动检测
python3 ~/.jvs/.openclaw/workspace/skills/dolphindb-skills/scripts/init_dolphindb_env.py
```

**验证环境:**
```bash
$DOLPHINDB_PYTHON_BIN -c "import dolphindb; print(dolphindb.__version__)"

# 或使用包装器命令
dolphin_python -c "import dolphindb; print(dolphindb.__version__)"
```

**重要**: 详见 [dolphindb-skills/USAGE_GUIDE.md](../dolphindb-skills/USAGE_GUIDE.md)

---

## ⚠️ 前置依赖

**本技能依赖 `dolphindb-basic` 技能,请先安装:**
```bash
clawhub install dolphindb-basic
```

**运行前初始化需确保 Python 环境有 DolphinDB SDK,详细方法可参见 dolphindb-skills 技能。**

```bash
# 加载环境检测器(相对路径,技能安装后自动可用)
source ../dolphindb-skills/scripts/load_dolphindb_env.sh

# 查看环境信息
dolphin_env_info

# 验证 SDK 已安装
dolphin_python -c "import dolphindb; print('SDK 版本:', dolphindb.__version__)"
```

**统一调用接口:**
```bash
dolphin_python script.py    # 运行 Python 脚本
dolphin_pip install pkg     # 安装包
```

**重要:所有 DolphinDB 脚本在 Python 中的调用方式**

```python
import dolphindb as ddb

# 1. 建立连接
s = ddb.session()
s.connect(host="localhost", port=8848, userid="admin", password="123456")

# 2. 执行 DolphinDB 脚本(所有数据库操作都通过 s.run())
result = s.run('''
    // DolphinDB 脚本
    use mytt
    select 
        sym,
        RSI(close, 24) as rsi,
        MA(close, 5) as ma5
    from loadTable("dfs://bars_db.bars_minute")
    context by sym
''')

# 3. 转换为 pandas DataFrame(可选)
df = result.toDF()

# 4. 关闭连接
s.close()
```

---

## 描述
提供基于 DolphinDB 的量化金融场景解决方案,包括因子计算、策略回测、行情处理、绩效归因等金融专业能力。

## 触发条件
当用户提到以下关键词时触发此技能:
- "量化因子"、"因子计算"、"多因子模型"
- "策略回测"、"backtest"、"回测引擎"
- "K 线合成"、"OHLC"、"行情数据"
- "Level-2 数据"、"逐笔数据"、"订单簿"
- "绩效归因"、"Brinson"、"Campisi"
- "投资组合"、"权重优化"、"MVO"
- "实时计算"、"流式因子"、"高频因子"
- "Alphalens"、"因子分析"、"IC 分析"

## 能力范围

### 1. 因子计算
- 日频/分钟频因子计算
- 高频因子实时计算
- Alpha101 因子库
- TA-Lib 技术指标
- 流批一体因子计算平台

### 2. 策略回测
- 股票中低频策略回测
- 期货回测
- 期权回测
- 多资产组合回测
- 模拟撮合引擎

### 3. 行情处理
- K 线合成(分钟/小时/日)
- Level-2 数据处理
- 订单簿合成
- 行情回放
- 复权计算

### 4. 绩效归因
- Brinson 绩效归因
- Campisi 绩效归因
- 因子归因分析
- 多因子风险模型

### 5. 投资组合优化
- 均值方差优化(MVO)
- 约束优化(SOCP)
- 权重分配
- 风险控制

### 6. 实时计算
- 实时高频因子
- 实时资金流计算
- 实时涨幅榜
- 实时波动率预测

## 使用示例

### 1. 因子计算最佳实践

```python
import dolphindb as ddb

s = ddb.session()
s.connect(host="localhost", port=8848, userid="admin", password="123456")

# 加载 MyTT 模块计算技术指标
s.run('use mytt')

# 计算均线、RSI、波动率
result = s.run('''
    // 计算均线
    def getMA(close, period=5){
        return MA(close, period)
    }
    
    // 计算 RSI
    def getRSI(close, N=24){
        return RSI(close, N)
    }
    
    // 计算波动率
    def getVolatility(close, period=10){
        returns = DIFF(close) / REF(close, 1)
        return STD(returns, period)
    }
    
    // 批量计算因子
    select 
        sym,
        getMA(close, 5) as ma5,
        getMA(close, 2

_meta.json

{
  "ownerId": "kn74281sb28x7qaec7ak7p23p183ga1m",
  "slug": "dolphindb-quant-finance",
  "version": "1.4.0",
  "publishedAt": 1775116713398
}

skill-card.md

## Description:

Provides DolphinDB-based quantitative finance guidance for factor calculation, strategy backtesting, market data processing, performance attribution, and portfolio optimization.

This skill is ready for commercial/non-commercial use.

## Publisher:

[ugpoor](https://clawhub.ai/user/ugpoor)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and quantitative finance practitioners use this skill to generate DolphinDB-oriented examples, commands, and configuration guidance for research, backtesting, market data workflows, attribution analysis, and portfolio optimization.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: The skill directs users to source external DolphinDB setup scripts from related skills before use.

Mitigation: Review or pin those setup scripts before installation and only run them from trusted skill versions.

Risk: Examples repeat default DolphinDB admin credentials.

Mitigation: Replace sample credentials with a least-privilege account and secrets-based configuration before adapting examples.

Risk: DolphinDB examples assume a local service on port 8848.

Mitigation: Do not expose DolphinDB port 8848 to untrusted networks and apply normal database access controls.

## Reference(s):

- [ClawHub skill page](https://clawhub.ai/ugpoor/skills/dolphindb-quant-finance)
- [Publisher profile](https://clawhub.ai/user/ugpoor)
- [DolphinDB official site](https://www.dolphindb.cn/)
- [DolphinDB documentation center](https://docs.dolphindb.cn/zh/)
- [DolphinDB quantitative finance examples](https://docs.dolphindb.cn/zh/tutorials/quant_finance_examples.html)
- [Factor calculation best practices](https://docs.dolphindb.cn/zh/tutorials/best_practice_for_factor_calculation.html)
- [DolphinDB stock backtest](https://docs.dolphindb.cn/zh/tutorials/stock_backtest.html)
- [Brinson attribution](https://docs.dolphindb.cn/zh/tutorials/brinson.html)
- [Campisi attribution](https://docs.dolphindb.cn/zh/tutorials/campisi.html)
- [MVO portfolio optimization](https://docs.dolphindb.cn/zh/tutorials/MVO.html)
- [OHLC calculation](https://docs.dolphindb.cn/zh/tutorials/OHLC_2.html)
- [Level-2 stock data processing](https://docs.dolphindb.cn/zh/tutorials/l2_stk_data_proc_2.html)
- [Real-time high-frequency factors](https://docs.dolphindb.cn/zh/tutorials/hf_factor_streaming_2.html)
- [DolphinDB backtest plugin](https://docs.dolphindb.cn/zh/plugins/backtest.html)

## Skill Output:

**Output Type(s):** [Guidance, Markdown, Code, Shell commands, Configuration instructions]

**Output Format:** [Markdown with Python, DolphinDB script, and bash code blocks]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [May include environment setup checks, DolphinDB connection examples, quant workflow snippets, and performance optimization guidance.]

## Skill Version(s):

1.4.0 (source: server release evidence)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for the

Sponsored

Ads related to DolphinDB 量化金融技能 and adjacent AI workflows.