top-rank-tokens-sniper

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Top 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.
  1. 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.
  2. 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.
  3. 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.
  4. 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
    config.py
    is annotated with comments for easy customization.
  5. 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.
  6. Technical Risk: On-chain transactions are irreversible. Smart contracts may contain vulnerabilities. Network congestion may cause transaction delays or failures.
  7. 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.
  8. 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.
  9. 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.
  10. 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 (
MODE = "paper"
). After fully familiarizing yourself with the strategy logic and parameter behavior, then consider whether to switch to live trading.

本策略脚本、参数配置及所有相关文档仅用于教育研究和技术参考目的,不构成任何形式的投资建议、交易指导或财务推荐。
  1. 高风险警告:加密货币交易(尤其是链上Meme代币)风险极高。价格可能在数秒内大幅波动甚至归为零,您可能损失全部投资本金。
  2. 排行榜数据风险:排行榜排名数据可能被洗盘交易操纵,排名变化并不代表真实市场共识。基于排名做出的交易决策可能因数据失真而导致亏损。
  3. 参数仅供参考:本策略中的所有默认参数(止盈、止损、仓位大小、安全阈值等)均针对通用场景设置,不保证适用于任何特定市场环境。用户应根据自身风险承受能力、交易经验和市场判断调整所有参数。
  4. 用户自定义:鼓励用户深入理解每个参数的含义,并根据自身策略逻辑和风险偏好进行修改。
    config.py
    中的每个参数都附有注释,便于自定义配置。
  5. 收益不做保证:过往表现不代表未来结果。即使在回测中表现良好的参数,也可能因市场环境变化在实盘交易中失效。
  6. 技术风险:链上交易不可逆。智能合约可能存在漏洞,网络拥堵可能导致交易延迟或失败。
  7. 第三方依赖风险:本策略依赖第三方基础设施,包括onchainos CLI、OKX API和Solana网络。这些服务的可用性、准确性和稳定性不受策略作者控制。任何服务变更、中断或故障都可能导致策略失效或产生意外损失。
  8. 监管/法律风险:加密货币交易在部分国家和地区可能受到严格限制或禁止。用户在使用本策略前应了解并确保遵守所在司法辖区的所有适用法律法规。
  9. 税务风险:频繁交易可能产生大量应税事件。用户应了解并遵守当地关于加密货币交易收益申报和纳税的税法规定。
  10. 自行承担全部责任:本策略按“原样”提供,不提供任何明示或暗示的担保。使用本策略做出的所有交易决策及其后果均由用户自行承担。策略作者、开发者、分销商及其关联方不对任何直接、间接、偶然或特殊损失负责。
建议:首次使用请在模拟交易模式(
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
undefined
bash
undefined

Check 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路径下

undefined
undefined

2. Login to Agentic Wallet (TEE Signing)

2. 登录Agentic Wallet(TEE签名)

bash
undefined
bash
undefined

One-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):
PreferenceSTOP_LOSS_PCTQUICK_STOP_MINQUICK_STOP_PCTTP_TIERSMAX_HOLD_HOURSTRAILING_ACTIVATETRAILING_DROP
Conservative-102-5(5,0.30),(12,0.35),(25,0.35)185
Default-153-8(8,0.30),(20,0.35),(40,0.35)2108
Aggressive-255-12(12,0.30),(30,0.35),(60,0.35)41512
  • 🛡️ 保守型:快进快出,小止盈+严止损
  • ⚖️ 默认型:均衡配置(推荐)
  • 🔥 激进型:大止盈+宽止损
