Install
openclaw skills install trading-journalRecord and manage futures/stock trades with standardized templates, calculate P&L, analyze performance, search entries, and export journals in Markdown or CSV.
openclaw skills install trading-journalRecord and analyze futures/stock trading journals. Supports structured trade logging, P&L tracking, performance analytics, and multi-format export.
Trade Entry → [Journal] → Log → [Analysis] → Stats / Reports
↑ ↓
Template Driven Export (MD/CSV)
Use the standardized template to record a trade:
Template fields:
| Field | Description | Example |
|---|---|---|
| date | Trade date | 2026-05-20 |
| symbol | Contract/stock code | IF2606, 000001 |
| direction | Long or Short | long / short |
| entry_price | Entry price | 3850.0 |
| exit_price | Exit price | 3900.0 |
| quantity | Number of contracts/shares | 2 |
| multiplier | Contract multiplier (futures) | 300 |
| entry_time | Entry timestamp | 09:35 |
| exit_time | Exit timestamp | 14:20 |
| fees | Commission + slip | 45.60 |
| strategy | Strategy tag | trend_follow |
| notes | Free-text notes | "突破前高入场" |
| tags | Custom tags | ["股指", "日内"] |
Full JSON template:
{
"date": "2026-05-20",
"symbol": "IF2606",
"direction": "long",
"entry_price": 3850.0,
"exit_price": 3900.0,
"quantity": 2,
"multiplier": 300,
"entry_time": "09:35",
"exit_time": "14:20",
"fees": 45.60,
"strategy": "trend_follow",
"notes": "突破前高入场,尾盘止盈",
"tags": ["股指", "日内", "趋势"]
}
To log a trade:
scripts/trade_logger.py scriptAuto-calculated based on template fields:
Futures P&L:
P&L = (exit_price - entry_price) × quantity × multiplier × direction_sign - fees
Stock P&L:
P&L = (exit_price - entry_price) × quantity - fees
Where direction_sign = 1 for long, -1 for short.
The system handles:
Run analytics on journal entries using scripts/trade_analyzer.py:
Metrics computed:
| Metric | Formula |
|---|---|
| Win Rate | wins / total_closed × 100% |
| Total P&L | Σ(closed_trade_P&L) |
| Avg Win | Σ(win_P&L) / wins |
| Avg Loss | Σ(loss_P&L) / losses |
| Profit Factor | Σ(gross_profit) / Σ(gross_loss) |
| Sharpe Ratio | avg_return / std_return × √252 |
| Max Drawdown | Max peak-to-trough decline |
| Best/Worst Trade | Max/min single trade P&L |
| Daily Average | Total P&L / trading_days |
Analysis frequency:
Journal files are organized by date:
journals/
├── 2026/
│ ├── 2026-05/
│ │ ├── 2026-05-18.json # Day trades
│ │ ├── 2026-05-19.json
│ │ └── 2026-05-20.json
│ └── 2026-06/
│ └── 2026-06-01.json
└── archive/
└── 2025-journal.jsonl
Search across journals by:
Export journals to preferred format:
| Format | Use Case | Command |
|---|---|---|
| Markdown | Human-readable report, docs | python journal_export.py --format md --output report.md |
| CSV | Spreadsheet analysis, import | python journal_export.py --format csv --output trades.csv |
| JSON | Data interchange, backup | python journal_export.py --format json --output trades.json |
When user says "记一笔交易" or provides trade details:
python scripts/trade_logger.py add <json_string>Example interaction:
User: 今天IF2606做多2手,3850进场,3900平仓
Agent: 📓 记录交易:
IF2606 | LONG | 3850 → 3900 | 2手
P&L: (3900-3850)×2×300 - 费用 = ¥29,954.40
确认记录?(是/否)
When user asks "看看收益" / "我的交易怎么样":
python scripts/trade_analyzer.py --range 2026-05-01 2026-05-20Example output:
📊 交易绩效报告 (2026-05-01 ~ 2026-05-20)
━━━━━━━━━━━━━━━━━━━━━━━━━━━
总交易数: 24
胜率: 70.83% (17/24) 🟢
总盈亏: +¥186,520.00 🟢
平均盈利: +¥16,250.00
平均亏损: -¥4,830.00
盈亏比: 3.36
最大回撤: -¥12,400.00
最佳交易: +¥45,000.00 (IF2606, 05-08)
最差交易: -¥8,200.00 (IC2609, 05-12)
When user asks to export:
scripts/trade_logger.pyCore trade logging — add, edit, delete, and list journal entries.
scripts/trade_analyzer.pyPerformance analysis — compute metrics, generate reports for any date range.
scripts/journal_export.pyMulti-format export — output journals to Markdown, CSV, or JSON.
journals/ directory within this skill folderexit_price: null and open: true