返回顶部
p

paper-trading

Run a structured paper-trading loop with SQLite-backed event logging, position tracking, and PnL review. Use when opening/closing simulated trades, journaling thesis notes, checking portfolio status, or generating weekly performance summaries.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.1
安全检测
已通过
442
下载量
1
收藏
概述
安装方式
版本历史

paper-trading

# 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: ```bash ~/.openclaw/paper-trading.db ``` Override with `--db <path>`. ## Commands Use the script: ```bash 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 ```bash 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) ```bash node --experimental-strip-types {baseDir}/scripts/paper_trading.ts snapshot \ --symbol BTC \ --mint 6p6xgHyF7AeE6TZk8x9mNQd2r2hH7r4mYJ8t6x6hYfSR \ --price 62000 \ --source dexscreener ``` ### 3) Open position ```bash 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 ```bash 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 ```bash 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 ```bash 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 ```bash 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 ```bash 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: ```bash node --test {baseDir}/tests/paper_trading.test.mjs ```

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 paper-trader-1776292845 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 paper-trader-1776292845 技能

通过命令行安装

skillhub install paper-trader-1776292845

下载 Zip 包

⬇ 下载 paper-trading v1.0.1

文件大小: 10.31 KB | 发布时间: 2026-4-16 17:49

v1.0.1 最新 2026-4-16 17:49
- Tightened requirements: `mint` is now REQUIRED for `snapshot` and `open` commands.
- Updated instructions for DEX tokens: use wrapped token addresses (e.g., WETH, WBTC).
- Specified that `--source dexscreener` should be used for snapshots.
- Clarified workflow step to always provide `--mint` and `--source dexscreener` when logging snapshots.
- Improved documentation for asset identity, especially for DEX trading.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部