fox-strategy

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

FOX v0.1 — Autonomous Multi-Strategy Trading

FOX v0.1 — 自主多策略交易系统

The FOX hunts for its human. It scans, enters, exits, and rotates positions autonomously — no permission needed. When criteria are met, it acts. Speed is edge.
Forked from Wolf v7 + v7.1 data-driven optimizations. Independent strategies, state files, scripts, and cron jobs. Runs in parallel with Wolf without interference.

FOX系统如同猎手般自主运作。它会自主扫描行情、开仓、平仓、轮换仓位——无需人工许可。当满足条件时立即行动,速度就是优势。
基于Wolf v7 + v7.1分叉并进行数据驱动优化。拥有独立的策略、状态文件、脚本和Cron任务,可与Wolf系统并行运行且互不干扰。

Quick Start

快速开始

  1. Ensure Senpi MCP is connected (
    mcporter list
    should show
    senpi
    )
  2. Create a custom strategy wallet: use
    strategy_create_custom_strategy
    via mcporter
  3. Fund the wallet via
    strategy_top_up
    with your budget
  4. Run setup:
    python3 scripts/fox-setup.py --wallet 0x... --strategy-id UUID --budget 6500 --chat-id 12345
  5. Create the 8 OpenClaw crons using templates from
    references/cron-templates.md
  6. The FOX is hunting
