返回 Skill 市集

Trading Automation

paper-trading

Paper Trading is an SQLite-backed paper trading utility that logs immutable events, tracks positions, and computes realized and unrealized P&L. It offers CLI commands to initialize accounts, record market snapshots, open/close positions, and update stop/take levels, with asset identity controlled by

45 天前更新1 分鐘內設定完

總覽

Paper Trading is an SQLite-backed paper trading utility that logs immutable events, tracks positions, and computes realized and unrealized P&L.

Paper Trading is an SQLite-backed paper trading utility that logs immutable events, tracks positions, and computes realized and unrealized P&L. It offers CLI commands to initialize accounts, record market snapshots, open/close positions, and update stop/take levels, with asset identity controlled by symbol and mint (mint required for snapshots/opens and recommended for disambiguating same-symbol positions). Use it to simulate ideas before risking capital, maintain a thesis journal, monitor entries/exits/stops/takes, and generate periodic performance reviews. Key features include a default (and overrideable) DB path (~/.openclaw/paper-trading.db), wrapped-token support for DEX assets, per-position fees and risk parameters, immutable event history for auditing, and a lightweight Node.js script with no external SQLite dependencies for easy integration into workflows.

Skill.md

這個 Skill 如何運作

Paper Trading is an SQLite-backed paper trading utility that logs immutable events, tracks positions, and computes realized and unrealized P&L. It offers CLI commands to initialize accounts, record market snapshots, open/close positions, and update stop/take levels, with asset identity controlled by

SKILL.mdALPHIO / 已驗證

Paper Trading

SQLite-backed paper trading with immutable event logs.

Asset identity:

  • symbol is required for trade/snapshot commands.
  • mint is REQUIRED for snapshot and open (--mint <address>).
  • If multiple positions share the same symbol, pass --mint for close/set-levels so you target the right one.
  • For ETH/BTC on DEXs, use wrapped token contract addresses (WETH, WBTC/cbBTC) as the mint.

When to Use

Use this skill when the user wants to:

  • paper trade ideas before live capital
  • track entries/exits/stops/takes over time
  • compute realized and unrealized PnL
  • keep a thesis journal and periodic review

Database

Default DB path:

~/.openclaw/paper-trading.db

Override with --db <path>.

Commands

Use the script:

node --experimental-strip-types {baseDir}/scripts/paper_trading.ts --help

Environment notes:

  • No npm dependency is required for SQLite (uses node:sqlite).
  • Node may print ExperimentalWarning for SQLite in current versions; this is expected.

1) Initialize account

node --experimental-strip-types {baseDir}/scripts/paper_trading.ts init \
  --account main \
  --name "Main Paper Account" \
  --base-currency USD \
  --starting-balance 10000

2) Log market snapshot (for unrealized PnL)

node --experimental-strip-types {baseDir}/scripts/paper_trading.ts snapshot \
  --symbol BTC \
  --mint 6p6xgHyF7AeE6TZk8x9mNQd2r2hH7r4mYJ8t6x6hYfSR \
  --price 62000 \
  --source dexscreener

3) Open position

node --experimental-strip-types {baseDir}/scripts/paper_trading.ts open \
  --account main \
  --symbol BTC \
  --mint 6p6xgHyF7AeE6TZk8x9mNQd2r2hH7r4mYJ8t6x6hYfSR \
  --side LONG \
  --qty 0.1 \
  --price 62000 \
  --fee 4 \
  --stop-price 60500 \
  --take-price 65000 \
  --max-risk-pct 1.5 \
  --note "Breakout + volume confirmation"

4) Update stop/take

node --experimental-strip-types {baseDir}/scripts/paper_trading.ts set-levels \
  --account main \
  --symbol BTC \
  --mint 6p6xgHyF7AeE6TZk8x9mNQd2r2hH7r4mYJ8t6x6hYfSR \
  --side LONG \
  --stop-price 61200 \
  --take-price 66000 \
  --note "Move stop to reduce downside"

5) Close position

node --experimental-strip-types {baseDir}/scripts/paper_trading.ts close \
  --account main \
  --symbol BTC \
  --mint 6p6xgHyF7AeE6TZk8x9mNQd2r2hH7r4mYJ8t6x6hYfSR \
  --side LONG \
  --qty 0.05 \
  --price 63500 \
  --fee 3 \
  --note "Partial take profit"

6) Journal note

node --experimental-strip-types {baseDir}/scripts/paper_trading.ts note \
  --account main \
  --symbol BTC \
  --side LONG \
  --note "Invalidation if daily close < 61k" \
  --tags thesis risk macro

7) Portfolio status

node --experimental-strip-types {baseDir}/scripts/paper_trading.ts status --account main
node --experimental-strip-types {baseDir}/scripts/paper_trading.ts status --account main --format json --pretty

8) Weekly review

node --experimental-strip-types {baseDir}/scripts/paper_trading.ts review --account main
node --experimental-strip-types {baseDir}/scripts/paper_trading.ts review --account main --format json --pretty

Workflow

  1. Keep snapshots updated for symbols with open positions, always with --mint and --source dexscreener.
  2. Open trades only with explicit stop and risk cap (--max-risk-pct).
  3. Log every change as an event, do not edit old events.
  4. Run status after each trade and review at week end.

Notes

  • Events are append-only in SQLite (events table).
  • PnL is recomputed by replaying events.
  • status uses the latest snapshot per symbol + mint pair for unrealized PnL.

Validation

Run the full paper-trading test suite:

node --test {baseDir}/tests/paper_trading.test.mjs

最適合用於

何時使用

Paper Trading is an SQLite-backed paper trading utility that logs immutable events, tracks positions, and computes realized and unrealized P&L. It offers CLI commands to initialize accounts, record market snapshots, open/close positions, and update stop/take levels, with asset identity controlled by

01 · 會前準備

準備決策簡報

在投資委員會開會前,把零散證據整理成結構化的論據。

02 · 團隊協作

統一交接標準

讓分析師、投資組合經理與 Agent 產出一致的研究結果。

03 · 即時更新

更新投資邏輯

出現新催化劑、KPI 發布或財報結果後,更新情境假設。

社群回饋

越用越好用。

隨著 Skill 被使用與評審,回饋將顯示在這裡。

提交回饋

探索更多

相關 Skills

查看全部
免費開始