→ 参数映射(AI Agent写入config.py,无需展示给用户):
风险偏好STOP_LOSS_PCTQUICK_STOP_MINQUICK_STOP_PCTTP_TIERSMAX_HOLD_HOURSTRAILING_ACTIVATETRAILING_DROP
保守型-102-5(5,0.30),(12,0.35),(25,0.35)185
默认型-153-8(8,0.30),(20,0.35),(40,0.35)2108
激进型-255-12(12,0.30),(30,0.35),(60,0.35)41512

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:
  1. ⚠️ 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
  2. Ask for total budget in SOL (default 0.5 SOL)
  3. AI auto-calculates (let B = user's input budget):
    • TOTAL_BUDGET = B
    • BUY_AMOUNT = max(B × 0.10, 0.01)
  4. 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
  5. Set mode parameters:
    • MODE = "live"
    • PAUSED = False
  • A. 🧪 保持模拟交易模式,直接启动(默认推荐)
  • B. 💰 切换到实盘交易模式
选项A → 直接进入启动步骤。
选项B → 进入实盘交易子流程:
  1. ⚠️ 向用户确认: "实盘交易将使用真实SOL,损失不可逆。确认切换到实盘模式?"
    • 用户确认 → 继续
    • 用户拒绝 → 退回模拟交易模式
  2. 询问用户总预算(单位:SOL,默认0.5 SOL)
  3. AI自动计算(设B为用户输入的预算):
    • TOTAL_BUDGET = B
    • BUY_AMOUNT = max(B × 0.10, 0.01)
  4. 展示计算结果并向用户确认: "您的实盘配置:总预算X SOL,单笔交易Y SOL,每日亏损上限Z SOL。确认?"
    • 用户确认 → 写入config.py
    • 用户要求调整 → 返回步骤2
  5. 设置模式参数:
    • MODE = "live"
    • PAUSED = False

Launch

启动步骤

  1. Modify corresponding parameters in
    config.py
    based on user answers
  2. Set
    PAUSED = False
    (allow bot to run normally after interaction confirmation)
  3. Check prerequisites:
    onchainos --version
    ,
    onchainos wallet status
  4. Start bot:
    python3 ranking_sniper.py
  5. Show Dashboard link:
    http://localhost:3244
  6. Inform user: Currently in Paper mode. To switch to live, modify
    MODE = "live"
    in
    config.py
If the user says "use default config" or "just run it", only set
PAUSED = False
, leave everything else unchanged, and start in Paper mode.
  1. 根据用户回答修改config.py中的对应参数
  2. 设置
    PAUSED = False
    (交互确认后允许机器人正常运行)
  3. 检查前置条件:
    onchainos --version
    onchainos wallet status
  4. 启动机器人:
    python3 ranking_sniper.py
  5. 展示仪表盘链接:
    http://localhost:3244
  6. 告知用户:当前处于模拟交易模式,如需切换到实盘,请修改config.py中的
    MODE = "live"
如果用户说“使用默认配置”或“直接运行”,仅设置
PAUSED = False
,其余参数保持不变,并以模拟交易模式启动。

Special 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 the
MODE
value in config.py —
"paper"
for Paper trading,
"live"
for Live trading.
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
config.py
— no need to modify
ranking_sniper.py
.
所有可调整参数均在
config.py
— 无需修改
ranking_sniper.py

Common Adjustments

常见调整项

NeedModify in
config.py
Pause/resume trading
PAUSED = True/False
Adjust per-trade amount
BUY_AMOUNT = 0.05
Adjust total budget
TOTAL_BUDGET = 0.5
Adjust max positions
MAX_POSITIONS = 5
Adjust take profit
TP_TIERS = [(8,0.30),(20,0.35),(40,0.35)]
Adjust hard stop loss
STOP_LOSS_PCT = -15
Adjust quick stop
QUICK_STOP_MIN = 3
,
QUICK_STOP_PCT = -8
Adjust trailing stop
TRAILING_ACTIVATE = 10
,
TRAILING_DROP = 8
Adjust sell slippage
SLIPPAGE_SELL = 8
(normal exit),
SLIPPAGE_SELL_URGENT = 15
(urgent exit)
Adjust scan speed
POLL_INTERVAL = 10
(seconds)
MC range
MIN_MCAP = 50_000
,
MAX_MCAP = 10_000_000
Paper trading
MODE = "paper"
Dashboard port
DASHBOARD_PORT = 3244
Restart the bot for changes to take effect.

需求
config.py
中修改
暂停/恢复交易
PAUSED = True/False
调整单笔交易金额
BUY_AMOUNT = 0.05
调整总预算
TOTAL_BUDGET = 0.5
调整最大持仓数
MAX_POSITIONS = 5
调整止盈设置
TP_TIERS = [(8,0.30),(20,0.35),(40,0.35)]
调整硬性止损
STOP_LOSS_PCT = -15
调整快速止损
QUICK_STOP_MIN = 3
,
QUICK_STOP_PCT = -8
调整追踪止损
TRAILING_ACTIVATE = 10
,
TRAILING_DROP = 8
调整卖出滑点
SLIPPAGE_SELL = 8
(正常退出),
SLIPPAGE_SELL_URGENT = 15
(紧急退出)
调整扫描频率
POLL_INTERVAL = 10
(秒)
市值范围
MIN_MCAP = 50_000
,
MAX_MCAP = 10_000_000
模拟交易
MODE = "paper"
仪表盘端口
DASHBOARD_PORT = 3244
修改参数后需重启机器人生效。

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项检查,基于排行榜数据)

