revx-strategy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseStrategy: Grid Bot (revx strategy grid
)
revx strategy grid策略:网格机器人(revx strategy grid
)
revx strategy gridBacktest, optimize, and run automated grid trading strategies.
Auth required. Make sureis installed and configured before running these commands. If any command fails with an auth-related error —revx,Auth not configured,No private key found,Authentication failed (401),Invalid signature, or a missing key/config file atinsecure permissions— invoke the~/.config/revolut-x/skill immediately and apply the fix yourself. Do not interrupt the user to ask them to run setup. Only escalate to the user for steps only they can perform (pasting the API key, registering the public key in their Revolut X profile, choosing a passphrase). After the fix, retry the original command.revx-auth
Symbols use format with a dash: , , .
BASE-QUOTEBTC-USDETH-EURSOL-USD回测、优化并运行自动化网格交易策略。
需要身份验证。执行这些命令前,请确保已安装并配置。如果任何命令因身份验证相关错误失败——revx、Auth not configured、No private key found、Authentication failed (401)、Invalid signature,或insecure permissions路径下缺少密钥/配置文件——立即调用~/.config/revolut-x/技能并自行修复问题。不要打断用户让他们自行完成设置。仅在需要用户执行专属步骤(粘贴API密钥、在Revolut X个人资料中注册公钥、选择密码短语)时才告知用户。修复完成后,重试原命令。revx-auth
交易对采用格式,用短横线分隔:、、。
BASE-QUOTEBTC-USDETH-EURSOL-USDBacktest
回测(Backtest)
Test a grid strategy on historical data:
bash
revx strategy grid backtest BTC-USD
revx strategy grid backtest BTC-USD --levels 10 --range 10 --investment 1000
revx strategy grid backtest ETH-USD --days 60 --interval 4h
revx strategy grid backtest BTC-USD --split
revx strategy grid backtest BTC-USD --json| Flag | Default | Description |
|---|---|---|
| 5 | Grid levels per side (2-25) |
| 10 | Grid range +/- % from mid price |
| 1000 | Capital in quote currency |
| 3 | Historical data period |
| 1m | Candle resolution |
| off | Split investment across buy and sell levels (market-buy base for levels above start price) |
Not long-running — completes and returns results. Run normally via the tool.
BashAlways confirm these key parameters before running: pair, investment, levels, range, and split mode. These affect capital and strategy behavior — never assume them silently. Other parameters (days, interval) can use defaults unless the user specifies otherwise.
在历史数据上测试网格策略:
bash
revx strategy grid backtest BTC-USD
revx strategy grid backtest BTC-USD --levels 10 --range 10 --investment 1000
revx strategy grid backtest ETH-USD --days 60 --interval 4h
revx strategy grid backtest BTC-USD --split
revx strategy grid backtest BTC-USD --json| 标识(Flag) | 默认值 | 说明 |
|---|---|---|
| 5 | 每侧的网格层数(2-25) |
| 10 | 网格范围:相对于中间价的±百分比 |
| 1000 | 投入资金(计价货币) |
| 3 | 历史数据周期 |
| 1m | K线分辨率 |
| 关闭 | 在买入和卖出层之间拆分资金(对高于起始价格的层级进行市价买入基础货币) |
非长期运行——执行完成后返回结果。通过工具正常运行。
Bash执行前务必确认以下关键参数:交易对、投入资金、网格层数、网格范围和拆分模式。这些参数会影响资金和策略表现——切勿默认使用参数值。其他参数(天数、分辨率)除非用户指定,否则可使用默认值。
Optimize
优化(Optimize)
Test multiple parameter combinations, ranked by return:
bash
revx strategy grid optimize BTC-USD
revx strategy grid optimize BTC-USD --investment 5000 --days 60
revx strategy grid optimize BTC-USD --levels 5,10,15,20 --ranges 3,5,10 --top 5
revx strategy grid optimize BTC-USD --split| Flag | Default | Description |
|---|---|---|
| 3,5,8,10,15 | Level counts to test |
| 3,5,7,10,12,15,20 | Range percentages to test |
| 10 | Top results to display |
| 1000 | Capital in quote currency |
| 3 | Historical data period |
| 1m | Candle resolution |
| off | Split investment across buy and sell levels (market-buy base for levels above start price) |
Max 200 parameter combinations. Not long-running — completes and returns results.
Always confirm these key parameters before running: pair, investment, and split mode. These affect capital and strategy behavior — never assume them silently. Other parameters (levels list, ranges list, days, interval, top) can use defaults unless the user specifies otherwise.
测试多种参数组合,按收益排序:
bash
revx strategy grid optimize BTC-USD
revx strategy grid optimize BTC-USD --investment 5000 --days 60
revx strategy grid optimize BTC-USD --levels 5,10,15,20 --ranges 3,5,10 --top 5
revx strategy grid optimize BTC-USD --split| 标识(Flag) | 默认值 | 说明 |
|---|---|---|
| 3,5,8,10,15 | 待测试的网格层数列表 |
| 3,5,7,10,12,15,20 | 待测试的网格范围百分比列表 |
| 10 | 显示的最优结果数量 |
| 1000 | 投入资金(计价货币) |
| 3 | 历史数据周期 |
| 1m | K线分辨率 |
| 关闭 | 在买入和卖出层之间拆分资金(对高于起始价格的层级进行市价买入基础货币) |
最多支持200种参数组合。非长期运行——执行完成后返回结果。
执行前务必确认以下关键参数:交易对、投入资金和拆分模式。这些参数会影响资金和策略表现——切勿默认使用参数值。其他参数(层数列表、范围列表、天数、分辨率、最优结果数量)除非用户指定,否则可使用默认值。
Run (Live Trading)
运行(实盘交易)
Human Confirmation Required
需要人工确认
NEVER execute (without ) without explicit user confirmation. This command places real orders with real money.
revx strategy grid run--dry-runBefore running a live grid bot, present a confirmation summary to the user:
Grid bot to launch:
- Pair: BTC-USD
- Investment: $500
- Levels: 10 per side
- Range: +/-5%
- Mode: LIVE (real orders)
This will place real buy and sell orders. Shall I proceed?
Only execute after the user explicitly approves. does not require confirmation (no real orders).
--dry-run未经用户明确确认,绝不要执行不带的命令。该命令会下达真实订单,动用真实资金。
--dry-runrevx strategy grid run启动实盘网格机器人前,向用户展示确认摘要:
即将启动的网格机器人:
- 交易对:BTC-USD
- 投入资金:500美元
- 网格层数:每侧10层
- 网格范围:±5%
- 模式:实盘(LIVE)(真实订单)
这将下达真实的买入和卖出订单。是否继续?
仅在用户明确批准后执行。无需确认(不会下达真实订单)。
--dry-runAlways Suggest Dry Run First
建议先进行模拟运行
When the user asks to run a live grid bot, always suggest starting with before going live — unless the user has already completed a dry run in the current session or explicitly says they want to skip it.
--dry-runExample response:
Before going live, I'd recommend a dry run first to verify the grid setup:bashrevx strategy grid run BTC-USD --investment 500 --levels 10 --range 5 --dry-runThis simulates the bot without placing real orders. Want to start with a dry run?
If the user confirms they want to skip the dry run, proceed to the live confirmation flow above.
当用户请求运行实盘网格机器人时,除非用户在当前会话中已完成模拟运行或明确表示要跳过,否则始终建议先执行。
--dry-run示例回复:
在启动实盘前,我建议先进行模拟运行以验证网格设置:bashrevx strategy grid run BTC-USD --investment 500 --levels 10 --range 5 --dry-run这会模拟机器人运行,但不会下达真实订单。要不要先进行模拟运行?
如果用户确认要跳过模拟运行,则进入上述实盘确认流程。
Missing Parameters — Always Ask, Never Guess
参数缺失——务必询问,切勿猜测
The flag is required by the CLI, but also confirm the user's intent for all key parameters:
--investment- Symbol — which pair?
- Investment — how much capital?
- Levels — how many grid levels per side? (default 5 if user says "use defaults")
- Range — what percentage range? (default 5% if user says "use defaults")
If the user says "run a grid bot on BTC", ask for the investment amount at minimum.
Run a live grid bot with real-time dashboard:
bash
revx strategy grid run BTC-USD --investment 500
revx strategy grid run BTC-USD --levels 10 --range 5 --investment 1000 --interval 15
revx strategy grid run BTC-USD --investment 500 --split
revx strategy grid run BTC-USD --investment 100 --dry-run
revx strategy grid run BTC-USD --investment 500 --reset| Flag | Default | Description |
|---|---|---|
| required | Capital in quote currency |
| 5 | Grid levels per side (2-25) |
| 5 | Grid range +/- % from mid |
| off | Split investment across buy and sell levels (market-buy base for levels above current price) |
| 10 | Polling interval in seconds |
| off | Simulate without real orders |
| off | Discard saved state, start fresh |
Ctrl+C for graceful shutdown (cancels open orders, prints summary).
Persistence: State auto-saved for crash recovery. Clean shutdown deletes state. Crashed sessions auto-reconcile on restart.
If Telegram connectors are configured (see skill), notifications are sent on startup, shutdown, fills, and P&L changes.
revx-telegramCLI要求必须提供标识,但同时也要确认用户对所有关键参数的意向:
--investment- 交易对——哪一个交易对?
- 投入资金——投入多少资金?
- 网格层数——每侧设置多少层网格?(如果用户说“使用默认值”,则默认5层)
- 网格范围——设置多少百分比范围?(如果用户说“使用默认值”,则默认5%)
如果用户说“在BTC上运行网格机器人”,至少要询问投入资金金额。
运行带实时仪表盘的实盘网格机器人:
bash
revx strategy grid run BTC-USD --investment 500
revx strategy grid run BTC-USD --levels 10 --range 5 --investment 1000 --interval 15
revx strategy grid run BTC-USD --investment 500 --split
revx strategy grid run BTC-USD --investment 100 --dry-run
revx strategy grid run BTC-USD --investment 500 --reset| 标识(Flag) | 默认值 | 说明 |
|---|---|---|
| 必填 | 投入资金(计价货币) |
| 5 | 每侧的网格层数(2-25) |
| 5 | 网格范围:相对于中间价的±百分比 |
| 关闭 | 在买入和卖出层之间拆分资金(对高于当前价格的层级进行市价买入基础货币) |
| 10 | 轮询间隔(秒) |
| 关闭 | 模拟运行,不下达真实订单 |
| 关闭 | 丢弃已保存的状态,重新开始 |
按下Ctrl+C可优雅关闭(取消未成交订单,打印摘要)。
持久性: 状态会自动保存以实现崩溃恢复。优雅关闭会删除状态。崩溃的会话在重启时会自动对账。
如果已配置Telegram连接器(参见技能),则会在启动、关闭、成交和盈亏变化时发送通知。
revx-telegramLong-Running Command — Behavioral Instructions for Claude
长期运行命令——Claude的行为说明
revx strategy grid run--dry-runHow to handle:
- Run the command using the tool with
Bash— this frees Claude immediately while the process runs asynchronouslyrun_in_background: true - Periodically read the background task output file with the tool to monitor status and report key events to the user (orders placed, fills, errors)
Read - If the user asks to stop, use the tool with the task ID
TaskStop - Also print the command to the user so they can optionally run it in a separate terminal for the full live dashboard experience (with colors, real-time tables, Ctrl+C to stop)
Example — starting a grid bot:
Bash tool call:
json
{ "command": "revx strategy grid run BTC-USD --investment 500 --levels 10 --range 5", "run_in_background": true }Response to user:
Started grid bot for BTC-USD in the background. I'll check for updates periodically.If you'd like to see the live dashboard, run this in a separate terminal:bashrevx strategy grid run BTC-USD --investment 500 --levels 10 --range 5Press Ctrl+C to stop (gracefully cancels open orders).
revx strategy grid run--dry-run处理方式:
- 使用工具并设置
Bash来执行命令——这会立即释放Claude,同时进程在后台异步运行run_in_background: true - 定期使用工具读取后台任务输出文件,监控状态并向用户报告关键事件(订单下达、成交、错误)
Read - 如果用户要求停止,使用工具并传入任务ID
TaskStop - 同时向用户打印命令,以便他们可以选择在单独终端中运行以获得完整的实时仪表盘体验(带颜色、实时表格,按下Ctrl+C停止)
示例——启动网格机器人:
Bash工具调用:
json
{ "command": "revx strategy grid run BTC-USD --investment 500 --levels 10 --range 5", "run_in_background": true }给用户的回复:
已在后台启动BTC-USD的网格机器人。我会定期检查更新。如果你想查看实时仪表盘,请在单独终端中运行以下命令:bashrevx strategy grid run BTC-USD --investment 500 --levels 10 --range 5按下Ctrl+C可停止(会优雅取消未成交订单)。
When to Suggest Split
何时建议使用拆分模式
When the user sets up a grid strategy (backtest, optimize, or run), ask whether they want split mode if they haven't specified . Present it as a simple choice with context:
--splitWould you like to use split mode ()?--split
- Without split — all capital goes to buy orders below the current price. Best for uptrending markets where you expect price to dip into buy levels and bounce back.
- With split — capital is divided across both buy and sell levels. A market buy at the start price funds sell positions above. Best for ranging/sideways markets where price oscillates around the current level.
If the user is unsure, recommend running both variants in backtest/optimize to compare results.
Use consistently across backtest, optimize, dry-run, and live when the user has chosen split mode.
--split当用户设置网格策略(回测、优化或运行)时,如果他们未指定,询问他们是否要使用拆分模式。以简单选择的方式呈现并说明背景:
--split你是否要使用拆分模式()?--split
- 不使用拆分——所有资金投入当前价格下方的买入订单。最适合上涨趋势市场,此时你预期价格会回落到买入区间后反弹。
- 使用拆分——资金分配到买入和卖出层。在起始价格进行市价买入,为上方的卖出仓位提供资金。最适合震荡/横盘市场,此时价格在当前水平附近波动。
如果用户不确定,建议在回测/优化中运行两种模式以比较结果。
当用户选择拆分模式后,在回测、优化、模拟运行和实盘运行中均需一致使用。
--splitP&L Metrics
盈亏指标(P&L)
Realized P&L = sum of profit from each completed sell (sell revenue − cost per level). Measures pure grid trading profit. The initial split buy (if is used) does not affect this metric.
--splitTotal P&L = (final quote balance + final base × final price) − initial investment. The mark-to-market portfolio value change. No assets are force-sold at the end.
Without : only buy levels (below start price) are funded. In uptrending markets all grid cycles may complete, making Realized and Total P&L equal.
--splitWith : investment is divided across all levels. Levels above start price get positions via a simulated market buy at start price. This creates Realized/Total P&L divergence and allows profiting from both up and down moves within the grid.
--splitRealized P&L = 每笔完成卖出的利润总和(卖出收入 − 每层成本)。衡量纯粹的网格交易利润。初始拆分买入(如果使用)不会影响该指标。
--splitTotal P&L =(最终计价货币余额 + 最终基础货币数量 × 最终价格)− 初始投入资金。按市值计算的投资组合价值变化。不会在结束时强制卖出资产。
不使用时: 仅为起始价格下方的买入层提供资金。在上涨趋势市场中,所有网格周期可能完成,此时已实现盈亏和总盈亏相等。
--split使用时: 资金分配到所有层级。起始价格上方的层级通过在起始价格进行模拟市价买入获得仓位。这会导致已实现盈亏和总盈亏出现差异,并允许在网格范围内的上下波动中获利。
--splitCommon Workflow: Backtest Then Run
常见流程:先回测再运行
bash
undefinedbash
undefined1. Optimize to find best parameters
1. 优化以找到最佳参数
revx strategy grid optimize BTC-USD --investment 1000 --days 30
revx strategy grid optimize BTC-USD --investment 1000 --days 30
2. Backtest the top result
2. 回测最优结果
revx strategy grid backtest BTC-USD --levels 10 --range 7 --investment 1000
revx strategy grid backtest BTC-USD --levels 10 --range 7 --investment 1000
3. Dry run first
3. 先进行模拟运行
revx strategy grid run BTC-USD --investment 1000 --levels 10 --range 7 --dry-run
revx strategy grid run BTC-USD --investment 1000 --levels 10 --range 7 --dry-run
4. Go live
4. 启动实盘
revx strategy grid run BTC-USD --investment 1000 --levels 10 --range 7
Use `--split` consistently across all steps if you want to test and run with split investment.
---revx strategy grid run BTC-USD --investment 1000 --levels 10 --range 7
如果你想测试并运行拆分资金模式,请在所有步骤中一致使用`--split`。
---Related Skills
相关技能
| Skill | Purpose |
|---|---|
| Get Telegram notifications for grid bot events |
| Check prices and pair data before configuring a grid |
| Check balances and order status |
| Manual order placement (grid bot places orders automatically) |
| API key setup and configuration |
| 技能 | 用途 |
|---|---|
| 获取网格机器人事件的Telegram通知 |
| 配置网格前查看价格和交易对数据 |
| 查看余额和订单状态 |
| 手动下单(网格机器人自动下单) |
| API密钥设置和配置 |