Trading Tournament 🏆
Run autonomous multi-agent trading competitions where AI strategies compete against each other with real market data.
What It Does
- - 5 agents compete simultaneously on OKX Demo (or Live)
- Every 5 minutes: each agent analyzes candles, indicators, and decides to enter/exit
- Daily evolution at 07:00: top 2 survive, bottom 2 get replaced by better strategies
- Exchange-level stop-losses: positions are protected even if the bot crashes
- 3-layer position sizing protection: unknown assets skipped, 50% equity cap, $500 hard max
Architecture
CODEBLOCK0
Strategies Included
- 1. Supply & Demand — Identifies accumulation/distribution zones, enters on retests
- RSI Mean Reversion — Overbought/oversold with EMA trend filter
- RSI Fast Confirm — 1-bar bounce confirmation with tight EMA alignment
- RSI Trend Filter — Long-period EMA filter with standard RSI levels
Safety Features
| Layer | Protection | What Happens |
|---|
| 1 | CT_VALS lookup | Unknown asset → SKIP (never enter blind) |
| 2 |
50% equity cap | Max position = half of agent's capital |
| 3 | $500 hard cap | Absolute maximum notional per trade |
| 4 | Exchange SL | Stop-loss on OKX itself (survives bot crash) |
| 5 | Guardian | Windows Task checks every minute, restarts if dead |
Setup
Prerequisites
- - OKX account (Demo or Live)
- API Key + Secret + Passphrase
- Node.js 18+
Quick Start
- 1. Copy
bybit-trading/ folder to your workspace - Create
.secrets/okx.env:
OKX_API_KEY=your_key
OKX_API_SECRET=your_secret
OKX_PASSPHRASE=your_passphrase
- 3. Edit
agents_config.json with your preferred strategies and assets - Run: INLINECODE3
Cron Setup (recommended)
Add a Guardian cron or Windows Task that checks competition_log_okx.txt freshness every minute. If log hasn't updated in 6 minutes → kill and restart.
Evolution Rules
Daily at 07:00:
- - 🥇 Rank 1 → Survives (strategy + assets)
- 🥈 Rank 2 → Survives (strategy + assets)
- 🥉 Rank 3 → Strategy stays, assets rotate to better performers
- 4️⃣ Rank 4 → Fully replaced from beststrategies pool
- 5️⃣ Rank 5 → Fully replaced from beststrategies pool
Criteria for new agents: PF > 1.5, DD < 25%, min 5 backtested trades.
Live Trading Checklist
Before going live with real money:
- - [ ] 7 days continuous run without crashes
- [ ] P&L > 15% on demo
- [ ] 30+ trades for top 3 agents
- [ ] Max drawdown < 10%
- [ ] 0 sizing bugs
- [ ] Exchange-level SL verified on all new positions
Built With
- - Node.js + OKX REST API
- Technical indicators (EMA, RSI, ATR, Supply/Demand zones)
- Evolutionary selection algorithm
- Real-time Telegram alerts
交易锦标赛 🏆
运行自主多智能体交易竞赛,让AI策略使用真实市场数据相互竞争。
功能说明
- - 5个智能体同时竞争,在OKX模拟盘(或实盘)上运行
- 每5分钟:每个智能体分析K线、指标,并决定入场/离场
- 每日进化于07:00:前2名存活,后2名被更优策略替换
- 交易所级止损:即使机器人崩溃,持仓仍受保护
- 三层仓位规模保护:未知资产跳过,50%权益上限,500美元硬性上限
架构
┌─────────────┐
│ 竞赛管理器 │ ← 每5分钟运行一次
└──────┬──────┘
│
┌────┼────┬────┬────┐
│ │ │ │ │
v v v v v
智能体1 智能体2 智能体3 智能体4 智能体5
(S&D) (RSI) (S&D) (RSI) (RSI)
│
v
┌─────────┐
│ OKX API │ ← 实时价格,订单执行
└─────────┘
内置策略
- 1. 供需策略 — 识别积累/派发区域,在回测时入场
- RSI均值回归 — 超买/超卖结合EMA趋势过滤器
- RSI快速确认 — 1根K线反弹确认,配合紧密EMA排列
- RSI趋势过滤 — 长周期EMA过滤器配合标准RSI水平
安全功能
| 层级 | 保护措施 | 具体操作 |
|---|
| 1 | CT_VALS查询 | 未知资产 → 跳过(绝不盲目入场) |
| 2 |
50%权益上限 | 最大持仓 = 智能体资金的一半 |
| 3 | 500美元硬性上限 | 每笔交易绝对最大名义价值 |
| 4 | 交易所止损 | 在OKX本身设置止损(机器人崩溃仍有效) |
| 5 | 守护程序 | Windows任务每分钟检查,若崩溃则重启 |
设置
前置条件
- - OKX账户(模拟盘或实盘)
- API密钥 + 密钥 + 密码短语
- Node.js 18+
快速开始
- 1. 将bybit-trading/文件夹复制到工作区
- 创建.secrets/okx.env:
OKXAPIKEY=你的密钥
OKXAPISECRET=你的密钥
OKX_PASSPHRASE=你的密码短语
- 3. 编辑agentsconfig.json,设置你偏好的策略和资产
- 运行:node competitionmanager_okx.js
定时任务设置(推荐)
添加守护程序cron或Windows任务,每分钟检查competitionlogokx.txt的新鲜度。如果日志超过6分钟未更新 → 终止并重启。
进化规则
每日07:00:
- - 🥇 第1名 → 存活(策略+资产)
- 🥈 第2名 → 存活(策略+资产)
- 🥉 第3名 → 策略保留,资产轮换至表现更优者
- 4️⃣ 第4名 → 从最佳策略池完全替换
- 5️⃣ 第5名 → 从最佳策略池完全替换
新智能体标准:盈亏比 > 1.5,最大回撤 < 25%,最少5笔回测交易。
实盘检查清单
在投入真实资金前:
- - [ ] 连续运行7天无崩溃
- [ ] 模拟盘盈亏 > 15%
- [ ] 前3名智能体完成30+笔交易
- [ ] 最大回撤 < 10%
- [ ] 0个仓位规模错误
- [ ] 所有新持仓已验证交易所级止损
技术栈
- - Node.js + OKX REST API
- 技术指标(EMA、RSI、ATR、供需区域)
- 进化选择算法
- 实时Telegram提醒