To add a second strategy, run
fox-setup.py
again with a different wallet/budget. It adds to the registry.

  1. 确保已连接Senpi MCP(执行
    mcporter list
    应显示
    senpi
  2. 创建自定义策略钱包:通过mcporter执行
    strategy_create_custom_strategy
  3. 通过
    strategy_top_up
    为钱包注入资金
  4. 运行设置脚本:
    python3 scripts/fox-setup.py --wallet 0x... --strategy-id UUID --budget 6500 --chat-id 12345
  5. 使用
    references/cron-templates.md
    中的模板创建8个OpenClaw Cron任务
  6. FOX系统开始自主运作
若要添加第二个策略,再次运行
fox-setup.py
并指定不同的钱包/预算即可,新策略会被添加到注册表中。

Reference Files

参考文件

FileContents
references/learnings.mdProven results, key learnings, known bugs, trading discipline
references/cron-setup.mdCron config, race condition prevention, time-aware scheduling
references/cron-templates.mdReady-to-use cron mandates with proper systemEvent/agentTurn format
references/state-schema.mdJSON state file schemas (registry, trade counter, DSL state, scanner config)
references/api-tools.mdSenpi API tool quick reference
references/senpi-skill-guide.mdSenpi Skill Development Guide (conformance reference)

文件内容
references/learnings.md已验证结果、关键经验、已知问题、交易纪律
references/cron-setup.mdCron配置、竞态条件预防、时段感知调度
references/cron-templates.md可直接使用的Cron任务模板,包含正确的systemEvent/agentTurn格式
references/state-schema.mdJSON状态文件 schema(注册表、交易计数器、DSL状态、扫描器配置)
references/api-tools.mdSenpi API工具速查手册
references/senpi-skill-guide.mdSenpi Skill开发指南(合规参考)

Multi-Strategy Architecture

多策略架构

Strategy Registry (
fox-strategies.json
)

策略注册表(
fox-strategies.json

Central config holding all strategies. Created/updated by
fox-setup.py
.
fox-strategies.json
├── strategies
│   ├── fox-abc123 (Aggressive Momentum, 3 slots, 10x)
│   └── fox-xyz789 (Conservative XYZ, 2 slots, 7x)
└── global (telegram, workspace)
存储所有策略的中央配置文件,由
fox-setup.py
创建和更新。
fox-strategies.json
├── strategies
│   ├── fox-abc123 (激进动量策略,3个仓位,10倍杠杆)
│   └── fox-xyz789 (保守型XYZ策略,2个仓位,7倍杠杆)
└── global (Telegram、工作区配置)

Per-Strategy State

单策略独立状态

Each strategy gets its own state directory:
state/
├── fox-abc123/
│   ├── dsl-HYPE.json
│   └── dsl-SOL.json
└── fox-xyz789/
    ├── dsl-HYPE.json    # Same asset, different strategy, no collision
    └── dsl-GOLD.json
每个策略拥有独立的状态目录:
state/
├── fox-abc123/
│   ├── dsl-HYPE.json
│   └── dsl-SOL.json
└── fox-xyz789/
    ├── dsl-HYPE.json    # 同一资产,不同策略,无冲突
    └── dsl-GOLD.json

Signal Routing

信号路由

When a signal fires, it's routed to the best-fit strategy:
  1. Which strategies have empty slots?
  2. Does any strategy already hold this asset? (skip within strategy, allow cross-strategy)
  3. Which strategy's risk profile matches? (aggressive gets FIRST_JUMPs, conservative gets DEEP_CLIMBERs)
  4. Route to best-fit → open on that wallet → create DSL state in that strategy's dir
当交易信号触发时,会被路由至最匹配的策略:
  1. 哪些策略有空余仓位?
  2. 是否有策略已持有该资产?(同策略内跳过,允许跨策略持有)
  3. 哪个策略的风险偏好匹配?(激进策略接收FIRST_JUMP信号,保守策略接收DEEP_CLIMBER信号)
  4. 路由至最佳匹配策略→在对应钱包开仓→在该策略目录下创建DSL状态

Adding a Strategy

添加策略

bash
python3 scripts/fox-setup.py --wallet 0x... --strategy-id UUID --budget 6500 \
    --chat-id 12345 --name "Aggressive Momentum" --dsl-preset aggressive
This adds to the registry without disrupting running strategies. Disable with
enabled: false
in the registry.

bash
python3 scripts/fox-setup.py --wallet 0x... --strategy-id UUID --budget 6500 \
    --chat-id 12345 --name "Aggressive Momentum" --dsl-preset aggressive
该操作会将策略添加到注册表中,且不会影响正在运行的策略。可通过在注册表中设置
enabled: false
来禁用策略。

FOX v7 Changes Summary (from Wolf v7)

FOX v7 相较于Wolf v7的变更总结

1. Market Regime Refresh (4h)

1. 市场行情刷新(每4小时)

  • New cron job runs
    fox-market-regime.py
    every 4 hours
  • Saves output to
    market-regime-last.json
  • Provides fresh BEARISH/BULLISH/NEUTRAL classification
  • 新增Cron任务,每4小时运行
    fox-market-regime.py
  • 将输出保存至
    market-regime-last.json
  • 提供最新的熊市/牛市/中性行情分类

2. NEUTRAL Regime Support

2. 支持中性行情

  • BEARISH: SHORT only (unchanged)
  • BULLISH: LONG only (unchanged)
  • NEUTRAL: Both LONG and SHORT allowed if signal score ≥ 8 (higher bar)
  • NEUTRAL definition: market_bull < 60 AND market_bear < 60, OR overall confidence < 50
  • 熊市:仅允许做空(无变更)
  • 牛市:仅允许做多(无变更)
  • 中性:若信号评分≥8分(更高门槛),则允许做多和做空
  • 中性定义:market_bull < 60 且 market_bear < 60,或整体置信度 < 50

3. Scoring System (replaces "min 4 reasons")

3. 评分系统(替代“至少4个理由”规则)

  • FIRST_JUMP: +3 pts (still mandatory)
  • IMMEDIATE_MOVER: +2 pts
  • contribVelocity > 10: +2 pts
  • CONTRIB_EXPLOSION: +2 pts
  • DEEP_CLIMBER: +1 pt
  • Other reasons (RANK_UP, CLIMBING, ACCEL, STREAK): +1 pt each
  • BTC 1h bias alignment: +1 bonus pt
  • v0.1 TIME BONUS (04:00–14:00 UTC): +1 pt
  • v0.1 TIME PENALTY (18:00–02:00 UTC): -2 pts
  • Minimum 6 points to enter (8+ for NEUTRAL regime)
  • FIRST_JUMP:+3分(仍为必填项)
  • IMMEDIATE_MOVER:+2分
  • contribVelocity > 10:+2分
  • CONTRIB_EXPLOSION:+2分
  • DEEP_CLIMBER:+1分
  • 其他理由(RANK_UP、CLIMBING、ACCEL、STREAK):每项+1分
  • BTC 1小时趋势对齐:额外+1分
  • v0.1时段奖励(UTC 04:00–14:00):+1分
  • v0.1时段惩罚(UTC 18:00–02:00):-2分
  • 开仓最低要求6分(中性行情下需8分以上)

4. Tiered Margin System

4. 分层保证金系统

  • Max entries: 6 (flat, no dynamic slots)
  • Entries 1-2: $1450 margin, $1500 budget
  • Entries 3-4: $950 margin, $1000 budget
  • Entries 5-6: $450 margin, $500 budget
  • Scanner reads tier based on current entry count from
    fox-trade-counter.json
  • 最大持仓数:6笔(固定值,无动态仓位)
  • 第1-2笔持仓:1450美元保证金,1500美元预算
  • 第3-4笔持仓:950美元保证金,1000美元预算
  • 第5-6笔持仓:450美元保证金,500美元预算
  • 扫描器从
    fox-trade-counter.json
    读取当前持仓数以匹配对应层级

5. BTC 1h Bias Alignment

5. BTC 1小时趋势对齐

  • Check BTC hourly trend from regime data before entry
  • Aligned signals: +1 bonus point (BTC 1h BULLISH + signal LONG, or BTC 1h BEARISH + signal SHORT)
  • Conflicting signals: no penalty, no bonus (regime filter handles hard blocks)

  • 开仓前根据行情数据检查BTC小时级趋势
  • 趋势对齐信号:额外+1分(BTC 1小时牛市+做多信号,或BTC 1小时熊市+做空信号)
  • 趋势冲突信号:无惩罚也无奖励(行情过滤器会处理硬性限制)

v0.1 Optimizations (Data-Driven from 14 Live Trades: 2W/12L)

v0.1 数据驱动优化(基于14笔实盘交易:2胜12负)

These changes are derived from analyzing Wolf v7's live trading results. Every optimization has evidence from real trades.
这些变更均来自对Wolf v7实盘交易结果的分析,每一项优化都有真实交易数据支撑。

1. Tighter Absolute Floor (0.02/leverage → ~20% max ROE loss)

1. 更严格的绝对止损线(0.02/杠杆 → 最大ROE损失约20%)

Old (v7)New (v0.1)
Formula (LONG)
entry × (1 - 0.03/leverage)
entry × (1 - 0.02/leverage)
Formula (SHORT)
entry × (1 + 0.03/leverage)
entry × (1 + 0.02/leverage)
Max ROE loss~30%~20%
Evidence: NEAR lost 23.7% ROE, FARTCOIN 18.4% — both would have been capped earlier at 20%.
Config field:
phase1.retraceThreshold
(default:
0.02
)
旧版(v7)新版(v0.1)
做多公式
entry × (1 - 0.03/leverage)
entry × (1 - 0.02/leverage)
做空公式
entry × (1 + 0.03/leverage)
entry × (1 + 0.02/leverage)
最大ROE损失~30%~20%
数据支撑:NEAR代币损失了23.7%的ROE,FARTCOIN损失了18.4%——若使用新版规则,两者都会在损失20%时被止损。
配置字段
phase1.retraceThreshold
(默认值:
0.02

2. Aggressive Phase 1 Timing

2. 激进的第一阶段时间控制

RuleOld (v7)New (v0.1)
Hard timeout (never hits Tier 1)90 min30 min
Weak peak cut (peak ROE < 3%, declining)45 min15 min
Dead weight (never positive ROE)30 min10 min
Evidence: 100% of winners went positive within minutes. 100% of losers that started negative stayed negative.
Config fields:
phase1.hardTimeoutMin
(default:
30
),
phase1.weakPeakCutMin
(default:
15
),
phase1.deadWeightCutMin
(default:
10
)
Enforcement: These timing rules are checked by the DSL cron mandate (agent-level), NOT by the dsl-v5.py script. The agent reads
createdAt
from the DSL state file and applies timing logic after parsing dsl-v5.py output.
规则旧版(v7)新版(v0.1)
强制超时(未达到Tier 1)90分钟30分钟
弱势峰值止损(峰值ROE <3%且持续下跌)45分钟15分钟
无效仓位止损(从未实现正ROE)30分钟10分钟
数据支撑:100%的盈利仓位在数分钟内就实现了正收益,100%的亏损仓位从一开始就处于负收益状态且持续恶化。
配置字段
phase1.hardTimeoutMin
(默认值:
30
)、
phase1.weakPeakCutMin
(默认值:
15
)、
phase1.deadWeightCutMin
(默认值:
10
执行逻辑:这些时间规则由DSL Cron任务(Agent层面)检查,而非dsl-v5.py脚本。Agent会从DSL状态文件读取
createdAt
字段,并在解析dsl-v5.py输出后应用时间逻辑。

3. Green-in-10 Rule

3. 10分钟未盈利规则

New field in DSL state:
greenIn10
(default:
false
)
If a position never shows positive ROE within the first 10 minutes → tighten
absoluteFloor
to 50% of original distance from entry. This is a "tighten, don't close" rule — the 10min dead weight cut handles the actual close if it stays negative.
For positions that briefly went green then reversed, this rule does NOT apply.
Config field:
phase1.greenIn10TightenPct
(default:
50
— tighten floor to 50% of original distance)
DSL状态新增字段
greenIn10
(默认值:
false
若仓位在前10分钟内从未实现正ROE,则将
absoluteFloor
(绝对止损线)收紧至距开仓价原始距离的50%。这是一条“收紧止损而非平仓”的规则——若仓位持续亏损,10分钟无效仓位止损规则会触发平仓。
若仓位曾短暂盈利后回落,则不适用本规则。
配置字段
phase1.greenIn10TightenPct
(默认值:
50
——将止损线收紧至原始距离的50%)

4. Time-of-Day Scoring

4. 时段评分机制

Time Window (UTC)ModifierRationale
04:00–14:00+1 ptHistorically where winners occur
14:00–18:000 ptsNeutral window
18:00–02:00-2 pts0% win rate across 6 evening trades
02:00–04:000 ptsNeutral window
Effect: Evening entries effectively need score ≥ 8 to pass the 6-point threshold.
Config fields:
scoring.timeBonusHoursUTC
(default:
[4,14]
),
scoring.timePenaltyHoursUTC
(default:
[18,2]
),
scoring.timeBonusPts
(default:
1
),
scoring.timePenaltyPts
(default:
-2
)
UTC时段评分调整依据
04:00–14:00+1分历史数据显示盈利交易多发生在此时段
14:00–18:000分中性时段
18:00–02:00-2分6笔晚间交易胜率为0%
02:00–04:000分中性时段
影响:晚间开仓需达到8分以上才能满足6分的最低门槛。
配置字段
scoring.timeBonusHoursUTC
(默认值:
[4,14]
)、
scoring.timePenaltyHoursUTC
(默认值:
[18,2]
)、
scoring.timeBonusPts
(默认值:
1
)、
scoring.timePenaltyPts
(默认值:
-2

5. Rank Jump Minimum

5. 最小排名跃升阈值

New filter:
rankJumpThisScan ≥ 15
OR
contribVelocity > 15
Old rule: just needed
isFirstJump=true
(any 10+ rank jump from #25+). Now requires either a massive jump (≥15 ranks) or strong velocity (>15).
Evidence: Both winners had massive jumps. Small jumps (#30→#20, #35→#21) all lost.
Config fields:
filters.minRankJump
(default:
15
),
filters.minVelocityOverride
(default:
15
)
新增过滤器
rankJumpThisScan ≥ 15
contribVelocity > 15
旧规则:仅需
isFirstJump=true
(排名从25名之后跃升10名以上)。现在要求要么是大幅跃升(≥15名),要么是高速度(>15)。
数据支撑:两笔盈利交易均为大幅跃升,小幅跃升(如30→20、35→21)的交易全部亏损。
配置字段
filters.minRankJump
(默认值:
15
)、
filters.minVelocityOverride
(默认值:
15

6. Conviction-Scaled Phase 1 Tolerance (v7.2)

6. 基于信心度的第一阶段容忍度(v7.2)

Finding: Direction was right 85% of the time (11/13 trades) but we still lost $785 on correct-direction trades and left $8,000+ on the table. The problem is timing/stops, not signal quality.
Solution: Score at entry determines how much room Phase 1 gets. High-conviction trades survive initial volatility; low-conviction trades get cut fast.
ScoreAbsolute FloorHard TimeoutWeak PeakDead Weight
6-70.02/lev (~20%)30 min15 min10 min
8-90.025/lev (~25%)45 min20 min15 min
10+0.03/lev (~30%)60 min30 min20 min
Implementation: Entry score is stored in DSL state (
score
field). The DSL cron mandate reads the score and selects the matching tolerance tier from
phase1.convictionTiers
config. If no score is present, defaults to the 6-7 tier (tightest).
Config field:
phase1.convictionTiers
(array of
{minScore, retraceThreshold, hardTimeoutMin, weakPeakCutMin, deadWeightCutMin}
)
发现:85%的交易方向判断正确(13笔交易中有11笔),但我们仍在方向正确的交易中亏损了785美元,且错失了8000美元以上的盈利机会。问题出在止损时机而非信号质量。
解决方案:开仓时的评分决定第一阶段的容忍空间。高信心度交易可承受初始波动,低信心度交易则会被快速止损。
评分绝对止损线强制超时弱势峰值止损无效仓位止损
6-70.02/杠杆(约20%)30分钟15分钟10分钟
8-90.025/杠杆(约25%)45分钟20分钟15分钟
10+0.03/杠杆(约30%)60分钟30分钟20分钟
实现逻辑:开仓评分会被存储在DSL状态的
score
字段中。DSL Cron任务会读取该评分,并从
phase1.convictionTiers
配置中选择对应的容忍层级。若未存储评分,则默认使用6-7分的最严格层级。
配置字段
phase1.convictionTiers
(包含
{minScore, retraceThreshold, hardTimeoutMin, weakPeakCutMin, deadWeightCutMin}
的数组)

7. Re-Entry Rule (v7.2)

7. 重新开仓规则(v7.2)

When we exit a Phase 1 trade and the asset continues in our original direction, we can re-enter with guardrails.
Re-entry checklist (ALL must pass):
  1. Asset still in top 20 with same direction
  2. contribVelocity > 5
    (momentum continuing)
  3. Price has moved FURTHER in our original direction since exit
  4. Within 2 hours of original exit
  5. First attempt did NOT lose > 15% ROE (too volatile = skip)
  6. Score minimum: 5 pts (relaxed from 6 — direction already validated)
  7. isFirstJump
    NOT required (it already jumped once)
Sizing: 75% of normal margin tier (reduced risk on 2nd attempt)
State tracking: DSL state gets
isReentry: true
and
reentryOf: "<original_trade_id>"
. Trade counter logs
isReentry: true
.
Config fields:
reentry.enabled
(default:
true
),
reentry.marginPct
(default:
75
),
reentry.minScore
(default:
5
),
reentry.maxOriginalLossROE
(default:
15
),
reentry.windowMin
(default:
120
),
reentry.minContribVelocity
(default:
5
)

当我们在第一阶段平仓后,若资产仍沿原方向运行,可在防护规则下重新开仓。
重新开仓检查清单(全部需满足)
  1. 资产仍处于前20名且方向不变
  2. contribVelocity > 5
    (动量持续)
  3. 平仓后价格沿原方向进一步变动
  4. 距原平仓时间不超过2小时
  5. 首次开仓未损失超过15%的ROE(波动过大则跳过)
  6. 最低评分:5分(较6分放宽——方向已被验证)
  7. 无需满足
    isFirstJump
    条件(已发生过一次跃升)
仓位规模:为正常保证金层级的75%(降低第二次尝试的风险)
状态跟踪:DSL状态会添加
isReentry: true
reentryOf: "<original_trade_id>"
字段。交易计数器会记录
isReentry: true
配置字段
reentry.enabled
(默认值:
true
)、
reentry.marginPct
(默认值:
75
)、
reentry.minScore
(默认值:
5
)、
reentry.maxOriginalLossROE
(默认值:
15
)、
reentry.windowMin
(默认值:
120
)、
reentry.minContribVelocity
(默认值:
5

Entry Philosophy — THE Most Important Section

开仓理念 — 最重要的部分

Enter before the peak, not at the top.
Leaderboard rank confirmation LAGS price. When an asset jumps from #31→#16 in one scan, the price is moving NOW. By the time it reaches #7 with clean history, the move is over. Speed is edge.
Core principle: 2 reasons at rank #25 with a big jump = ENTER. 4+ reasons at rank #5 = SKIP (already peaked).

在峰值前开仓,而非在顶部开仓。
排行榜排名确认滞后于价格变动。当某资产在一次扫描中从31名跃升至16名时,价格正在实时变动。当它以清晰的历史记录升至第7名时,行情已经结束。速度就是优势。
核心原则:排名25名时拥有2个理由+大幅跃升=开仓。排名5名时拥有4个以上理由=跳过(已达峰值)。

Entry Signals — Priority Order

开仓信号 — 优先级顺序

1. FIRST_JUMP (Highest Priority)

1. FIRST_JUMP(最高优先级)

What: Asset jumps 10+ ranks from #25+ in ONE scan AND was not in previous scan's top 50 (or was at rank >= #30).
Action: Enter IMMEDIATELY. This is the money signal. Route to best-fit strategy with available slots.
Checklist:
  • isFirstJump: true
    in scanner output
  • v0.1 Rank jump minimum:
    rankJumpThisScan ≥ 15
    OR
    contribVelocity > 15
    (small jumps like #30→#20 all lost)
  • 2+ reasons is enough (don't require 4+)
  • vel > 0 is sufficient (velocity hasn't had time to build on a first jump)
  • Max leverage >= 7x (check
    max-leverage.json
    )
  • Slot available in target strategy (or rotation justified)
  • = 10 SM traders (crypto); for XYZ equities, ignore trader count
What to ignore:
  • Erratic rank history — the scanner excludes the current jump from erratic checks
  • Low velocity — first jumps haven't had time to build velocity
If CONTRIB_EXPLOSION accompanies it: Double confirmation. Even stronger entry.
定义:资产在一次扫描中从25名之后跃升10名以上,且在上一次扫描中未进入前50名(或排名≥30名)。
操作:立即开仓。这是核心盈利信号。路由至有空余仓位的最佳匹配策略。
检查清单
  • 扫描器输出中
    isFirstJump: true
  • v0.1最小排名跃升阈值
    rankJumpThisScan ≥15
    contribVelocity >15
    (如30→20的小幅跃升全部亏损)
  • 2个理由即可(无需4个以上)
  • vel>0即可(首次跃升还未积累足够速度)
  • 最大杠杆≥7倍(查看
    max-leverage.json
  • 目标策略有空余仓位(或有理由进行仓位轮换)
  • 至少10名SM交易者(加密货币;对于XYZ股票,忽略交易者数量)
可忽略项
  • 不稳定的排名历史——扫描器会在不稳定检查中排除当前跃升
  • 低速度——首次跃升还未积累足够速度
若伴随CONTRIB_EXPLOSION信号:双重确认,开仓信号更强。

2. CONTRIB_EXPLOSION

2. CONTRIB_EXPLOSION

What: 3x+ contribution increase in one scan from asset at rank #20+.
Action: Enter even if rank history looks "erratic." The contrib spike IS the signal regardless of prior rank bouncing.
Never downgraded for erratic history. Often accompanies FIRST_JUMP for double confirmation.
定义:排名20名之后的资产在一次扫描中贡献度增长3倍以上。
操作:即使排名历史“不稳定”也要开仓。贡献度飙升本身就是信号,与之前的排名波动无关。
永远不会因不稳定的排名历史被降级。常与FIRST_JUMP信号同时出现,形成双重确认。

3. DEEP_CLIMBER

3. DEEP_CLIMBER

What: Steady climb from #30+, positive velocity (>= 0.03), 3+ reasons, clean rank history.
Action: Enter when it crosses into top 20. Route to conservative strategy if available.
定义:从30名之后稳步攀升,速度为正(≥0.03),拥有3个以上理由,排名历史清晰。
操作:当进入前20名时开仓。若保守策略有空余仓位,则路由至保守策略。

4. NEW_ENTRY_DEEP

4. NEW_ENTRY_DEEP

What: Appears in top 20 from nowhere (wasn't in top 50 last scan).
Action: Instant entry.
定义:从上一次扫描的前50名之外直接进入前20名。
操作:立即开仓。

5. Opportunity Scanner (Score 175+)

5. 机会扫描器(评分175+)

Runs every 15min. v6 scanner with BTC macro context, hourly trend classification, and hard disqualifiers. Complements Emerging Movers as a secondary signal source for deeper technical analysis.

每15分钟运行一次。v6版本扫描器,包含BTC宏观环境、小时级趋势分类和硬性 disqualifier。作为新兴行情扫描器的补充,提供更深入的技术分析信号。

Anti-Patterns — When NOT to Enter

反模式 — 禁止开仓的情况

  • NEVER enter assets already at #1-10. That's the top, not the entry. Rank = what already happened.
  • NEVER wait for a signal to "clean up." By the time rank history is smooth and velocity is high, the move is priced in.
  • 4+ reasons at rank #5 = SKIP. The asset already peaked.
  • 2 reasons at rank #25 with a big jump = ENTER. The move is just starting.
  • Leaderboard rank != future price direction. Rank reflects past trader concentration. Price moves first, rank follows.
  • Negative velocity + no jump = skip. Slow bleeders going nowhere.
  • Oversold shorts (RSI < 30 + extended 24h move) = skip.

  • 绝对不要在资产已处于1-10名时开仓。那是顶部,不是开仓点。排名反映的是过去的情况。
  • 绝对不要等待信号“变得清晰”。当排名历史平滑、速度高时,行情已经被定价。
  • 排名5名时拥有4个以上理由=跳过。资产已达峰值。
  • 排名25名时拥有2个理由+大幅跃升=开仓。行情才刚刚开始。
  • 排行榜排名≠未来价格方向。排名反映的是过去的交易者集中度。价格先变动,排名随后跟进。
  • 负速度+无跃升=跳过。缓慢下跌的资产毫无机会。
  • 超卖做空(RSI<30+24小时持续变动)=跳过。

Late Entry Anti-Pattern

延迟开仓反模式

The pattern: Scanner fires FIRST_JUMP for ASSET at #25→#14. You hesitate. Next scan it's #10. Next scan #7 with 5 reasons. NOW it looks "safe." You enter. It reverses from #5.
The fix: Enter on the FIRST signal or don't enter at all. If you missed it, wait for the next asset. There's always another FIRST_JUMP coming.
Rule: If an asset has been in the top 10 for 2+ scans already, it's too late. Move on.

模式:扫描器为ASSET触发FIRST_JUMP信号(25→14名)。你犹豫了。下一次扫描它到了10名。再下一次到了7名,拥有5个理由。现在看起来“安全”了,你开仓了。它从5名开始反转。
解决方法:要么在第一个信号出现时开仓,要么完全放弃。如果错过了,等待下一个资产。总会有下一个FIRST_JUMP信号。
规则:若资产已连续2次扫描处于前10名,就太晚了。继续等待下一个机会。

Architecture — 8 Cron Jobs

架构 — 8个Cron任务

#JobIntervalSessionScriptPurpose
1Emerging Movers3minmain
scripts/fox-emerging-movers.py
Hunt FIRST_JUMP signals with v7 scoring
2DSL v5.3.13minisolated
dsl-v5.py
(per-strategy cron)
Trailing stop exits, HL SL sync
3SM Flip Detector5minisolated
scripts/fox-sm-flip-check.py
Conviction collapse cuts
4Watchdog5minisolated
scripts/fox-monitor.py
Per-strategy margin buffer, liq distances
5Portfolio Update15minisolated(agent-driven)Per-strategy PnL reporting
6Opportunity Scanner15minmain
scripts/fox-opportunity-scan-v6.py
4-pillar scoring, BTC macro, hourly trend
7Market Regime4hisolated
scripts/fox-market-regime.py
Regime classification
8Health Check10minisolated
scripts/fox-health-check.py
Orphan DSL, state validation
All scripts read
fox-strategies.json
and iterate all enabled Fox strategies.
See references/cron-setup.md for detailed cron configuration, race condition prevention, and time-aware scheduling.
序号任务执行间隔会话类型脚本用途
1新兴行情扫描3分钟main
scripts/fox-emerging-movers.py
基于v7评分机制捕捉FIRST_JUMP信号
2DSL v5.3.13分钟独立
dsl-v5.py
(单策略Cron)
追踪止损平仓、同步HL止损线
3SM反转检测器5分钟独立
scripts/fox-sm-flip-check.py
信心度崩溃时止损
4监控守护进程5分钟独立
scripts/fox-monitor.py
单策略保证金缓冲、清算距离检查
5投资组合更新15分钟独立(Agent驱动)单策略PnL报告
6机会扫描器15分钟main
scripts/fox-opportunity-scan-v6.py
4支柱评分、BTC宏观环境、小时级趋势
7市场行情检测4小时独立
scripts/fox-market-regime.py
行情分类
8健康检查10分钟独立
scripts/fox-health-check.py
孤立DSL检查、状态验证
所有脚本都会读取
fox-strategies.json
并遍历所有启用的Fox策略
详细的Cron配置、竞态条件预防和时段感知调度请参考references/cron-setup.md

Model Selection Per Cron — 3-Tier Approach

基于Cron的模型选择 — 3层级方法

TierRoleCronsExample Model IDs
PrimaryComplex judgment, multi-strategy routingEmerging Movers, Opportunity ScannerYour configured model (runs on main session)
MidStructured tasks, script output parsingDSL v5.3.1, Portfolio Update, Health Check, Market Regimemodel configured in OpenClaw
BudgetSimple threshold checks, binary decisionsSM Flip, Watchdogmodel configured in OpenClaw
Do NOT create crons yet — the main agent will set these up when activating the strategy.

层级角色对应Cron任务示例模型ID
Primary复杂判断、多策略路由新兴行情扫描、机会扫描器你配置的模型(运行在main会话)
Mid结构化任务、脚本输出解析DSL v5.3.1、投资组合更新、健康检查、市场行情检测OpenClaw中配置的模型
Budget简单阈值检查、二元决策SM反转检测、监控守护进程OpenClaw中配置的模型
暂时不要创建Cron任务——主Agent会在激活策略时自动设置。

Cron Setup

Cron设置

Critical: Crons are OpenClaw crons, NOT senpi crons. FOX uses two session types:
  • Main session (
    systemEvent
    ): Emerging Movers + Opportunity Scanner. These share the primary session context for accumulated routing knowledge.
  • Isolated session (
    agentTurn
    ): All others. Each runs in its own session — no context pollution, enables cheaper model tiers.
Key rules (per Senpi Skill Guide §7):
  • systemEvent
    uses
    "text"
    key;
    agentTurn
    uses
    "message"
    key — wrong key = silent failure
  • Budget/Mid mandates have explicit
    if/then
    per output field — never "apply rules from SKILL.md"
  • Slot guard pattern: check
    anySlotsAvailable
    BEFORE any entry
  • One set of crons — scripts iterate all strategies internally
See references/cron-templates.md for exact payloads.

关键提示:Cron任务是OpenClaw Cron,而非senpi Cron。FOX使用两种会话类型:
  • Main会话
    systemEvent
    ):新兴行情扫描 + 机会扫描器。这些任务共享主会话上下文,以积累路由知识。
  • 独立会话
    agentTurn
    ):其他所有任务。每个任务运行在独立会话中——无上下文污染,可使用更便宜的模型层级。
核心规则(来自Senpi Skill Guide §7)
  • systemEvent
    使用
    "text"
    字段;
    agentTurn
    使用
    "message"
    字段——字段错误会导致静默失败
  • Budget/Mid层级任务需为每个输出字段设置明确的
    if/then
    逻辑——绝不要使用“应用SKILL.md中的规则”
  • 仓位防护模式:开仓前先检查
    anySlotsAvailable
  • 仅需一组Cron任务——脚本会在内部遍历所有策略
具体的请求体请参考references/cron-templates.md

Autonomy Rules

自主运行规则

The FOX operates autonomously by default. The agent does NOT ask permission to:
  • Open a position when entry checklist passes
  • Close a position when DSL triggers or conviction collapses
  • Rotate out of weak positions into stronger signals
  • Cut dead weight (SM conv 0, negative ROE, 10+ min)
The agent DOES notify the user (via Telegram) after every action — but ONLY actions.
FOX默认以自主模式运行。Agent无需请求许可即可执行以下操作:
  • 当开仓检查清单满足时开仓
  • 当DSL触发或信心度崩溃时平仓
  • 从弱势仓位轮换至更强信号的仓位
  • 清理无效仓位(SM信心度0、负ROE、持仓10分钟以上)
Agent会在每次操作后(仅操作完成后)通过Telegram通知用户。

Notification Policy (Strict)

通知策略(严格执行)

ONLY send Telegram when:
  • Position OPENED (asset, direction, leverage, margin, score, reasons)
  • Position CLOSED (asset, direction, PnL, close reason, hold time)
  • Risk guardian triggered (gate closed, cooldown started, force close)
  • Copy trading alert (-20% drawdown, strategy inactive, auto-rotate fired)
  • Critical error (3+ consecutive DSL failures, MCP auth expired)
NEVER send Telegram for:
  • Scanner ran and found nothing (HEARTBEAT_OK silently)
  • Scanner found signals but all were filtered out
  • DSL checked positions and nothing changed
  • Health check passed
  • Watchdog checked margins and everything is fine
  • SM flip check found no flips
  • Any reasoning, thinking, or narration about what the agent considered
Rule: If you didn't open, close, or force-close a position, and nothing is broken, the user should not hear from you. Silence = everything is working.

仅在以下情况发送Telegram通知
  • 仓位开仓(资产、方向、杠杆、保证金、评分、理由)
  • 仓位平仓(资产、方向、PnL、平仓理由、持仓时间)
  • 风险守护进程触发(关闭仓位、启动冷却期、强制平仓)
  • 复制交易警报(回撤20%、策略停用、自动轮换触发)
  • 严重错误(连续3次以上DSL失败、MCP授权过期)
绝对不要在以下情况发送Telegram通知
  • 扫描器运行但未发现任何信号(静默输出HEARTBEAT_OK)
  • 扫描器发现信号但全部被过滤
  • DSL检查仓位但未发生任何变化
  • 健康检查通过
  • 监控守护进程检查保证金一切正常
  • SM反转检查未发现反转
  • 任何关于Agent思考过程的推理、叙述
规则:如果没有开仓、平仓或强制平仓操作,且系统无故障,用户不应收到通知。静默意味着一切正常。

Phase 1 Auto-Cut (v0.1 — Conviction-Scaled Timing)

第一阶段自动止损(v0.1 — 基于信心度的时间缩放)

Positions that never gain momentum get cut automatically. Timing is scaled by entry score (v7.2): high-conviction trades get more room, low-conviction trades get cut fast.
Default rules (score 6-7, configurable via
phase1
fields in DSL state):
  • 30-minute hard timeout (
    hardTimeoutMin: 30
    ). If ROE never hits Tier 1 (5%) in 30 min, close.
  • 15-minute weak peak cut (
    weakPeakCutMin: 15
    ). If peak ROE was < 3% and declining → close after 15 min.
  • Dead weight cut (REMOVED v1.1). Was cutting positions that would have worked. Hard timeout handles real duds.
  • Green-in-10 floor tightening (
    greenIn10TightenPct: 50
    ). If never green in 10 min but not yet cut → tighten absoluteFloor to 50% of original distance from entry.
Conviction scaling (v7.2):
ScoreFloorHard TimeoutWeak PeakDead Weight
6-70.02/lev30 min15 min10 min
8-90.025/lev45 min20 min15 min
10+0.03/lev60 min30 min20 min
The DSL cron mandate reads
score
from the DSL state file and applies the matching tier. No score = defaults to 6-7 tier.
Enforcement: These timing rules are applied by the DSL cron mandate (agent reads
createdAt
and
score
from state file), NOT by dsl-v5.py itself.
Why: Direction was right 85% of the time. We lost money because stops were too tight on high-conviction trades. Score-scaling gives good trades room to breathe while still cutting bad ones fast.

从未获得动量的仓位会被自动止损。时间控制基于开仓评分进行缩放(v7.2):高信心度交易拥有更多空间,低信心度交易则被快速止损。
默认规则(评分6-7,可通过DSL状态中的
phase1
字段配置)
  • 30分钟强制超时
    hardTimeoutMin: 30
    )。若30分钟内ROE从未达到Tier 1(5%),则平仓。
  • 15分钟弱势峰值止损
    weakPeakCutMin: 15
    )。若峰值ROE<3%且持续下跌→15分钟后平仓。
  • 无效仓位止损(v1.1已移除)。曾错误平仓了原本盈利的仓位。强制超时规则会处理真正的无效仓位。
  • 10分钟未盈利则收紧止损线
    greenIn10TightenPct: 50
    )。若10分钟内从未盈利但尚未被平仓→将absoluteFloor收紧至距开仓价原始距离的50%。
基于信心度的缩放(v7.2)
评分止损线强制超时弱势峰值止损无效仓位止损
6-70.02/杠杆30分钟15分钟10分钟
8-90.025/杠杆45分钟20分钟15分钟
10+0.03/杠杆60分钟30分钟20分钟
DSL Cron任务会从DSL状态文件读取
score
字段,并应用匹配的层级。若无评分,则默认使用6-7分的最严格层级。
执行逻辑:这些时间规则由DSL Cron任务(Agent从状态文件读取
createdAt
score
字段)应用,而非dsl-v5.py脚本本身。
原因:85%的交易方向判断正确。我们亏损是因为高信心度交易的止损线过紧。评分缩放机制让优质交易有足够的波动空间,同时仍能快速止损劣质交易。

Exit Rules

平仓规则

1. DSL v5.3.1 Mechanical Exit (Trailing Stops)

1. DSL v5.3.1 机械平仓(追踪止损)

All trailing stops handled automatically by DSL v5.3.1 per-strategy crons. SL synced to Hyperliquid for instant execution.
所有追踪止损由DSL v5.3.1单策略Cron任务自动处理。止损线同步至Hyperliquid以实现即时执行。

2. SM Conviction Collapse

2. SM信心度崩溃

Conv drops to 0 or 4→1 with mass trader exodus → instant cut.
信心度降至0或从4→1且大量交易者离场→立即平仓。

3. Dead Weight

3. 无效仓位

Conv 0, negative ROE, 10+ min → instant cut (v0.1: tightened from 30min).
信心度0、负ROE、持仓10分钟以上→立即平仓(v0.1:从30分钟收紧至10分钟)。

4. SM Flip

4. SM反转

Conviction 4+ in the OPPOSITE direction with 100+ traders → cut immediately.
信心度4+且方向相反,同时有100+交易者→立即平仓。

5. Race Condition Prevention

5. 竞态条件预防

When ANY job closes a position → immediately:
  1. Set DSL state
    active: false
    in
    dsl/{strategyId}/{ASSET}.json
    (or DSL v5.3.1 auto-reconciles via clearinghouse)
  2. Alert user
  3. Evaluate: empty slot in that strategy for next signal?

当任何任务平仓后→立即执行:
  1. dsl/{strategyId}/{ASSET}.json
    中设置DSL状态
    active: false
    (或DSL v5.3.1通过清算所自动协调)
  2. 通知用户
  3. 评估:该策略是否有空余仓位用于下一个信号?

DSL v5.3.1 — Trailing Stop System

DSL v5.3.1 — 追踪止损系统

Uses the official DSL v5.3.1 skill at
/data/workspace/skills/dsl-dynamic-stop-loss/
.
See that skill's SKILL.md for full details.
使用位于
/data/workspace/skills/dsl-dynamic-stop-loss/
的官方DSL v5.3.1 skill
。详细信息请参考该skill的SKILL.md。

Phase 1 (Pre-Tier 1): Absolute floor (v0.1 tightened)

第一阶段(未达Tier 1):绝对止损线(v0.1收紧)

  • LONG floor =
    entry × (1 - 0.02/leverage)
    — caps max loss at ~20% ROE (v0.1: was 0.03/~30%)
  • SHORT floor =
    entry × (1 + 0.02/leverage)
  • 2% retrace threshold, 3 consecutive breaches → close
  • Max duration: 30 minutes (v0.1: was 90min — see Phase 1 Auto-Cut above)
  • Green-in-10: If never positive ROE in 10min → floor tightens to 50% of original distance
  • 做多止损线 =
    entry × (1 - 0.02/leverage)
    — 最大损失限制在约20% ROE(v0.1:原0.03/~30%)
  • 做空止损线 =
    entry × (1 + 0.02/leverage)
  • 2%回撤阈值,连续3次触发→平仓
  • 最长持续时间:30分钟(v0.1:原90分钟——见上文第一阶段自动止损)
  • 10分钟未盈利:若10分钟内从未实现正ROE→止损线收紧至原始距离的50%

Phase 2 (Tier 1+): 9-Tier Aggressive Trailing

第二阶段(Tier 1+):9层级激进追踪止损

TierROE TriggerLock %Breaches
15%2%2
210%5%2
320%14%2
430%24%2
540%34%1
650%44%1
765%56%1
880%72%1
9100%90%1
Phase 2: 1.5% retrace threshold, 2 consecutive breaches required.
层级ROE触发阈值锁定比例连续触发次数
15%2%2
210%5%2
320%14%2
430%24%2
540%34%1
650%44%1
765%56%1
880%72%1
9100%90%1
第二阶段:1.5%回撤阈值,需连续2次触发。

DSL v5.3.1 State Creation (on position entry)

DSL v5.3.1 状态创建(开仓时)

Create directory
dsl/{strategyId}/
if needed. Write state file with ALL required fields:
json
{
  "active": true,
  "asset": "ASSET",
  "direction": "SHORT",
  "leverage": 10,
  "entryPrice": "<entry>",
  "size": "<size>",
  "wallet": "<strategy_wallet>",
  "strategyId": "<strategy_uuid>",
  "phase": 1,
  "phase1": {
    "retraceThreshold": 0.02,
    "consecutiveBreachesRequired": 3,
    "absoluteFloor": "<calculated>",
    "hardTimeoutMin": 30,
    "weakPeakCutMin": 15,
    "deadWeightCutMin": 10,
    "greenIn10TightenPct": 50
  },
  "greenIn10": false,
  "score": "<entry_score>",
  "isReentry": false,
  "reentryOf": null,
  "phase2TriggerTier": 0,
  "phase2": {
    "retraceThreshold": 0.015,
    "consecutiveBreachesRequired": 2
  },
  "tiers": [
    {"triggerPct": 5, "lockPct": 2},
    {"triggerPct": 10, "lockPct": 5},
    {"triggerPct": 20, "lockPct": 14},
    {"triggerPct": 30, "lockPct": 24},
    {"triggerPct": 40, "lockPct": 34},
    {"triggerPct": 50, "lockPct": 44},
    {"triggerPct": 65, "lockPct": 56},
    {"triggerPct": 80, "lockPct": 72},
    {"triggerPct": 100, "lockPct": 90}
  ],
  "currentTierIndex": -1,
  "tierFloorPrice": null,
  "highWaterPrice": "<entryPrice>",
  "floorPrice": "<absoluteFloor>",
  "currentBreachCount": 0,
  "createdAt": "<ISO 8601>"
}
absoluteFloor: LONG:
entry × (1 - 0.02/leverage)
, SHORT:
entry × (1 + 0.02/leverage)
. Caps max loss at ~20% ROE (v0.1: tightened from 0.03/~30%).
Filename: Main dex:
{ASSET}.json
. XYZ dex:
xyz--SYMBOL.json
(colon → double-dash).
若需要则创建目录
dsl/{strategyId}/
。写入包含所有必填字段的状态文件:
json
{
  "active": true,
  "asset": "ASSET",
  "direction": "SHORT",
  "leverage": 10,
  "entryPrice": "<entry>",
  "size": "<size>",
  "wallet": "<strategy_wallet>",
  "strategyId": "<strategy_uuid>",
  "phase": 1,
  "phase1": {
    "retraceThreshold": 0.02,
    "consecutiveBreachesRequired": 3,
    "absoluteFloor": "<calculated>",
    "hardTimeoutMin": 30,
    "weakPeakCutMin": 15,
    "deadWeightCutMin": 10,
    "greenIn10TightenPct": 50
  },
  "greenIn10": false,
  "score": "<entry_score>",
  "isReentry": false,
  "reentryOf": null,
  "phase2TriggerTier": 0,
  "phase2": {
    "retraceThreshold": 0.015,
    "consecutiveBreachesRequired": 2
  },
  "tiers": [
    {"triggerPct": 5, "lockPct": 2},
    {"triggerPct": 10, "lockPct": 5},
    {"triggerPct": 20, "lockPct": 14},
    {"triggerPct": 30, "lockPct": 24},
    {"triggerPct": 40, "lockPct": 34},
    {"triggerPct": 50, "lockPct": 44},
    {"triggerPct": 65, "lockPct": 56},
    {"triggerPct": 80, "lockPct": 72},
    {"triggerPct": 100, "lockPct": 90}
  ],
  "currentTierIndex": -1,
  "tierFloorPrice": null,
  "highWaterPrice": "<entryPrice>",
  "floorPrice": "<absoluteFloor>",
  "currentBreachCount": 0,
  "createdAt": "<ISO 8601>"
}
absoluteFloor:做多:
entry × (1 - 0.02/leverage)
,做空:
entry × (1 + 0.02/leverage)
。最大损失限制在约20% ROE(v0.1:从0.03/~30%收紧)。
文件名:主DEX:
{ASSET}.json
。XYZ DEX:
xyz--SYMBOL.json
(冒号替换为双连字符)。

DSL v5.3.1 Cron Management

DSL v5.3.1 Cron管理

One cron per strategy. Created when first position opens. Removed on
strategy_inactive
.
DSL_STATE_DIR=/data/workspace/dsl DSL_STRATEGY_ID={strategyId} PYTHONUNBUFFERED=1 python3 /data/workspace/skills/dsl-dynamic-stop-loss/scripts/dsl-v5.py
Schedule:
*/3 * * * *
(every 3 min), isolated session, mid-tier model.

每个策略对应一个Cron任务。首次开仓时创建,策略停用(
strategy_inactive
)时删除。
DSL_STATE_DIR=/data/workspace/dsl DSL_STRATEGY_ID={strategyId} PYTHONUNBUFFERED=1 python3 /data/workspace/skills/dsl-dynamic-stop-loss/scripts/dsl-v5.py
调度设置:
*/3 * * * *
(每3分钟一次),独立会话,Mid层级模型。

Opportunity Scanner v6

机会扫描器v6

4-stage funnel with 6 hard disqualifiers:
  1. Counter-trend on hourly (the "$346 lesson")
  2. Extreme RSI (<20 shorts, >80 longs)
  3. Counter-trend on 4h with strength >50
  4. Volume dying (<0.5x on both timeframes)
  5. Heavy unfavorable funding (>50% annualized)
  6. BTC macro headwind >30 points
Disqualified assets appear in output with
reason
and
wouldHaveScored
for transparency.

包含6个硬性 disqualifier的4阶段漏斗:
  1. 小时级逆势交易(“346美元教训”)
  2. 极端RSI(做空<20,做多>80)
  3. 4小时逆势且强度>50
  4. 成交量低迷(两个时间框架均<0.5倍)
  5. 不利资金费率过高(年化>50%)
  6. BTC宏观阻力>30点
被 disqualify的资产会在输出中显示
reason
wouldHaveScored
字段以保证透明度。

Budget Scaling v7 — Tiered Margin System

预算缩放v7 — 分层保证金系统

v7 uses tiered margin based on entry count (not budget-based slots):
Entry CountMargin per TradeBudget per StrategyLeverageNotes
1-2$1,450$1,50010xHigher margin for early entries
3-4$950$1,00010xMedium margin for mid entries
5-6$450$50010xLower margin for final entries
Max entries per day: 6 (flat limit, no dynamic slots)
How it works:
  1. Scanner reads current entry count from
    fox-trade-counter.json
  2. Finds matching tier from
    marginTiers
    array
  3. Uses that tier's margin/budget for position sizing
Minimum leverage: 7x. If max leverage for an asset is below 7x, skip it.
Auto-Delever: If a strategy's account drops below its
autoDeleverThreshold
→ reduce max slots by 1, close weakest in that strategy.

v7基于持仓数使用分层保证金(而非基于预算的动态仓位)
持仓数每笔交易保证金单策略预算杠杆说明
1-21450美元1500美元10倍早期持仓使用更高保证金
3-4950美元1000美元10倍中期持仓使用中等保证金
5-6450美元500美元10倍后期持仓使用更低保证金
每日最大持仓数:6笔(固定限制,无动态仓位)
工作原理
  1. 扫描器从
    fox-trade-counter.json
    读取当前持仓数
  2. marginTiers
    数组中匹配对应层级
  3. 使用该层级的保证金/预算进行仓位 sizing
最低杠杆:7倍。若资产的最大杠杆低于7倍,则跳过该资产。
自动降杠杆:若策略账户余额低于
autoDeleverThreshold
→最大仓位数减少1,平仓该策略中最弱的仓位。

Rotation Rules

仓位轮换规则

When slots are full in a strategy and a new FIRST_JUMP or IMMEDIATE fires:
  • Rotate if: new signal is FIRST_JUMP or has 3+ reasons + positive velocity AND weakest position in that strategy is flat/negative ROE with SM conv 0-1
  • Hold if: current position in Tier 2+ or trending up with SM conv 3+
  • Cross-strategy: If one strategy is full but another has slots, route to the available strategy instead of rotating

当策略仓位已满且新的FIRST_JUMP或IMMEDIATE信号触发时:
  • 轮换条件:新信号为FIRST_JUMP,或者拥有3个以上理由+正速度,且该策略中最弱的仓位为持平/负ROE且SM信心度0-1
  • 持有条件:当前仓位处于Tier 2+或趋势向上且SM信心度3+
  • 跨策略路由:若一个策略仓位已满但另一个策略有空余仓位,则将信号路由至有空余仓位的策略而非轮换

Position Lifecycle

仓位生命周期

Opening

开仓

  1. Signal fires → validate checklist → route to best-fit strategy
  2. create_position
    on that strategy's wallet (use
    leverageType: "ISOLATED"
    for XYZ assets)
  3. Create DSL v5.3.1 state file in
    dsl/{strategyId}/{ASSET}.json
  4. Ensure DSL v5.3.1 cron exists for this strategy (create if first position)
  5. Update
    fox-trade-counter.json
  6. Alert user
  1. 信号触发→验证检查清单→路由至最佳匹配策略
  2. 在该策略的钱包上执行
    create_position
    (XYZ资产使用
    leverageType: "ISOLATED"
  3. dsl/{strategyId}/{ASSET}.json
    中创建DSL v5.3.1状态文件
  4. 确保该策略的DSL v5.3.1 Cron任务存在(首次开仓时创建)
  5. 更新
    fox-trade-counter.json
  6. 通知用户

Closing

平仓

  1. Close via
    close_position
    (or DSL v5.3.1 auto-closes on breach/SL hit)
  2. DSL v5.3.1 script auto-deletes state file and reconciles via clearinghouse
  3. Alert user with strategy name for context
  4. On
    strategy_inactive
    output → remove the DSL v5.3.1 cron for that strategy
  5. Evaluate: empty slot in that strategy for next signal?
  6. Re-entry evaluation (v7.2): If closed from Phase 1, log exit details (asset, direction, exit price, ROE, exit time) for re-entry window tracking
  1. 通过
    close_position
    平仓(或DSL v5.3.1在触发止损/止损线命中时自动平仓)
  2. DSL v5.3.1脚本自动删除状态文件并通过清算所协调
  3. 通知用户并附上策略名称以提供上下文
  4. 当输出
    strategy_inactive
    时→删除该策略的DSL v5.3.1 Cron任务
  5. 评估:该策略是否有空余仓位用于下一个信号?
  6. 重新开仓评估(v7.2):若在第一阶段平仓,则记录平仓详情(资产、方向、平仓价、ROE、平仓时间)以追踪重新开仓窗口

Re-Entry (v7.2)

重新开仓(v7.2)

  1. Emerging Movers detects asset still in top 20 with same direction,
    contribVelocity > 5
  2. Validate: within 2h of original exit, original loss ≤ 15% ROE, price moved further in original direction
  3. Score ≥ 5 pts (relaxed threshold — direction already validated)
  4. Size at 75% of normal margin tier
  5. Create DSL state with
    isReentry: true
    ,
    reentryOf: "<original_trade_id>"
  6. Alert user: "RE-ENTRY: {ASSET} {DIR} — direction confirmed, 2nd attempt at 75% size"

  1. 新兴行情扫描器检测到资产仍处于前20名且方向不变,
    contribVelocity >5
  2. 验证:距原平仓时间不超过2小时,原损失≤15% ROE,价格沿原方向进一步变动
  3. 评分≥5分(门槛放宽——方向已被验证)
  4. 仓位规模为正常保证金层级的75%
  5. 创建DSL状态,设置
    isReentry: true
    reentryOf: "<original_trade_id>"
  6. 通知用户:“RE-ENTRY: {ASSET} {DIR} — 方向已确认,第二次尝试使用75%仓位规模”

Margin Types

保证金类型

  • Cross-margin for crypto (BTC, ETH, SOL, etc.)
  • Isolated margin for XYZ DEX (GOLD, SILVER, TSLA, etc.) — set
    leverageType: "ISOLATED"
    and
    dex: "xyz"
  • Same wallet holds both cross crypto + isolated XYZ side by side

  • 跨保证金:用于加密货币(BTC、ETH、SOL等)
  • 逐仓保证金:用于XYZ DEX(GOLD、SILVER、TSLA等)——设置
    leverageType: "ISOLATED"
    dex: "xyz"
  • 同一钱包可同时持有跨保证金加密货币仓位和逐仓保证金XYZ仓位

XYZ Equities

XYZ股票

  • Ignore trader count. XYZ equities often have low SM trader counts — this doesn't invalidate the signal.
  • Use reason count + rank velocity as primary quality filter instead.
  • Always use isolated margin (
    leverageType: "ISOLATED"
    ,
    dex: "xyz"
    ).
  • Check max leverage — many XYZ assets cap at 5x or 3x. If below 7x, skip.

  • 忽略交易者数量。XYZ股票的SM交易者数量通常较低——这不会 invalidate 信号。
  • 使用理由数量+排名速度作为主要质量过滤器。
  • 始终使用逐仓保证金
    leverageType: "ISOLATED"
    dex: "xyz"
    )。
  • 检查最大杠杆——许多XYZ资产的杠杆上限为5倍或3倍。若低于7倍,则跳过。

Token Optimization & Context Management

令牌优化与上下文管理

Model tiers: See Architecture table. Primary for main-session crons, Mid/Budget for isolated.
Heartbeat policy: If script output contains no actionable signals, output HEARTBEAT_OK immediately. Do not reason about what wasn't found.
Context isolation (multi-signal runs): Read
fox-strategies.json
ONCE per cron run. Build complete action plan before executing. Send ONE consolidated Telegram per run.
Skip rules: Skip redundant checks when data < 3 min old. If all slots full and no FIRST_JUMPs → skip scanner processing.

模型层级:见架构表。Main会话Cron任务使用Primary层级,独立会话任务使用Mid/Budget层级。
心跳策略:若脚本输出无 actionable 信号,立即输出HEARTBEAT_OK。无需解释未发现的内容。
上下文隔离(多信号运行):每次Cron运行时仅读取一次
fox-strategies.json
。在执行前构建完整的行动计划。每次运行仅发送一条整合的Telegram通知。
跳过规则:若数据不足3分钟,则跳过重复检查。若所有仓位已满且无FIRST_JUMP信号→跳过扫描器处理。

API Dependencies

API依赖

All MCP calls go through
fox_config.mcporter_call()
— no direct subprocess invocations. See references/api-tools.md for the full tool reference.
ActionToolUsed By
Create strategy wallet
strategy_create_custom_strategy
Setup
Fund wallet
strategy_top_up
Setup
Open position
create_position
Emerging Movers, Opp Scanner
Close position
close_position
DSL v5.3.1, SM Flip, Watchdog
Sync stop loss to HL
edit_position
DSL v5.3.1
Check positions/PnL
strategy_get_clearinghouse_state
Watchdog, Portfolio, Health Check
Check strategy status
strategy_get
DSL v5.3.1
Check open orders
strategy_get_open_orders
DSL v5.3.1
Smart money data
leaderboard_get_markets
Emerging Movers, SM Flip, Opp Scanner
Top traders
leaderboard_get_top
Opp Scanner
Asset candles
market_get_asset_data
Opp Scanner, Market Regime
Market prices
market_get_prices
DSL v5.3.1
All instruments
market_list_instruments
Opp Scanner, Setup
Never use:
dryRun: true
(actually executes),
strategy_close_strategy
(closes entire strategy irreversibly).

所有MCP调用均通过
fox_config.mcporter_call()
执行——无直接子进程调用。完整工具参考请见references/api-tools.md
操作工具使用方
创建策略钱包
strategy_create_custom_strategy
设置脚本
钱包充值
strategy_top_up
设置脚本
开仓
create_position
新兴行情扫描器、机会扫描器
平仓
close_position
DSL v5.3.1、SM反转检测器、监控守护进程
同步止损线至HL
edit_position
DSL v5.3.1
检查仓位/PnL
strategy_get_clearinghouse_state
监控守护进程、投资组合更新、健康检查
检查策略状态
strategy_get
DSL v5.3.1
检查挂单
strategy_get_open_orders
DSL v5.3.1
智能资金数据
leaderboard_get_markets
新兴行情扫描器、SM反转检测器、机会扫描器
顶级交易者
leaderboard_get_top
机会扫描器
资产K线
market_get_asset_data
机会扫描器、市场行情检测
市场价格
market_get_prices
DSL v5.3.1
所有交易品种
market_list_instruments
机会扫描器、设置脚本
禁止使用
dryRun: true
(会实际执行)、
strategy_close_strategy
(会不可逆地关闭整个策略)。

Scripts Reference

脚本参考

ScriptPurpose
scripts/fox-setup.py
Setup wizard — adds strategy to registry from budget
scripts/fox_config.py
Shared config loader — all Fox scripts import this
scripts/fox-emerging-movers.py
Emerging Movers v4 scanner (FIRST_JUMP, IMMEDIATE, CONTRIB_EXPLOSION)
scripts/fox-sm-flip-check.py
SM conviction flip detector (multi-strategy)
scripts/fox-monitor.py
Watchdog — per-strategy margin buffer + position health
scripts/fox-opportunity-scan-v6.py
Opportunity Scanner v6 (BTC macro, hourly trend, disqualifiers)
scripts/fox-health-check.py
Per-strategy orphan DSL / state validation
scripts/fox-market-regime.py
Market regime detector
脚本用途
scripts/fox-setup.py
设置向导——从预算创建并添加策略至注册表
scripts/fox_config.py
共享配置加载器——所有Fox脚本都会导入该模块
scripts/fox-emerging-movers.py
新兴行情扫描器v4(捕捉FIRST_JUMP、IMMEDIATE、CONTRIB_EXPLOSION信号)
scripts/fox-sm-flip-check.py
SM信心度反转检测器(多策略)
scripts/fox-monitor.py
监控守护进程——单策略保证金缓冲+仓位健康检查
scripts/fox-opportunity-scan-v6.py
机会扫描器v6(BTC宏观环境、小时级趋势、disqualifier)
scripts/fox-health-check.py
单策略孤立DSL检查、状态验证
scripts/fox-market-regime.py
市场行情检测器

State Files Reference

状态文件参考

FilePurpose
fox-strategies.json
Strategy registry (wallets, budgets, DSL config)
fox-trade-counter.json
Daily trade counter with tiered margin
fox-emerging-movers-history.json
Emerging movers scan history
market-regime-last.json
Latest market regime (shared, read-only)
max-leverage.json
Per-asset max leverage (shared)
dsl/{strategyId}/{ASSET}.json
DSL v5.3.1 per-position state
history/scan-history.json
Cross-scan momentum tracking
history/fox-scanner-config.json
Scanner threshold overrides
See references/state-schema.md for complete schemas.

文件用途
fox-strategies.json
策略注册表(钱包、预算、DSL配置)
fox-trade-counter.json
每日交易计数器,包含分层保证金信息
fox-emerging-movers-history.json
新兴行情扫描历史
market-regime-last.json
最新市场行情(共享、只读)
max-leverage.json
单资产最大杠杆(共享)
dsl/{strategyId}/{ASSET}.json
DSL v5.3.1单仓位状态
history/scan-history.json
跨扫描动量跟踪
history/fox-scanner-config.json
扫描器阈值覆盖配置
完整schema请参考references/state-schema.md

Known Limitations

已知限制

  • Watchdog blind spot for XYZ isolated: Can't see isolated position liquidation distances. XYZ positions rely on DSL.
  • Health check only sees crypto wallet: Total equity may differ from actual.
  • Scanner needs history for momentum: Cross-scan momentum requires at least 2 scans. First scan produces scored results without momentum data.
  • 监控守护进程对XYZ逐仓的盲区:无法查看逐仓仓位的清算距离。XYZ仓位依赖DSL进行止损。
  • 健康检查仅能查看加密货币钱包:总权益可能与实际不符。
  • 扫描器需要历史数据来计算动量:跨扫描动量需要至少2次扫描数据。首次扫描会生成评分结果,但无动量数据。