top-rank-tokens-sniper
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTop Rank Tokens Sniper v1.0
Top Rank Tokens Sniper v1.0 — 顶级排名代币狙击工具(榜单狙击手)
This is a real trading bot. Make sure you understand the risks before use. It is recommended to test in Paper mode first.
这是一款实盘交易机器人。使用前请务必了解风险,建议先在模拟交易(Paper mode)中测试。
Disclaimer
免责声明
This strategy script, parameter configuration, and all related documentation are provided solely for educational research and technical reference purposes. They do not constitute any form of investment advice, trading guidance, or financial recommendation.
- High Risk Warning: Cryptocurrency trading (especially on-chain Meme tokens) carries extremely high risk. Prices may fluctuate drastically within seconds or even go to zero. You may lose your entire invested capital.
- Ranking Data Risk: Leaderboard ranking data may be manipulated by wash trading. Changes in ranking do not represent genuine market consensus. Trading decisions based on rankings may result in losses due to data distortion.
- Parameters for Reference Only: All default parameters in this strategy (take profit, stop loss, position size, safety thresholds, etc.) are set for general scenarios and are not guaranteed to be suitable for any specific market conditions. Users should adjust all parameters according to their own risk tolerance, trading experience, and market judgment.
- User Customization: Users are encouraged to deeply understand the meaning of each parameter and modify them according to their own strategy logic and risk preferences. Every parameter in is annotated with comments for easy customization.
config.py - No Guaranteed Returns: Past performance does not represent future results. Even parameters that perform well in backtesting may fail in live trading due to changing market conditions.
- Technical Risk: On-chain transactions are irreversible. Smart contracts may contain vulnerabilities. Network congestion may cause transaction delays or failures.
- Third-Party Dependency Risk: This strategy relies on third-party infrastructure including onchainos CLI, OKX API, and the Solana network. Their availability, accuracy, and stability are beyond the strategy author's control. Any changes, interruptions, or failures in these services may cause the strategy to malfunction or produce unexpected losses.
- Regulatory/Legal Risk: Cryptocurrency trading may be strictly restricted or prohibited in some countries and regions. Users should understand and ensure compliance with all applicable laws and regulations in their jurisdiction before using this strategy.
- Tax Risk: Frequent trading may generate numerous taxable events. Users should understand and comply with local tax laws regarding reporting and paying taxes on cryptocurrency trading gains.
- Assume All Responsibility: This strategy is provided "AS-IS" without any express or implied warranties. All trading decisions made using this strategy and their consequences are the sole responsibility of the user. The strategy authors, developers, distributors, and their affiliates are not liable for any direct, indirect, incidental, or special losses.
Recommendation: For first-time use, please run in Paper mode (). After fully familiarizing yourself with the strategy logic and parameter behavior, then consider whether to switch to live trading.
MODE = "paper"本策略脚本、参数配置及所有相关文档仅用于教育研究和技术参考目的,不构成任何形式的投资建议、交易指导或财务推荐。
- 高风险警告:加密货币交易(尤其是链上Meme代币)风险极高。价格可能在数秒内大幅波动甚至归为零,您可能损失全部投资本金。
- 排行榜数据风险:排行榜排名数据可能被洗盘交易操纵,排名变化并不代表真实市场共识。基于排名做出的交易决策可能因数据失真而导致亏损。
- 参数仅供参考:本策略中的所有默认参数(止盈、止损、仓位大小、安全阈值等)均针对通用场景设置,不保证适用于任何特定市场环境。用户应根据自身风险承受能力、交易经验和市场判断调整所有参数。
- 用户自定义:鼓励用户深入理解每个参数的含义,并根据自身策略逻辑和风险偏好进行修改。中的每个参数都附有注释,便于自定义配置。
config.py - 收益不做保证:过往表现不代表未来结果。即使在回测中表现良好的参数,也可能因市场环境变化在实盘交易中失效。
- 技术风险:链上交易不可逆。智能合约可能存在漏洞,网络拥堵可能导致交易延迟或失败。
- 第三方依赖风险:本策略依赖第三方基础设施,包括onchainos CLI、OKX API和Solana网络。这些服务的可用性、准确性和稳定性不受策略作者控制。任何服务变更、中断或故障都可能导致策略失效或产生意外损失。
- 监管/法律风险:加密货币交易在部分国家和地区可能受到严格限制或禁止。用户在使用本策略前应了解并确保遵守所在司法辖区的所有适用法律法规。
- 税务风险:频繁交易可能产生大量应税事件。用户应了解并遵守当地关于加密货币交易收益申报和纳税的税法规定。
- 自行承担全部责任:本策略按“原样”提供,不提供任何明示或暗示的担保。使用本策略做出的所有交易决策及其后果均由用户自行承担。策略作者、开发者、分销商及其关联方不对任何直接、间接、偶然或特殊损失负责。
建议:首次使用请在模拟交易模式()下运行。在完全熟悉策略逻辑和参数表现后,再考虑是否切换到实盘交易。
MODE = "paper"File Structure
文件结构
Top Rank Tokens Sniper - 榜单狙击手/
├── skill.md ← This file (strategy documentation)
├── config.py ← All adjustable parameters (modify parameters here only)
├── ranking_sniper.py ← Main strategy program
├── dashboard.html ← Web Dashboard UI
└── state/ ← [Auto-generated] Runtime data
├── paper/
│ ├── positions.json
│ ├── trades.json
│ ├── daily-stats.json
│ └── signals-log.json
└── live/
└── (same as above)Top Rank Tokens Sniper - 榜单狙击手/
├── skill.md ← 本文件(策略文档)
├── config.py ← 所有可调整参数(仅在此文件修改参数)
├── ranking_sniper.py ← 主策略程序
├── dashboard.html ← Web仪表盘UI
└── state/ ← [自动生成] 运行时数据
├── paper/
│ ├── positions.json
│ ├── trades.json
│ ├── daily-stats.json
│ └── signals-log.json
└── live/
└── (内容同paper目录)Prerequisites
前置条件
1. Install onchainos CLI (>= 2.0.0-beta)
1. 安装onchainos CLI(版本 >= 2.0.0-beta)
bash
undefinedbash
undefinedCheck if already installed
检查是否已安装
onchainos --version
onchainos --version
If not installed, follow the onchainos official documentation
若未安装,请遵循onchainos官方文档进行安装
Make sure onchainos is in PATH or located at ~/.local/bin/onchainos
确保onchainos已加入PATH或位于~/.local/bin/onchainos路径下
undefinedundefined2. Login to Agentic Wallet (TEE Signing)
2. 登录Agentic Wallet(TEE签名)
bash
undefinedbash
undefinedOne-time login (email verification)
一次性登录(需邮箱验证)
onchainos wallet login <your-email>
onchainos wallet login <your-email>
Verify login status
验证登录状态
onchainos wallet status
onchainos wallet status
→ loggedIn: true
→ loggedIn: true
Confirm Solana address
确认Solana地址
onchainos wallet addresses --chain 501
> Agentic Wallet uses TEE secure enclave signing. Private keys are never exposed to code/logs/network.
> No need to set the WALLET_PRIVATE_KEY environment variable.onchainos wallet addresses --chain 501
> Agentic Wallet采用TEE安全飞地签名技术,私钥绝不会暴露给代码/日志/网络。
> 无需设置WALLET_PRIVATE_KEY环境变量。3. No pip install Required
3. 无需pip安装依赖
This strategy only depends on Python standard library + onchainos CLI. No third-party packages needed.
本策略仅依赖Python标准库 + onchainos CLI,无需安装第三方包。
AI Agent Startup Interaction Protocol
AI Agent启动交互协议
When the user requests to start this strategy, the AI Agent must follow the procedure below and must not skip directly to launch.
当用户请求启动本策略时,AI Agent必须遵循以下流程,不得直接跳过步骤启动。
Phase 1: Show Strategy Overview
阶段1:展示策略概述
Present the following to the user:
🏆 Top Rank Tokens Sniper v1.0 — Solana Ranking Sniper
This strategy scans the Solana 1h gainers leaderboard Top 20 every 10 seconds.
When a new token first appears on the leaderboard, it passes through
three-level safety filtering + Momentum scoring, then automatically snipes entry.
Positions are managed through a 6-layer exit system.
🧪 Current: Paper Mode — no real money spent, observing signals only
⚠️ Risk Warning: Meme coins carry extremely high risk. You may lose your entire investment.
Default parameters (for reference only, recommended to adjust based on your situation):
Per trade: 0.05 SOL
Total budget: 0.5 SOL
Max positions: 5
Take profit: TP1 +8% / TP2 +20% / TP3 +40%
Stop loss: -15% Hard Stop / -8% Quick Stop (3min)
Trailing stop: Activates at +10% profit, exits on 8% drawdown
Ranking exit: Auto sell 100% when dropped out of Top 20 (highest priority)
Max hold time: 2 hours
All parameters can be freely modified in config.py to suit your trading style.向用户展示以下内容:
🏆 Top Rank Tokens Sniper v1.0 — Solana排名狙击工具
本策略每10秒扫描Solana 1小时涨幅榜前20名。
当新代币首次出现在榜单上时,会通过三级安全筛选 + 动量评分,然后自动狙击入场。
仓位通过6层退出系统进行管理。
🧪 当前模式:模拟交易模式 — 不使用真实资金,仅观察信号
⚠️ 风险提示:Meme币风险极高,您可能损失全部投资。
默认参数(仅供参考,建议根据自身情况调整):
单笔交易金额:0.05 SOL
总预算:0.5 SOL
最大持仓数:5
止盈设置:TP1 +8% / TP2 +20% / TP3 +40%
止损设置:-15%硬性止损 / -8%快速止损(持仓3分钟后触发)
追踪止损:盈利达到+10%时激活,回撤8%时离场
排名退出:代币跌出前20名时自动全额卖出(优先级最高)
最长持仓时间:2小时
所有参数均可在config.py中自由修改,以适配您的交易风格。Q1: Risk Preference (Mandatory)
Q1:风险偏好(必填)
- 🛡️ Conservative: Quick in-and-out, small TP with tight SL
- ⚖️ Default: Balanced configuration (recommended)
- 🔥 Aggressive: Large TP with wide SL
→ Parameter mapping (for AI Agent to write into config.py, no need to show to user):
| Preference | STOP_LOSS_PCT | QUICK_STOP_MIN | QUICK_STOP_PCT | TP_TIERS | MAX_HOLD_HOURS | TRAILING_ACTIVATE | TRAILING_DROP |
|---|---|---|---|---|---|---|---|
| Conservative | -10 | 2 | -5 | (5,0.30),(12,0.35),(25,0.35) | 1 | 8 | 5 |
| Default | -15 | 3 | -8 | (8,0.30),(20,0.35),(40,0.35) | 2 | 10 | 8 |
| Aggressive | -25 | 5 | -12 | (12,0.30),(30,0.35),(60,0.35) | 4 | 15 | 12 |
- 🛡️ 保守型:快进快出,小止盈+严止损
- ⚖️ 默认型:均衡配置(推荐)
- 🔥 激进型:大止盈+宽止损
→ 参数映射(AI Agent写入config.py,无需展示给用户):
| 风险偏好 | STOP_LOSS_PCT | QUICK_STOP_MIN | QUICK_STOP_PCT | TP_TIERS | MAX_HOLD_HOURS | TRAILING_ACTIVATE | TRAILING_DROP |
|---|---|---|---|---|---|---|---|
| 保守型 | -10 | 2 | -5 | (5,0.30),(12,0.35),(25,0.35) | 1 | 8 | 5 |
| 默认型 | -15 | 3 | -8 | (8,0.30),(20,0.35),(40,0.35) | 2 | 10 | 8 |
| 激进型 | -25 | 5 | -12 | (12,0.30),(30,0.35),(60,0.35) | 4 | 15 | 12 |
Q2: Switch to Live Trading?
Q2:切换到实盘交易?
- A. 🧪 Keep Paper mode, start directly (recommended by default)
- B. 💰 Switch to Live mode
Option A → Proceed directly to the launch step.
Option B → Enter live trading sub-flow:
-
⚠️ Confirm with user: "Live trading will use real SOL. Losses are irreversible. Confirm switch to live?"
- User confirms → Continue
- User declines → Fall back to Paper mode
-
Ask for total budget in SOL (default 0.5 SOL)
-
AI auto-calculates (let B = user's input budget):
TOTAL_BUDGET = BBUY_AMOUNT = max(B × 0.10, 0.01)
-
Show calculated results and confirm with user: "Your live configuration: Total budget X SOL, per trade Y SOL, daily loss limit Z SOL. Confirm?"
- User confirms → Write to config.py
- User requests adjustment → Return to step 2
-
Set mode parameters:
MODE = "live"PAUSED = False
- A. 🧪 保持模拟交易模式,直接启动(默认推荐)
- B. 💰 切换到实盘交易模式
选项A → 直接进入启动步骤。
选项B → 进入实盘交易子流程:
-
⚠️ 向用户确认: "实盘交易将使用真实SOL,损失不可逆。确认切换到实盘模式?"
- 用户确认 → 继续
- 用户拒绝 → 退回模拟交易模式
-
询问用户总预算(单位:SOL,默认0.5 SOL)
-
AI自动计算(设B为用户输入的预算):
TOTAL_BUDGET = BBUY_AMOUNT = max(B × 0.10, 0.01)
-
展示计算结果并向用户确认: "您的实盘配置:总预算X SOL,单笔交易Y SOL,每日亏损上限Z SOL。确认?"
- 用户确认 → 写入config.py
- 用户要求调整 → 返回步骤2
-
设置模式参数:
MODE = "live"PAUSED = False
Launch
启动步骤
- Modify corresponding parameters in based on user answers
config.py - Set (allow bot to run normally after interaction confirmation)
PAUSED = False - Check prerequisites: ,
onchainos --versiononchainos wallet status - Start bot:
python3 ranking_sniper.py - Show Dashboard link:
http://localhost:3244 - Inform user: Currently in Paper mode. To switch to live, modify in
MODE = "live"config.py
If the user says "use default config" or "just run it", only set , leave everything else unchanged, and start in Paper mode.
PAUSED = False- 根据用户回答修改config.py中的对应参数
- 设置(交互确认后允许机器人正常运行)
PAUSED = False - 检查前置条件:、
onchainos --versiononchainos wallet status - 启动机器人:
python3 ranking_sniper.py - 展示仪表盘链接:
http://localhost:3244 - 告知用户:当前处于模拟交易模式,如需切换到实盘,请修改config.py中的
MODE = "live"
如果用户说“使用默认配置”或“直接运行”,仅设置,其余参数保持不变,并以模拟交易模式启动。
PAUSED = FalseSpecial Cases
特殊情况
- User explicitly says "don't ask me, just run it" → Start with default parameters (Paper mode), but must show Phase 1 overview + set
PAUSED = False - User is a returning user (configuration history exists in conversation) → Remind them of previous configuration and ask if they want to reuse it
- 用户明确表示“别问我,直接运行” → 使用默认参数启动(模拟交易模式),但必须展示阶段1的概述内容并设置
PAUSED = False - 用户为回头客(对话中存在配置历史) → 提醒用户之前的配置,并询问是否要复用
Quick Start
快速开始
⚠️ Before starting, confirm thevalue in config.py —MODEfor Paper trading,"paper"for Live trading."live"
bash
cd ~/CC/Top\ Rank\ Tokens\ Sniper\ -\ 榜单狙击手⚠️ 启动前请确认config.py中的值 —MODE为模拟交易,"paper"为实盘交易。"live"
bash
cd ~/CC/Top\ Rank\ Tokens\ Sniper\ -\ 榜单狙击手1. Confirm onchainos is logged in
1. 确认onchainos已登录
onchainos wallet status
onchainos wallet status
2. Start bot (foreground, Ctrl+C to stop)
2. 启动机器人(前台运行,按Ctrl+C停止)
python3 ranking_sniper.py
python3 ranking_sniper.py
3. Open Dashboard
3. 打开仪表盘
4. Stop
4. 停止机器人
pkill -f ranking_sniper.py
> **First startup defaults to PAUSED=True — no new positions will be opened. After confirming everything is normal, modify PAUSED=False in config.py.**
---pkill -f ranking_sniper.py
> **首次启动默认设置为PAUSED=True — 不会开新仓位。确认一切正常后,修改config.py中的PAUSED=False。**
---Parameter Adjustment
参数调整
All adjustable parameters are in — no need to modify .
config.pyranking_sniper.py所有可调整参数均在中 — 无需修改。
config.pyranking_sniper.pyCommon Adjustments
常见调整项
| Need | Modify in |
|---|---|
| Pause/resume trading | |
| Adjust per-trade amount | |
| Adjust total budget | |
| Adjust max positions | |
| Adjust take profit | |
| Adjust hard stop loss | |
| Adjust quick stop | |
| Adjust trailing stop | |
| Adjust sell slippage | |
| Adjust scan speed | |
| MC range | |
| Paper trading | |
| Dashboard port | |
Restart the bot for changes to take effect.
| 需求 | 在 |
|---|---|
| 暂停/恢复交易 | |
| 调整单笔交易金额 | |
| 调整总预算 | |
| 调整最大持仓数 | |
| 调整止盈设置 | |
| 调整硬性止损 | |
| 调整快速止损 | |
| 调整追踪止损 | |
| 调整卖出滑点 | |
| 调整扫描频率 | |
| 市值范围 | |
| 模拟交易 | |
| 仪表盘端口 | |
修改参数后需重启机器人生效。
Strategy Architecture
策略架构
ranking_sniper.py (Single-file Bot)
├── onchainos CLI (Data + Execution + Security — no API Key)
├── _scanner_loop() ← Background thread, every 10s
│ ├── get_ranking() Leaderboard Top 20
│ ├── New entry detection prev_snap set diff
│ └── _filter() Three-level filtering
│ ├── Level 1: Slot Guard (13 basic metrics)
│ ├── Level 2: Advanced Safety (9 safety checks)
│ ├── Level 3: Holder Risk Scan (3 holder risk checks)
│ ├── _calc_score() Momentum Score calculation
│ └── → _buy() (synchronous execution)
│ └── Live mode 4-layer verification
├── _monitor_loop() ← Background thread, every 10s
│ ├── get_batch_prices() Batch prices
│ ├── _check_unconfirmed() Layer 3 monitoring
│ └── check_position() Exit decisions
│ ├── EXIT 0: Ranking Exit (dropped off leaderboard)
│ ├── EXIT 1: Hard Stop (-15%)
│ ├── EXIT 2: Quick Stop (3min, -8%)
│ ├── EXIT 3: Trailing Stop (peak +10%, drop 8%)
│ ├── EXIT 4: Time Stop (2h)
│ └── EXIT 5: Tiered TP (+8%/+20%/+40%)
├── _audit_loop() ← Background thread, every 5min (Live mode)
│ └── _wallet_audit() Wallet reconciliation
├── Dashboard (port 3244) Web UI
└── Persistent files (JSON, atomic writes)ranking_sniper.py(单文件机器人)
├── onchainos CLI(数据 + 执行 + 安全 — 无需API密钥)
├── _scanner_loop() ← 后台线程,每10秒运行一次
│ ├── get_ranking() 获取排行榜前20名
│ ├── New entry detection 检测新上榜代币(对比prev_snap集合差异)
│ └── _filter() 三级筛选
│ ├── Level 1: Slot Guard(13项基础指标)
│ ├── Level 2: Advanced Safety(9项安全检查)
│ ├── Level 3: Holder Risk Scan(3项持仓风险检查)
│ ├── _calc_score() 计算动量评分
│ └── → _buy()(同步执行)
│ └── 实盘模式下的4层验证
├── _monitor_loop() ← 后台线程,每10秒运行一次
│ ├── get_batch_prices() 批量获取价格
│ ├── _check_unconfirmed() 第三层监控(未确认仓位)
│ └── check_position() 退出决策
│ ├── EXIT 0: 排名退出(代币跌出排行榜)
│ ├── EXIT 1: 硬性止损(亏损≤-15%)
│ ├── EXIT 2: 快速止损(持仓≥3分钟且亏损≤-8%)
│ ├── EXIT 3: 追踪止损(峰值盈利≥+10%后回撤≥8%)
│ ├── EXIT 4: 时间止损(持仓≥2小时)
│ └── EXIT 5: 分层止盈(+8%卖出30% / +20%卖出35% / +40%卖出35%)
├── _audit_loop() ← 后台线程,每5分钟运行一次(仅实盘模式)
│ └── _wallet_audit() 钱包对账
├── Dashboard(端口3244) Web用户界面
└── 持久化文件(JSON格式,原子写入)Safety Checks
安全检查
Level 1: Slot Guard (13 checks, based on leaderboard data)
Level 1: Slot Guard(13项检查,基于排行榜数据)
| # | Check | Threshold |
|---|---|---|
| 1 | Min price change | >= 15% |
| 2 | Max price change | <= 500% |
| 3 | Liquidity | >= $30,000 |
| 4 | Market cap floor | >= $50,000 |
| 5 | Market cap ceiling | <= $10M |
| 6 | Holders | >= 100 |
| 7 | Buy ratio | >= 55% |
| 8 | Unique traders | >= 20 |
| 9 | Blacklist | Not in SKIP_TOKENS/BLACKLIST |
| 10 | Cooldown | >= 30min since last sell |
| 11 | Position cap | < MAX_POSITIONS |
| 12 | Dedup | Not already holding same token |
| 13 | Daily loss | Daily loss limit not triggered |
| # | 检查项 | 阈值 |
|---|---|---|
| 1 | 最小涨幅 | ≥ 15% |
| 2 | 最大涨幅 | ≤ 500% |
| 3 | 流动性 | ≥ $30,000 |
| 4 | 最低市值 | ≥ $50,000 |
| 5 | 最高市值 | ≤ $10M |
| 6 | 持仓人数 | ≥ 100 |
| 7 | 买入占比 | ≥ 55% |
| 8 | 独立交易者数量 | ≥ 20 |
| 9 | 黑名单检查 | 不在SKIP_TOKENS/BLACKLIST中 |
| 10 | 冷却时间 | 上次卖出后≥30分钟 |
| 11 | 仓位上限 | < MAX_POSITIONS |
| 12 | 去重检查 | 未持有同一代币 |
| 13 | 每日亏损检查 | 未触发每日亏损上限 |
Level 2: Advanced Safety (9 checks, onchainos token advanced-info)
Level 2: Advanced Safety(9项检查,基于onchainos代币高级信息)
| # | Check | Threshold |
|---|---|---|
| S1 | Risk level | <= 3 |
| S2 | Honeypot | No honeypot tag |
| S3 | Top 10 concentration | <= 40% |
| S4 | Dev holding | <= 15% |
| S5 | Bundler holding | <= 15% |
| S6 | LP burned | >= 50% |
| S7 | Dev rug count | <= 2 |
| S8 | Sniper holding | <= 15% |
| S9 | Internal token | Default pass |
| # | 检查项 | 阈值 |
|---|---|---|
| S1 | 风险等级 | ≤ 3 |
| S2 | 蜜罐检测 | 无蜜罐标签 |
| S3 | 前10持仓集中度 | ≤ 40% |
| S4 | 开发者持仓占比 | ≤ 15% |
| S5 | 打包交易者持仓占比 | ≤ 15% |
| S6 | LP销毁比例 | ≥ 50% |
| S7 | 开发者跑路次数 | ≤ 2 |
| S8 | 狙击机器人持仓占比 | ≤ 15% |
| S9 | 内部代币 | 默认通过 |
Level 3: Holder Risk (3 checks, onchainos token holders)
Level 3: Holder Risk(3项检查,基于onchainos代币持仓数据)
| # | Check | Threshold |
|---|---|---|
| H1 | Suspicious address holding | <= 30% |
| H2 | Phishing addresses | Block ( |
| H3 | Suspicious address count | <= 10 |
| # | 检查项 | 阈值 |
|---|---|---|
| H1 | 可疑地址持仓占比 | ≤ 30% |
| H2 | 钓鱼地址 | 拦截( |
| H3 | 可疑地址数量 | ≤ 10 |
Momentum Score
动量评分
Base Score (0-100):
buyRatio × 40 + changePenalty × 20 + traderScore × 20 + liquidityScore × 20
Bonus (0-25):
smartMoneyBuy +8 | top10<30% +5 | dsPaid +3 | communityTakeover +2
sniper<5% +4 | devClean +3 | zeroSuspicious +2
Total = Base + min(Bonus, 25)基础评分(0-100):
buyRatio × 40 + changePenalty × 20 + traderScore × 20 + liquidityScore × 20
额外加分(0-25):
smartMoneyBuy +8 | top10<30% +5 | dsPaid +3 | communityTakeover +2
sniper<5% +4 | devClean +3 | zeroSuspicious +2
总评分 = 基础评分 + min(额外加分, 25)6-Layer Exit System
6层退出系统
| Priority | Exit Type | Trigger Condition | Sell Ratio |
|---|---|---|---|
| EXIT 0 | Ranking Exit | Dropped out of Top 20 and held >= 1min | 100% |
| EXIT 1 | Hard Stop Loss | PnL <= -15% | 100% |
| EXIT 2 | Quick Stop | Held >= 3min and PnL <= -8% | 100% |
| EXIT 3 | Trailing Stop | Peak PnL >= +10% then drawdown >= 8% | 100% |
| EXIT 4 | Time Stop | Held >= 2h | 100% |
| EXIT 5 | Tiered Take Profit | +8% sell 30% / +20% sell 35% / +40% sell 35% | Partial |
| 优先级 | 退出类型 | 触发条件 | 卖出比例 |
|---|---|---|---|
| EXIT 0 | 排名退出 | 代币跌出前20名且持仓≥1分钟 | 100% |
| EXIT 1 | 硬性止损 | 盈亏比≤-15% | 100% |
| EXIT 2 | 快速止损 | 持仓≥3分钟且盈亏比≤-8% | 100% |
| EXIT 3 | 追踪止损 | 峰值盈利≥+10%后回撤≥8% | 100% |
| EXIT 4 | 时间止损 | 持仓≥2小时 | 100% |
| EXIT 5 | 分层止盈 | +8%卖出30% / +20%卖出35% / +40%卖出35% | 部分卖出 |
Session Risk Control
会话风险控制
| Rule | Value |
|---|---|
| Daily Loss Limit | |
| Consecutive Loss Pause | 3 times → pause 15min ( |
| Cumulative Loss Stop | >= 0.10 SOL → stop trading ( |
| Max Positions | |
| Max Hold Time | |
| Cooldown | |
Daily loss limit scales automatically with (ratio fixed at 15%). Consecutive loss counter resets on a winning trade. Session risk control auto-resets on bot restart.
TOTAL_BUDGET| 规则 | 数值 |
|---|---|
| 每日亏损上限 | |
| 连续亏损暂停 | 连续亏损3次 → 暂停15分钟( |
| 累计亏损停止 | ≥0.10 SOL → 停止交易( |
| 最大持仓数 | |
| 最长持仓时间 | |
| 冷却时间 | |
每日亏损上限会随自动调整(比例固定为15%)。连续亏损计数器会在盈利交易后重置。会话风险控制会在机器人重启后自动重置。
TOTAL_BUDGETIron Rules (Must Not Be Violated)
铁则(不得违反)
- RPC balance 0 ≠ token doesn't exist (Solana RPC has severe latency). Unconfirmed positions require zeroCount >= 10 AND elapsed > 180s before discarding.
- Writing to positions.json requires holding .
_state_lock - When returns TIMEOUT, always create an unconfirmed position.
order_status() - Safety check API failure → Fail-Closed, do not buy.
- Rank Exit (EXIT 0) has the highest priority.
- Daily loss limit triggered → stop all buying for the day.
- 0.01 SOL is never spent on trades.
GAS_RESERVE
- RPC余额为0 ≠ 代币不存在(Solana RPC存在严重延迟)。未确认仓位需满足zeroCount ≥10且时间超过180秒后才能丢弃。
- 写入positions.json 必须持有锁。
_state_lock - 当返回TIMEOUT时,必须创建未确认仓位。
order_status() - 安全检查API失败 → 故障关闭(Fail-Closed),不得买入。
- 排名退出(EXIT 0)拥有最高优先级。
- 触发每日亏损上限 → 当日停止所有买入操作。
- 预留的0.01 SOL绝不会用于交易。
GAS_RESERVE
onchainos CLI Command Reference
onchainos CLI命令参考
| # | Command | Purpose |
|---|---|---|
| 1 | | Leaderboard Top 20 |
| 2 | | Safety check data |
| 3 | | Holder risk |
| 4 | | Batch prices |
| 5 | | Quote |
| 6 | | Trade |
| 7 | | Solana address |
| 8 | | Balance |
| 9 | | TEE signing |
| 10 | | Trade confirmation |
| # | 命令 | 用途 |
|---|---|---|
| 1 | | 获取排行榜前20名 |
| 2 | | 获取安全检查数据 |
| 3 | | 检测持仓风险 |
| 4 | | 批量获取价格 |
| 5 | | 获取交易报价 |
| 6 | | 执行交易 |
| 7 | | 获取Solana地址 |
| 8 | | 获取钱包余额 |
| 9 | | TEE签名 |
| 10 | | 确认交易状态 |
Troubleshooting
故障排除
| Issue | Solution |
|---|---|
| "FATAL: onchainos CLI not found" | Install onchainos and ensure it is in PATH |
| Dashboard won't open | Check if port 3244 is in use: |
| Bot has no trade signals | Leaderboard may have no new entries; wait for changes |
| Login expired | Re-run |
| Live mode buy fails | Check SOL balance >= MIN_WALLET_BAL (0.06) |
| 问题 | 解决方案 |
|---|---|
| "FATAL: onchainos CLI not found" | 安装onchainos并确保其已加入PATH |
| 仪表盘无法打开 | 检查端口3244是否被占用: |
| 机器人无交易信号 | 排行榜可能没有新代币上榜,等待榜单更新 |
| 登录过期 | 重新运行 |
| 实盘模式买入失败 | 检查SOL余额是否≥MIN_WALLET_BAL(0.06) |
Glossary
术语表
| Term | Definition |
|---|---|
| Ranking Exit | Ranking Exit — automatically sell entire position when token drops out of the Top 20 gainers leaderboard; exit when momentum is lost |
| Slot Guard | 13 basic metric pre-checks based on leaderboard data, zero additional API calls |
| Advanced Safety | 9 deep safety checks using |
| Holder Risk | 3 holder risk checks using |
| Momentum Score | Momentum score (0-125), calculated from buy ratio, price change, trader count, liquidity, and safety bonuses |
| Quick Stop | Quick Stop — triggers when position is held for N minutes and loss exceeds N% (both conditions must be met) |
| Trailing Stop | Trailing Stop — triggers sell when profit reaches activation threshold then pulls back beyond threshold from peak |
| Unconfirmed Position | Pending position created when trade confirmation times out; requires multiple balance checks before discarding |
| Fail-Closed | When safety check API fails, treat as unsafe and do not buy |
| TEE | Trusted Execution Environment — onchainos signing is performed inside a secure enclave |
| Agentic Wallet | onchainos managed wallet with private keys inside TEE, never leaving the secure environment |
| DAILY_LOSS_LIMIT | Daily loss ratio (of TOTAL_BUDGET); when triggered, all buying stops for the day |
| MC / MCAP | Market Cap — token total supply × current price, measuring token scale |
| LP | Liquidity Pool — token pair pool on DEX for trading; larger LP means lower slippage |
| LP Burn | Permanently burning LP tokens to ensure liquidity cannot be withdrawn by developers |
| Rug Pull | Malicious act where developers suddenly withdraw liquidity or dump all holdings, crashing the token price to zero |
| Dev | Token developer/deployer — in the Meme coin context, refers to the token contract creator; their holdings and history are important risk indicators |
| Bundler | Bundle trader — addresses that buy large amounts through bundled transactions at token launch; may be insiders or manipulators |
| Sniper | Sniper — bot addresses that auto-buy tokens instantly at launch; concentrated holdings may create sell pressure |
| Honeypot | Malicious token contract that can only be bought but not sold (or has extremely high sell tax) |
| Slippage | Difference between expected and actual execution price; worse liquidity means higher slippage |
| lamports | Smallest unit of SOL, 1 SOL = 1,000,000,000 lamports |
| Native SOL | SOL native token address |
| WSOL | Wrapped SOL (So11...112), SPL Token wrapped form of SOL, cannot be used as swap --from |
| 术语 | 定义 |
|---|---|
| Ranking Exit | 排名退出 — 当代币跌出涨幅榜前20名时自动全额卖出仓位,在动量消失时离场 |
| Slot Guard | 基于排行榜数据的13项基础指标预检查,无需额外API调用 |
| Advanced Safety | 使用 |
| Holder Risk | 使用 |
| Momentum Score | 动量评分(0-125),根据买入占比、价格变化、交易者数量、流动性和安全加分计算得出 |
| Quick Stop | 快速止损 — 持仓N分钟且亏损超过N%时触发(需同时满足两个条件) |
| Trailing Stop | 追踪止损 — 盈利达到激活阈值后,从峰值回撤超过阈值时触发卖出 |
| Unconfirmed Position | 未确认仓位 — 当交易确认超时创建的待处理仓位,需多次余额检查后才能丢弃 |
| Fail-Closed | 故障关闭 — 当安全检查API失败时,视为不安全,不执行买入操作 |
| TEE | 可信执行环境(Trusted Execution Environment) — onchainos签名在安全飞地内执行 |
| Agentic Wallet | onchainos托管钱包,私钥存储在TEE内,绝不会离开安全环境 |
| DAILY_LOSS_LIMIT | 每日亏损比例(相对于总预算);触发后当日停止所有买入操作 |
| MC / MCAP | 市值(Market Cap) — 代币总供应量×当前价格,衡量代币规模 |
| LP | 流动性池(Liquidity Pool) — DEX上用于交易的代币对池;LP越大,滑点越低 |
| LP Burn | LP销毁 — 永久销毁LP代币,确保开发者无法提取流动性 |
| Rug Pull | 跑路(Rug Pull) — 开发者突然提取流动性或抛售全部持仓,导致代币价格归零的恶意行为 |
| Dev | 开发者(Developer) — 在Meme币语境下指代币合约创建者;其持仓和历史记录是重要的风险指标 |
| Bundler | 打包交易者(Bundler) — 在代币上线时通过批量交易大量买入的地址,可能是内部人员或操纵者 |
| Sniper | 狙击机器人(Sniper) — 在代币上线时自动瞬间买入的机器人地址;集中持仓可能带来抛售压力 |
| Honeypot | 蜜罐(Honeypot) — 只能买入无法卖出(或卖出税极高)的恶意代币合约 |
| Slippage | 滑点 — 预期执行价格与实际执行价格的差异;流动性越差,滑点越高 |
| lamports | SOL的最小单位,1 SOL = 1,000,000,000 lamports |
| Native SOL | SOL原生代币地址 |
| WSOL | 包装SOL(Wrapped SOL,地址为So11...112),是SOL的SPL代币形式,不能作为swap的--from参数 |