strategy-grid-trade
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseETH/USDC Grid Trading Bot
ETH/USDC 网格交易机器人
欢迎使用 ETH/USDC 网格交易策略!
我们在 Base 链上自动执行 ETH/USDC 网格交易——震荡行情中低买高卖,每次价格穿越网格线自动成交。策略基于 EMA 动态居中,自适应波动率调整网格步长,内置仓位限制、冷却期、熔断保护,极低 gas 成本。
投资案例:
小李用 5,000 USDC + 1 ETH(约 $8,000 总资产)启动网格机器人。ETH 在 $2,800~$3,200 区间震荡。 机器人设置 6 档网格,步长约 1.5%,每次交易约 $500。 一周内触发 12 次买卖,累计捕获网格价差约 $180,折合年化约 24%。 同期 ETH 横盘无涨跌,手动持有收益为零。
EMA-centered dynamic grid trading on Base (chain 8453) via OKX DEX aggregator. Available as standalone binary.
strategy-grid欢迎使用 ETH/USDC 网格交易策略!
我们在Base链上自动执行ETH/USDC网格交易——在震荡行情中低买高卖,每当价格穿越网格线时自动成交。策略基于EMA动态确定网格中心,可自适应波动率调整网格步长,内置仓位限制、冷却期、熔断保护机制,Gas成本极低。
投资案例:
小李用5000 USDC + 1 ETH(约8000美元总资产)启动网格机器人。ETH在2800~3200美元区间震荡。 机器人设置6档网格,步长约1.5%,每次交易约500美元。 一周内触发12次买卖,累计捕获网格价差约180美元,折合年化收益率约24%。 同期ETH横盘无涨跌,手动持有收益为零。
EMA-centered dynamic grid trading on Base (chain 8453) via OKX DEX aggregator. Available as standalone binary.
strategy-gridPre-flight Checks
前置检查
Run immediately when this skill is triggered — before any response or command. Always follow these steps in order. Do not echo routine command output to the user; only provide a brief status update when installing, updating, or handling a failure.
触发本技能后立即执行以下步骤——在回复或执行任何命令之前,必须按顺序完成这些步骤。无需向用户回显常规命令输出;仅在安装、更新或处理失败时提供简短状态更新。
Step 1: Check onchainos
步骤1:检查onchainos
bash
which onchainos- Found → run to confirm, then proceed to Step 2.
onchainos --version - Not found → install automatically:
bash
curl -sSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh- If install succeeds → verify with , then proceed to Step 2.
onchainos --version - If install fails → notify the user to install manually:
Stop here until user confirms onchainos is available.
自动安装失败,请手动安装 onchainos: https://github.com/okx/onchainos-skills
- If install succeeds → verify with
bash
which onchainos- 已找到 → 运行确认版本,然后进入步骤2。
onchainos --version - 未找到 → 自动安装:
bash
curl -sSL https://raw.githubusercontent.com/okx/onchainos-skills/main/install.sh | sh- 若安装成功 → 用验证,然后进入步骤2。
onchainos --version - 若安装失败 → 通知用户手动安装:
在此暂停,直到用户确认onchainos已可用。
自动安装失败,请手动安装onchainos: https://github.com/okx/onchainos-skills
- 若安装成功 → 用
Step 2: Check skills-store
步骤2:检查skills-store
bash
which skills-store-
Not found → install:bash
curl -sSL https://raw.githubusercontent.com/purong-huang-1121/skills-store/main/install.sh | sh -
Check for updates: Readand compare with current timestamp:
~/.cargo/bin/.skills-store/last_check_gridbashcached_ts=$(cat ~/.cargo/bin/.skills-store/last_check_grid 2>/dev/null || true) now=$(date +%s)- If is non-empty and
cached_ts(12 hours), skip the update.(now - cached_ts) < 43200 - Otherwise, run the installer to check for updates.
- If
bash
which skills-store-
未找到 → 安装:bash
curl -sSL https://raw.githubusercontent.com/purong-huang-1121/skills-store/main/install.sh | sh -
检查更新:读取并与当前时间戳对比:
~/.cargo/bin/.skills-store/last_check_gridbashcached_ts=$(cat ~/.cargo/bin/.skills-store/last_check_grid 2>/dev/null || true) now=$(date +%s)- 若非空且
cached_ts(12小时),则跳过更新。(now - cached_ts) < 43200 - 否则,运行安装程序检查更新。
- 若
Step 3: Check strategy-grid
步骤3:检查strategy-grid
bash
which strategy-grid- Found → proceed.
- Not found → install:
bash
curl -sSL https://raw.githubusercontent.com/purong-huang-1121/skills-store/main/install_strategy.sh | sh -s -- strategy-grid- If install succeeds → verify with , then proceed.
strategy-grid --version - If install fails → notify the user:
Stop here until user confirms installation.
自动安装失败,请手动安装 strategy-grid: curl -sSL https://raw.githubusercontent.com/purong-huang-1121/skills-store/main/install_strategy.sh | sh -s -- strategy-grid
- If install succeeds → verify with
bash
which strategy-grid- 已找到 → 继续。
- 未找到 → 安装:
bash
curl -sSL https://raw.githubusercontent.com/purong-huang-1121/skills-store/main/install_strategy.sh | sh -s -- strategy-grid- 若安装成功 → 用验证,然后继续。
strategy-grid --version - 若安装失败 → 通知用户:
在此暂停,直到用户确认安装完成。
自动安装失败,请手动安装strategy-grid: curl -sSL https://raw.githubusercontent.com/purong-huang-1121/skills-store/main/install_strategy.sh | sh -s -- strategy-grid
- 若安装成功 → 用
Authentication
身份验证
Requires two sets of credentials:
OKX API (for price quotes and swap execution):
bash
OKX_API_KEY=...
OKX_SECRET_KEY=...
OKX_PASSPHRASE=...EVM Wallet (for on-chain signing):
bash
EVM_PRIVATE_KEY=0x... # Base wallet with ETH + USDCOptional:
bash
BASE_RPC_URL=... # Custom Base RPC (default: public endpoint)
TELEGRAM_BOT_TOKEN=... # Telegram notifications on trade/error
TELEGRAM_CHAT_ID=... # Telegram chat ID for alerts需要两组凭证:
OKX API(用于报价和交易执行):
bash
OKX_API_KEY=...
OKX_SECRET_KEY=...
OKX_PASSPHRASE=...EVM钱包(用于链上签名):
bash
EVM_PRIVATE_KEY=0x... # 持有ETH和USDC的Base钱包可选配置:
bash
BASE_RPC_URL=... # 自定义Base RPC节点(默认使用公共节点)
TELEGRAM_BOT_TOKEN=... # 交易/错误通知的Telegram机器人令牌
TELEGRAM_CHAT_ID=... # 接收警报的Telegram聊天IDBefore Starting the Bot
启动机器人前的准备
IMPORTANT: Before running , you MUST:
strategy-grid start- Run to show the user their current parameters
strategy-grid config - Present the parameters in a readable table and ask if they want to adjust any
- If the user wants to change a parameter, use
strategy-grid set --key <name> --value <value> - Parameters are saved to in the same directory as the
grid_config.jsonexecutable and persist across restarts — no need to set them every timestrategy-grid
Example flow:
bash
undefined重要提示: 在运行之前,您必须:
strategy-grid start- 运行向用户展示当前参数
strategy-grid config - 以易读的表格形式呈现参数,并询问用户是否需要调整
- 若用户需要修改参数,使用进行设置
strategy-grid set --key <名称> --value <值> - 参数将保存到可执行文件所在目录的
strategy-grid中,重启后依然有效——无需每次启动都重新设置grid_config.json
示例流程:
bash
undefinedShow current config
查看当前配置
strategy-grid config
strategy-grid config
User wants to change tick interval
用户希望修改tick间隔
strategy-grid set --key tick_interval_secs --value 120
strategy-grid set --key tick_interval_secs --value 120
User wants wider position limits
用户希望放宽仓位限制
strategy-grid set --key position_max_pct --value 70
strategy-grid set --key position_min_pct --value 30
strategy-grid set --key position_max_pct --value 70
strategy-grid set --key position_min_pct --value 30
Now start
现在启动机器人
strategy-grid start
undefinedstrategy-grid start
undefinedQuickstart
快速入门
bash
undefinedbash
undefinedCheck market conditions
检查市场状况
strategy-grid analyze
strategy-grid analyze
View current state and PnL
查看当前状态和盈亏
strategy-grid status
strategy-grid status
Run a single tick (fetch price, detect crossing, trade if needed)
执行单次tick(获取价格、检测穿越、必要时执行交易)
strategy-grid tick
strategy-grid tick
Start continuous bot (tick every 60 seconds)
启动持续运行的机器人(每60秒执行一次tick)
strategy-grid start
strategy-grid start
Stop running bot
停止运行中的机器人
strategy-grid stop
undefinedstrategy-grid stop
undefinedCommand Index
命令索引
| # | Command | Auth | Description |
|---|---|---|---|
| 1 | | Yes | Execute one grid cycle |
| 2 | | Yes | Start foreground bot loop (60s ticks) |
| 3 | | No | Stop running bot via PID file |
| 4 | | No | Show grid state, balances, PnL |
| 5 | | No | Detailed PnL and performance stats |
| 6 | | No | Show trade history |
| 7 | | No | Clear all grid state |
| 8 | | Yes | Re-execute last failed trade |
| 9 | | Yes | Market analysis (EMA, volatility, trend) |
| 10 | | No | Record manual deposit/withdrawal |
| 11 | | No | Show current bot configuration |
| 12 | | No | Set a config parameter |
| 序号 | 命令 | 需要身份验证 | 描述 |
|---|---|---|---|
| 1 | | 是 | 执行一轮网格循环 |
| 2 | | 是 | 启动前台机器人循环(每60秒执行一次tick) |
| 3 | | 否 | 通过PID文件停止运行中的机器人 |
| 4 | | 否 | 显示网格状态、资产余额、盈亏情况 |
| 5 | | 否 | 生成详细的盈亏和性能统计报告 |
| 6 | | 否 | 显示交易历史 |
| 7 | | 否 | 清除所有网格状态 |
| 8 | | 是 | 重新执行最后一笔失败的交易 |
| 9 | | 是 | 市场分析(EMA、波动率、趋势) |
| 10 | | 否 | 记录手动存款/取款操作 |
| 11 | | 否 | 显示当前机器人配置 |
| 12 | | 否 | 设置配置参数 |
Core Algorithm
核心算法
1. Fetch ETH price (OKX DEX quote API)
2. Read on-chain balances (ETH + USDC on Base)
3. Check circuit breaker (consecutive errors)
4. Recalibrate grid if needed (price breakout / vol shift / age)
5. Map price → grid level
6. If level changed:
a. Direction: BUY if level dropped, SELL if rose
b. Risk checks (cooldown, position limits, repeat guard, consecutive limit)
c. Calculate trade size (% of portfolio, capped)
d. Execute swap via OKX DEX aggregator
e. Update level ONLY on success
7. Save state and report1. 获取ETH价格(OKX DEX报价API)
2. 读取链上资产余额(Base链上的ETH和USDC)
3. 检查熔断机制(连续错误次数)
4. 必要时重新校准网格(价格突破/波动率变化/网格过期)
5. 将当前价格映射到网格档位
6. 若档位发生变化:
a. 交易方向:档位下降则买入,档位上升则卖出
b. 风险检查(冷却期、仓位限制、重复交易防护、连续交易限制)
c. 计算交易规模(占投资组合的比例,有上限)
d. 通过OKX DEX聚合器执行兑换
e. 仅在交易成功时更新当前档位
7. 保存状态并生成报告Tunable Parameters
可调整参数
Parameters are persisted at in the same directory as the executable. View with , modify with . Changes take effect on next tick (no rebuild needed). If no config file exists, defaults below are used.
grid_config.jsonstrategy-gridstrategy-grid configstrategy-grid set --key <key> --value <value>The Key column shows the exact key name to use with .
strategy-grid set参数将持久化保存到可执行文件所在目录的中。使用查看参数,使用修改参数。修改后的参数将在下一轮tick生效(若机器人已运行,修改后需重启机器人)。若不存在配置文件,则使用以下默认值。
strategy-gridgrid_config.jsonstrategy-grid configstrategy-grid set --key <键名> --value <值>tick_interval_secsKey列显示使用时需指定的准确键名。
strategy-grid setGrid Structure
网格结构
| Key | Default | Description |
|---|---|---|
| | Number of grid levels |
| | EMA lookback periods for grid center calculation |
| | Grid width = multiplier × stddev |
| | Max hours before forced recalibration |
| | Seconds between each tick cycle (restart bot to apply) |
| 键名 | 默认值 | 描述 |
|---|---|---|
| | 网格档位数量 |
| | 计算网格中心的EMA回溯周期 |
| | 网格宽度 = 乘数 × 标准差 |
| | 强制重新校准网格的最长间隔(小时) |
| | 每轮tick循环的间隔秒数(修改后需重启机器人) |
Adaptive Step Sizing
自适应步长调整
Step scales linearly with real-time volatility:
step = (volatility_multiplier × stddev) / (grid_levels / 2)
step = clamp(step, price × step_min_pct, price × step_max_pct)
step = max(step, step_floor)| Key | Default | Description |
|---|---|---|
| | Step floor (0.8% of price) |
| | Step cap (6% of price) |
| | Absolute minimum step in USD |
步长会根据实时波动率线性调整:
step = (volatility_multiplier × stddev) / (grid_levels / 2)
step = clamp(step, price × step_min_pct, price × step_max_pct)
step = max(step, step_floor)| 键名 | 默认值 | 描述 |
|---|---|---|
| | 步长下限(价格的0.8%) |
| | 步长上限(价格的6%) |
| | 步长的绝对最小值(美元) |
Trade Sizing
交易规模
| Key | Default | Description |
|---|---|---|
| | Max 12% of portfolio per trade |
| | Minimum trade size in USD |
| | Slippage tolerance % for DEX swap. Increase to 2-3 if trades revert |
| | ETH reserved for gas, not available for SELL |
| 键名 | 默认值 | 描述 |
|---|---|---|
| | 单笔交易最大占投资组合的比例(12%) |
| | 单笔交易的最小规模(美元) |
| | DEX兑换的滑点容忍度(百分比)。若交易频繁失败,可提高至2-3 |
| | 预留用于Gas的ETH,不可用于卖出交易 |
Risk Controls
风险控制
| Key | Default | Description |
|---|---|---|
| | 30min cooldown between same-direction trades |
| | Max consecutive same-direction trades |
| | Block BUY when ETH% exceeds this |
| | Block SELL when ETH% drops below this |
| | Circuit breaker threshold |
| | Seconds cooldown after circuit breaker trips |
| 键名 | 默认值 | 描述 |
|---|---|---|
| | 同方向交易的冷却时间(30分钟) |
| | 连续同方向交易的最大次数 |
| | 当ETH占比超过此值时,禁止买入 |
| | 当ETH占比低于此值时,禁止卖出 |
| | 熔断机制触发阈值 |
| | 熔断触发后的冷却时间(秒) |
Common Parameter Adjustments
常见参数调整
Slippage (trades reverting on-chain):
bash
strategy-grid set --key slippage_pct --value 2Wider position limits (allow more one-sided exposure):
bash
strategy-grid set --key position_max_pct --value 75
strategy-grid set --key position_min_pct --value 25Faster/slower tick interval:
bash
strategy-grid set --key tick_interval_secs --value 120 # 2 minutesNote: Restart the bot after changing .
tick_interval_secsLarger trade sizes:
bash
strategy-grid set --key max_trade_pct --value 0.20 # 20% per trade
strategy-grid set --key min_trade_usd --value 10 # $10 minimum滑点调整(链上交易频繁失败):
bash
strategy-grid set --key slippage_pct --value 2放宽仓位限制(允许更大的单边敞口):
bash
strategy-grid set --key position_max_pct --value 75
strategy-grid set --key position_min_pct --value 25调整tick间隔(更快/更慢):
bash
strategy-grid set --key tick_interval_secs --value 120 # 2分钟注意:修改后需重启机器人。
tick_interval_secs增大交易规模:
bash
strategy-grid set --key max_trade_pct --value 0.20 # 单笔交易最大占比20%
strategy-grid set --key min_trade_usd --value 10 # 最小交易规模10美元CLI Command Reference
CLI命令参考
strategy-grid tick
strategy-grid tick
Execute one grid cycle: fetch price, detect grid crossing, execute trade if needed.
Output actions:
- — Grid was recalibrated (first tick or recalibration trigger)
grid_calibrated - — Price stayed within same grid level
no_crossing - — Swap executed successfully
trade_executed - — Swap attempted but failed (retriable)
trade_failed - — Risk check prevented trade (cooldown, position limit, etc.)
blocked - — Trade amount below minimum
skipped
执行一轮网格循环:获取价格、检测网格穿越、必要时执行交易。
输出动作:
- — 网格已重新校准(首次tick或触发校准条件)
grid_calibrated - — 价格未穿越网格档位
no_crossing - — 兑换交易成功执行
trade_executed - — 尝试兑换但失败(可重试)
trade_failed - — 风险检查阻止了交易(冷却期、仓位限制等)
blocked - — 交易金额低于最小值
skipped
strategy-grid start
strategy-grid start
Start the bot in foreground, executing every 60 seconds. Creates a PID file at . Use Ctrl+C or to terminate.
tick~/.skills-store/grid_bot.pidgrid stop在前台启动机器人,每60秒执行一次。会在创建PID文件。可使用Ctrl+C或终止机器人。
tick~/.skills-store/grid_bot.pidgrid stopstrategy-grid stop
strategy-grid stop
Stop a running bot by sending SIGTERM to the process in the PID file.
通过向PID文件中的进程发送SIGTERM信号来停止运行中的机器人。
strategy-grid status
strategy-grid status
Show current grid state, balances, PnL overview, and whether the bot is running.
显示当前网格状态、资产余额、盈亏概览以及机器人是否在运行。
strategy-grid report
strategy-grid report
Detailed performance report: success rate, buy/sell counts, total volume, grid profit, deposits, and portfolio PnL.
生成详细的性能报告:交易成功率、买卖次数、总交易量、网格收益、存款记录和投资组合盈亏。
strategy-grid history [--limit N]
strategy-grid history [--limit N]
Show trade history (default: last 50 trades). Each trade includes direction, price, amount, tx hash, and grid levels.
显示交易历史(默认显示最近50笔交易)。每笔交易包含方向、价格、金额、交易哈希和网格档位信息。
strategy-grid reset --force
strategy-grid reset --force
Delete all grid state. Requires flag for safety.
--force删除所有网格状态。为确保安全,必须添加参数。
--forcestrategy-grid retry
strategy-grid retry
Re-execute the last failed trade. Validates that price hasn't moved >5% since failure.
重新执行最后一笔失败的交易。会验证自失败以来价格波动是否未超过5%。
strategy-grid analyze
strategy-grid analyze
Market analysis showing current price, EMA-20, volatility, trend direction, and grid utilization.
生成市场分析报告,包含当前价格、EMA-20、波动率、趋势方向和网格利用率。
strategy-grid deposit --amount N [--note "..."]
strategy-grid deposit --amount N [--note "..."]
Record a manual deposit (positive) or withdrawal (negative) for accurate PnL tracking.
记录手动存款(正数)或取款(负数),以确保盈亏计算准确。
strategy-grid config
strategy-grid config
Show all current bot parameters and their values. Indicates whether a custom config file exists.
显示当前机器人的所有参数及其值。会提示是否存在自定义配置文件。
strategy-grid set --key NAME --value VALUE
strategy-grid set --key NAME --value VALUE
Set a single parameter. Saved to in the executable's directory. Takes effect on next tick (restart bot if already running to apply tick_interval changes).
grid_config.jsonAvailable keys: , , , , , , , , , , , , , , , , , .
grid_levelstick_interval_secsmax_trade_pctmin_trade_usdslippage_pctema_periodvolatility_multiplierstep_min_pctstep_max_pctstep_floorgrid_recalibrate_hoursmin_trade_intervalmax_same_dir_tradesposition_max_pctposition_min_pctgas_reserve_ethmax_consecutive_errorscooldown_after_errors设置单个参数。参数将保存到可执行文件所在目录的中。修改后的参数将在下一轮tick生效(若机器人已运行,修改后需重启)。
grid_config.jsontick_interval_secs可用键名:, , , , , , , , , , , , , , , , , 。
grid_levelstick_interval_secsmax_trade_pctmin_trade_usdslippage_pctema_periodvolatility_multiplierstep_min_pctstep_max_pctstep_floorgrid_recalibrate_hoursmin_trade_intervalmax_same_dir_tradesposition_max_pctposition_min_pctgas_reserve_ethmax_consecutive_errorscooldown_after_errorsLevel Update Rule (Critical)
档位更新规则(关键)
| Outcome | Update level? | Rationale |
|---|---|---|
| Trade succeeded | Yes | Grid crossing consumed |
| Trade failed | No | Retry on next tick |
| Trade skipped (cooldown/limit) | No | Don't lose the crossing |
| 结果 | 是否更新档位? | 原因 |
|---|---|---|
| 交易成功 | 是 | 网格穿越已被消耗 |
| 交易失败 | 否 | 在下一轮tick重试 |
| 交易被跳过(冷却期/限制) | 否 | 不丢失网格穿越的机会 |
PnL Tracking
盈亏追踪
total_pnl = current_portfolio_value - initial_value - deposits
grid_profit += estimated spread capture on SELL tradestotal_pnl = 当前投资组合价值 - 初始价值 - 存款总额
grid_profit += 卖出交易中捕获的预估价差State Persistence
状态持久化
State is stored at with atomic writes (write to .tmp, rename). Includes: grid parameters, price history (last 288 = 24h at 5min), trade history (last 50), balance snapshots, cumulative stats, and error tracking. PID file at .
~/.skills-store/grid_state.json~/.skills-store/grid_bot.pid状态存储在中,采用原子写入方式(先写入.tmp文件,再重命名)。包含:网格参数、价格历史(最近288条=5分钟间隔的24小时数据)、交易历史(最近50笔)、资产余额快照、累计统计数据和错误追踪信息。PID文件存储在。
~/.skills-store/grid_state.json~/.skills-store/grid_bot.pidCross-Skill Workflows
跨技能工作流
| Need | Skill |
|---|---|
| USDC yield optimization (Aave/Compound/Morpho) | |
| Aave V3 supply/withdraw/markets | |
| Morpho vault operations | |
| Hyperliquid perpetual trading | |
| Prediction markets | |
| 需求 | 对应技能 |
|---|---|
| USDC收益优化(Aave/Compound/Morpho) | |
| Aave V3存/取/市场查询 | |
| Morpho金库操作 | |
| Hyperliquid永续合约交易 | |
| 预测市场 | |
Edge Cases
边缘场景处理
| Scenario | Behavior |
|---|---|
| First tick (no grid) | Calibrates grid from current price + history, sets initial level |
| Price exits grid range | Triggers recalibration (breakout detected) |
| Volatility shifts >30% | Triggers recalibration |
| Grid age > 12 hours | Triggers recalibration |
| 5 consecutive errors | Circuit breaker trips, 1-hour cooldown |
| Trade amount < $5 | Skipped (below minimum) |
| ETH balance < 0.003 | Gas reserve protected, SELL blocked |
| No EVM_PRIVATE_KEY | Error on tick/start/retry commands |
| Bot already running | |
| No running bot | |
| Reset without --force | Returns error, requires confirmation |
| 场景 | 行为 |
|---|---|
| 首次tick(无网格) | 根据当前价格和历史数据校准网格,设置初始档位 |
| 价格超出网格范围 | 触发重新校准(检测到突破) |
| 波动率变化超过30% | 触发重新校准 |
| 网格运行时间超过12小时 | 触发重新校准 |
| 连续5次错误 | 熔断机制触发,进入1小时冷却期 |
| 交易金额低于5美元 | 跳过交易(低于最小值) |
| ETH余额低于0.003 | 保护Gas预留额度,禁止卖出交易 |
| 未配置EVM_PRIVATE_KEY | tick/start/retry命令执行失败 |
| 机器人已在运行 | |
| 无运行中的机器人 | |
| 未加--force参数执行reset | 返回错误,需确认 |
Troubleshooting
故障排除
| Symptom | Cause | Fix |
|---|---|---|
Trade reverts on-chain ( | Slippage too low for the DEX route | |
| RPC 429 / rate limit errors | Public Base RPC rate limited | Set |
| Circuit breaker trips (5 errors) | Repeated failures (RPC, slippage, gas) | Check logs, fix root cause, then wait 1h or |
| Bot not trading (no_crossing) | Price within same grid level | Normal — bot only trades when price crosses a grid boundary |
| Trade blocked: position limit | ETH% too high/low | Adjust |
| Trade blocked: cooldown | Same-direction trade too soon (30min default) | Lower |
| Trade blocked: repeat guard | Same crossing as last trade | Normal — prevents oscillation. Will clear when price moves to a new level |
| Gas estimation fails | Insufficient ETH for gas | Ensure wallet has > 0.003 ETH (adjust via |
| 症状 | 原因 | 解决方法 |
|---|---|---|
链上交易回滚( | DEX路由的滑点设置过低 | |
| RPC 429/速率限制错误 | 公共Base RPC节点达到速率限制 | 设置 |
| 熔断机制触发(连续5次错误) | 重复失败(RPC、滑点、Gas问题) | 检查日志,修复根本原因,等待1小时或执行 |
机器人未执行交易( | 价格未穿越网格档位 | 正常现象——仅当价格穿越网格线时才会触发交易 |
| 交易被阻止:仓位限制 | ETH占比过高/过低 | 调整 |
| 交易被阻止:冷却期 | 同方向交易间隔过短(默认30分钟) | 若需要更频繁交易,降低 |
| 交易被阻止:重复防护 | 与上一笔交易的网格穿越相同 | 正常现象——防止震荡。价格进入新档位后会自动解除 |
| Gas估算失败 | ETH余额不足支付Gas | 确保钱包持有超过0.003 ETH(可通过 |
Anti-Patterns
反模式
| Pattern | Problem |
|---|---|
| Recalibrate every tick | Grid oscillates, no stable levels |
| Update level on failure/skip | Silently loses grid crossings |
| No position limits | Trending market → 100% one-sided |
| Fixed step in volatile market | Too small → over-trades; too large → never triggers |
| Net cash flow ≠ profit |
| No cooldown | Rapid swings cause burst of trades eating slippage |
| 模式 | 问题 |
|---|---|
| 每轮tick都重新校准网格 | 网格震荡,无稳定档位 |
| 交易失败/跳过时更新档位 | 悄悄丢失网格穿越机会 |
| 无仓位限制 | 趋势市场下会导致100%单边敞口 |
| 波动市场中使用固定步长 | 步长过小→过度交易;步长过大→永远不触发交易 |
用 | 净现金流不等于实际利润 |
| 无冷却期设置 | 价格快速波动导致大量交易,滑点成本过高 |