#CheckThreshold
1Min price change>= 15%
2Max price change<= 500%
3Liquidity>= $30,000
4Market cap floor>= $50,000
5Market cap ceiling<= $10M
6Holders>= 100
7Buy ratio>= 55%
8Unique traders>= 20
9BlacklistNot in SKIP_TOKENS/BLACKLIST
10Cooldown>= 30min since last sell
11Position cap< MAX_POSITIONS
12DedupNot already holding same token
13Daily lossDaily 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代币高级信息)

#CheckThreshold
S1Risk level<= 3
S2HoneypotNo honeypot tag
S3Top 10 concentration<= 40%
S4Dev holding<= 15%
S5Bundler holding<= 15%
S6LP burned>= 50%
S7Dev rug count<= 2
S8Sniper holding<= 15%
S9Internal tokenDefault pass
#检查项阈值
S1风险等级≤ 3
S2蜜罐检测无蜜罐标签
S3前10持仓集中度≤ 40%
S4开发者持仓占比≤ 15%
S5打包交易者持仓占比≤ 15%
S6LP销毁比例≥ 50%
S7开发者跑路次数≤ 2
S8狙击机器人持仓占比≤ 15%
S9内部代币默认通过

Level 3: Holder Risk (3 checks, onchainos token holders)

Level 3: Holder Risk(3项检查,基于onchainos代币持仓数据)

#CheckThreshold
H1Suspicious address holding<= 30%
H2Phishing addressesBlock (
BLOCK_PHISHING = True
)
H3Suspicious address count<= 10

#检查项阈值
H1可疑地址持仓占比≤ 30%
H2钓鱼地址拦截(
BLOCK_PHISHING = True
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层退出系统

PriorityExit TypeTrigger ConditionSell Ratio
EXIT 0Ranking ExitDropped out of Top 20 and held >= 1min100%
EXIT 1Hard Stop LossPnL <= -15%100%
EXIT 2Quick StopHeld >= 3min and PnL <= -8%100%
EXIT 3Trailing StopPeak PnL >= +10% then drawdown >= 8%100%
EXIT 4Time StopHeld >= 2h100%
EXIT 5Tiered 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

会话风险控制

RuleValue
Daily Loss Limit
DAILY_LOSS_LIMIT = 0.15
(ratio of TOTAL_BUDGET, i.e., stop for the day after 15% loss)
Consecutive Loss Pause3 times → pause 15min (
MAX_CONSEC_LOSS = 3
,
PAUSE_CONSEC_SEC = 900
)
Cumulative Loss Stop>= 0.10 SOL → stop trading (
SESSION_STOP_SOL = 0.10
)
Max Positions
MAX_POSITIONS = 5
Max Hold Time
MAX_HOLD_HOURS = 2
Cooldown
COOLDOWN_MIN = 30
(30 minutes after selling before buying the same token again)
Daily loss limit scales automatically with
TOTAL_BUDGET
(ratio fixed at 15%). Consecutive loss counter resets on a winning trade. Session risk control auto-resets on bot restart.

规则数值
每日亏损上限
DAILY_LOSS_LIMIT = 0.15
(总预算的比例,即亏损15%后当日停止交易)
连续亏损暂停连续亏损3次 → 暂停15分钟(
MAX_CONSEC_LOSS = 3
,
PAUSE_CONSEC_SEC = 900
累计亏损停止≥0.10 SOL → 停止交易(
SESSION_STOP_SOL = 0.10
最大持仓数
MAX_POSITIONS = 5
最长持仓时间
MAX_HOLD_HOURS = 2
冷却时间
COOLDOWN_MIN = 30
(卖出同一代币后需等待30分钟才能再次买入)
每日亏损上限会随
TOTAL_BUDGET
自动调整(比例固定为15%)。连续亏损计数器会在盈利交易后重置。会话风险控制会在机器人重启后自动重置。

Iron Rules (Must Not Be Violated)

铁则(不得违反)

  1. RPC balance 0 ≠ token doesn't exist (Solana RPC has severe latency). Unconfirmed positions require zeroCount >= 10 AND elapsed > 180s before discarding.
  2. Writing to positions.json requires holding
    _state_lock
    .
  3. When
    order_status()
    returns TIMEOUT, always create an unconfirmed position.
  4. Safety check API failure → Fail-Closed, do not buy.
  5. Rank Exit (EXIT 0) has the highest priority.
  6. Daily loss limit triggered → stop all buying for the day.
  7. GAS_RESERVE
    0.01 SOL is never spent on trades.

  1. RPC余额为0 ≠ 代币不存在(Solana RPC存在严重延迟)。未确认仓位需满足zeroCount ≥10且时间超过180秒后才能丢弃。
  2. 写入positions.json 必须持有
    _state_lock
    锁。
  3. order_status()
    返回TIMEOUT时,必须创建未确认仓位。
  4. 安全检查API失败 → 故障关闭(Fail-Closed),不得买入
  5. 排名退出(EXIT 0)拥有最高优先级
  6. 触发每日亏损上限 → 当日停止所有买入操作。
  7. GAS_RESERVE
    预留的0.01 SOL绝不会用于交易。

onchainos CLI Command Reference

onchainos CLI命令参考

#CommandPurpose
1
onchainos token trending --chain solana --sort-by 2 --time-frame 2
Leaderboard Top 20
2
onchainos token advanced-info --chain solana --address <addr>
Safety check data
3
onchainos token holders --chain solana --address <addr> --tag-filter <tag>
Holder risk
4
onchainos market prices --tokens 501:<addr1>,501:<addr2>,...
Batch prices
5
onchainos swap quote --from <from> --to <to> --amount <amt> --chain solana
Quote
6
onchainos swap swap --from <from> --to <to> --amount <amt> --chain solana --wallet <addr> --slippage <pct>
Trade
7
onchainos wallet addresses --chain 501
Solana address
8
onchainos wallet balance --chain 501
Balance
9
onchainos wallet contract-call --chain 501 --to <router> --unsigned-tx <callData>
TEE signing
10
onchainos wallet order-status --order-id <orderId>
Trade confirmation

#命令用途
1
onchainos token trending --chain solana --sort-by 2 --time-frame 2
获取排行榜前20名
2
onchainos token advanced-info --chain solana --address <addr>
获取安全检查数据
3
onchainos token holders --chain solana --address <addr> --tag-filter <tag>
检测持仓风险
4
onchainos market prices --tokens 501:<addr1>,501:<addr2>,...
批量获取价格
5
onchainos swap quote --from <from> --to <to> --amount <amt> --chain solana
获取交易报价
6
onchainos swap swap --from <from> --to <to> --amount <amt> --chain solana --wallet <addr> --slippage <pct>
执行交易
7
onchainos wallet addresses --chain 501
获取Solana地址
8
onchainos wallet balance --chain 501
获取钱包余额
9
onchainos wallet contract-call --chain 501 --to <router> --unsigned-tx <callData>
TEE签名
10
onchainos wallet order-status --order-id <orderId>
确认交易状态

Troubleshooting

故障排除

IssueSolution
"FATAL: onchainos CLI not found"Install onchainos and ensure it is in PATH
Dashboard won't openCheck if port 3244 is in use:
lsof -i:3244
Bot has no trade signalsLeaderboard may have no new entries; wait for changes
Login expiredRe-run
onchainos wallet login <email>
Live mode buy failsCheck SOL balance >= MIN_WALLET_BAL (0.06)

问题解决方案
"FATAL: onchainos CLI not found"安装onchainos并确保其已加入PATH
仪表盘无法打开检查端口3244是否被占用:
lsof -i:3244
机器人无交易信号排行榜可能没有新代币上榜,等待榜单更新
登录过期重新运行
onchainos wallet login <email>
实盘模式买入失败检查SOL余额是否≥MIN_WALLET_BAL(0.06)

Glossary

术语表

TermDefinition
Ranking ExitRanking Exit — automatically sell entire position when token drops out of the Top 20 gainers leaderboard; exit when momentum is lost
Slot Guard13 basic metric pre-checks based on leaderboard data, zero additional API calls
Advanced Safety9 deep safety checks using
onchainos token advanced-info
to obtain Dev/Bundler/LP data
Holder Risk3 holder risk checks using
onchainos token holders
to detect suspicious/phishing addresses
Momentum ScoreMomentum score (0-125), calculated from buy ratio, price change, trader count, liquidity, and safety bonuses
Quick StopQuick Stop — triggers when position is held for N minutes and loss exceeds N% (both conditions must be met)
Trailing StopTrailing Stop — triggers sell when profit reaches activation threshold then pulls back beyond threshold from peak
Unconfirmed PositionPending position created when trade confirmation times out; requires multiple balance checks before discarding
Fail-ClosedWhen safety check API fails, treat as unsafe and do not buy
TEETrusted Execution Environment — onchainos signing is performed inside a secure enclave
Agentic Walletonchainos managed wallet with private keys inside TEE, never leaving the secure environment
DAILY_LOSS_LIMITDaily loss ratio (of TOTAL_BUDGET); when triggered, all buying stops for the day
MC / MCAPMarket Cap — token total supply × current price, measuring token scale
LPLiquidity Pool — token pair pool on DEX for trading; larger LP means lower slippage
LP BurnPermanently burning LP tokens to ensure liquidity cannot be withdrawn by developers
Rug PullMalicious act where developers suddenly withdraw liquidity or dump all holdings, crashing the token price to zero
DevToken developer/deployer — in the Meme coin context, refers to the token contract creator; their holdings and history are important risk indicators
BundlerBundle trader — addresses that buy large amounts through bundled transactions at token launch; may be insiders or manipulators
SniperSniper — bot addresses that auto-buy tokens instantly at launch; concentrated holdings may create sell pressure
HoneypotMalicious token contract that can only be bought but not sold (or has extremely high sell tax)
SlippageDifference between expected and actual execution price; worse liquidity means higher slippage
lamportsSmallest unit of SOL, 1 SOL = 1,000,000,000 lamports
Native SOLSOL native token address
11111111111111111111111111111111
(32 ones), must be used as --from in swap
WSOLWrapped SOL (So11...112), SPL Token wrapped form of SOL, cannot be used as swap --from
术语定义
Ranking Exit排名退出 — 当代币跌出涨幅榜前20名时自动全额卖出仓位,在动量消失时离场
Slot Guard基于排行榜数据的13项基础指标预检查,无需额外API调用
Advanced Safety使用
onchainos token advanced-info
获取开发者/打包交易者/LP数据的9项深度安全检查
Holder Risk使用
onchainos token holders
检测可疑/钓鱼地址的3项持仓风险检查
Momentum Score动量评分(0-125),根据买入占比、价格变化、交易者数量、流动性和安全加分计算得出
Quick Stop快速止损 — 持仓N分钟且亏损超过N%时触发(需同时满足两个条件)
Trailing Stop追踪止损 — 盈利达到激活阈值后,从峰值回撤超过阈值时触发卖出
Unconfirmed Position未确认仓位 — 当交易确认超时创建的待处理仓位,需多次余额检查后才能丢弃
Fail-Closed故障关闭 — 当安全检查API失败时,视为不安全,不执行买入操作
TEE可信执行环境(Trusted Execution Environment) — onchainos签名在安全飞地内执行
Agentic Walletonchainos托管钱包,私钥存储在TEE内,绝不会离开安全环境
DAILY_LOSS_LIMIT每日亏损比例(相对于总预算);触发后当日停止所有买入操作
MC / MCAP市值(Market Cap) — 代币总供应量×当前价格,衡量代币规模
LP流动性池(Liquidity Pool) — DEX上用于交易的代币对池;LP越大,滑点越低
LP BurnLP销毁 — 永久销毁LP代币,确保开发者无法提取流动性
Rug Pull跑路(Rug Pull) — 开发者突然提取流动性或抛售全部持仓,导致代币价格归零的恶意行为
Dev开发者(Developer) — 在Meme币语境下指代币合约创建者;其持仓和历史记录是重要的风险指标
Bundler打包交易者(Bundler) — 在代币上线时通过批量交易大量买入的地址,可能是内部人员或操纵者
Sniper狙击机器人(Sniper) — 在代币上线时自动瞬间买入的机器人地址;集中持仓可能带来抛售压力
Honeypot蜜罐(Honeypot) — 只能买入无法卖出(或卖出税极高)的恶意代币合约
Slippage滑点 — 预期执行价格与实际执行价格的差异;流动性越差,滑点越高
lamportsSOL的最小单位,1 SOL = 1,000,000,000 lamports
Native SOLSOL原生代币地址
11111111111111111111111111111111
(32个1),在swap中必须作为--from参数
WSOL包装SOL(Wrapped SOL,地址为So11...112),是SOL的SPL代币形式,不能作为swap的--from参数