Check a dataset before analysis
Find missing values, inconsistent formats, duplicates, and questions that could invalidate results.
An MCP server that provides on-demand skill loading for AI coding assistants.
---
name: okx-competition-6e277d2f8b5b
description: "5 AI trading agents compete live on OKX Demo (real prices). Evolutionary tournament β losers get replaced daily. Exchange-level stop-losses protect capital. Full autonomous trading system: strategy backtesting, agent evolution, cron automation. Use for: algorithmic trading research, paper trading, building toward live trading. Supports OKX Demo and Live modes."
version: 1.0.0
---
# OKX Competition Manager π
5 AI agents. 1 winner per day. Losers get replaced by better strategies.
Runs 24/7. You watch the leaderboard.
## How It Works
```
5 agents trade OKX Demo (real-time prices, zero risk)
β Every 5 minutes: fetch prices β calculate signals β place orders
β Exchange-level SL on every trade (survives bot crashes)
β Every 24 hours (07:00): evolve
β Rank 1-2: survive (proven)
β Rank 3: keep strategy, swap underperforming assets
β Rank 4-5: replaced by best_strategies from researcher
```
## Features
### 5 Competing Agents
Each agent has a unique strategy:
- **S&D Hunter** β Supply & Demand zones, trend-following
- **S&D Sniper** β Supply & Demand with tight SL
- **RSI Reverter** β RSI mean reversion with EMA filter
- **RSI Sniper** β Fast RSI confirmation (EMA20>50 bounce)
- **RSI Trend** β RSI trend-following with EMA50>200
### Evolutionary Tournament
```
Daily 07:00 β evolve_agents.js:
π₯ #1 β survive unchanged
π₯ #2 β survive unchanged
π₯ #3 β keep strategy, replace losing assets with backtest winners
4οΈβ£ #4 β full replacement from best_strategies/
5οΈβ£ #5 β full replacement from best_strategies/
```
### Exchange-Level Stop-Loss
Every order includes OKX native SL:
```js
slTriggerPx: entryPrice * (1 - stopLossPct)
slOrdPx: -1 // market SL
```
Bot can die. Positions stay protected.
### 3-Layer Position Safety
1. Skip trade if asset CT_VALS unknown (no sizing bugs)
2. Max 50% equity per agent per trade
3. $500 hard cap per single trade
## Setup
### Prerequisites
- OKX account (Demo or Live)
- OKX API key with trading permissions
- Node.js 18+
- OpenClaw (for cron automation)
### Step 1: OKX API Keys
**Demo Trading (recommended start):**
1. OKX β Trade β Demo Trading β Advanced Mode
2. API Management β Create API Key
3. Permissions: Read + Trade
**Live Trading:**
Same flow, but in live account.
### Step 2: Configure Secrets
Create `.secrets/okx.env`:
```
OKX_API_KEY=your_api_key
OKX_SECRET_KEY=your_secret_key
OKX_PASSPHRASE=your_passphrase
OKX_DEMO=true # set to false for live
```
### Step 3: Core Files
```
bybit-trading/ # historical name, OKX system
βββ competition_manager_okx.js β main competition loop
βββ helpers_okx.js β OKX API wrapper + indicators
βββ evolve_agents.js β daily evolution (generates pending_evolution.json)
βββ apply_evolution.js β apply evolution after Yossi approval
βββ agents_config.json β current 5 agents + strategies
βββ leaderboard_okx.json β live leaderboard (read by dashboard)
βββ competition_log_okx.txt β verbose trade log
βββ competition.lock β PID lockfile (prevents duplicates)
βββ strategies/
βββ supply_demand.js
βββ rsi_mean_reversion.js
βββ rsi_fast_confirm.js
βββ rsi_trend_filter.js
```
### Step 4: CT_VALS Configuration
**Critical β wrong CT_VALS = wrong position size = losses**
In `helpers_okx.js`, configure contract values for each asset:
```js
const CT_VALS = {
'BTC-USDT-SWAP': 0.01,
'ETH-USDT-SWAP': 0.1,
'SOL-USDT-SWAP': 1,
'XRP-USDT-SWAP': 100,
'ADA-USDT-SWAP': 100,
'DOGE-USDT-SWAP': 1000,
'TRX-USDT-SWAP': 1000,
'LTC-USDT-SWAP': 1,
'LINK-USDT-SWAP': 1,
'BNBUSDT': 0.1,
};
```
Find the correct value: OKX API `/api/v5/public/instruments?instType=SWAP&instId=ASSET-USDT-SWAP`
### Step 5: Start the Competition
```bash
node competition_manager_okx.js
```
The competition will:
- Load agents from `agents_config.json`
- Run a 5-minute loop
- Create `competition.lock` with PID
- Write results to `leaderboard_okx.json`
### Step 6: Automate with Task Scheduler (Windows)
Create `guardian.vbs` for zero-flash auto-restart:
```vbs
' guardian.vbs β starts competition if not running
Set oShell = CreateObject("WScript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")
lockFile = "C:\Users\User\.openclaw\workspace\bybit-trading\competition.lock"
If oFS.FileExists(lockFile) Then
pid = Trim(oFS.OpenTextFile(lockFile,1).ReadLine())
' Check if PID is alive (WMI)
strCmd = "powershell -Command ""(Get-Process -Id " & pid & " -ErrorAction SilentlyContinue) -ne $null"""
result = oShell.Run(strCmd, 0, True)
If result = 0 Then WScript.Quit ' Still running
End If
' Start competition
oShell.Run "cmd /c node C:\Users\User\.openclaw\workspace\bybit-trading\competition_manager_okx.js >> competition.log 2>&1", 0, False
```
Register in Task Scheduler: every 2 minutes, run as user, run whether logged in or not.
## Agents Config (agents_config.json)
```json
{
"agents": [
{
"id": 1,
"name": "S&D Hunter #1",
"strategy": "supply_demand",
"assets": ["BTC-USDT-SWAP", "ETH-USDT-SWAP", "SOL-USDT-SWAP"],
"timeframe": "5m",
"capital": 300,
"risk_per_trade_pct": 2
}
]
}
```
**Iron Rules:**
- `timeframe` = always `"5m"` (never change)
- `risk_per_trade_pct` = 2% maximum
- Every new asset β verify CT_VALS first
## Evolution System
### Generate Recommendations (automatic, daily 07:00)
```bash
node evolve_agents.js
```
Creates `pending_evolution.json` β does NOT modify agents_config.json.
### Review & Apply
Review `pending_evolution.json`, then:
```bash
node apply_evolution.js
```
Never auto-apply without human review β this is by design.
## Strategy Researcher Integration
Pair with the `strategy-researcher` skill for continuous strategy discovery:
```
strategy-researcher/
βββ run_nightly.js β 22:00-06:00 backtesting
βββ run_daytime.js β 07:00-21:30 backtesting
βββ best_strategies/ β JSON results β fed into evolve_agents.js
```
The researcher backtests hundreds of strategy/asset/parameter combinations overnight. Best performers go into the evolution pool.
## Live Dashboard
Serve `leaderboard_okx.json` to a web dashboard for real-time monitoring:
```js
// Simple Express server for dashboard
app.get('/api/leaderboard', (req, res) => {
res.json(JSON.parse(fs.readFileSync('bybit-trading/leaderboard_okx.json')));
});
```
## Going Live
When ready to trade real money:
1. 7 consecutive profitable days on Demo
2. P&L > 15% total
3. 30+ trades executed
4. Max drawdown < 10%
5. Zero CT_VALS sizing bugs
Then:
- Remove `OKX_DEMO=true` from `.secrets/okx.env`
- Replace Demo API keys with Live keys
- Start with $100-150
## KISS Principle
> Simple > Complex. Every extra indicator costs.
The best strategies here are dead simple:
- **RSI Fast Confirm**: EMA20>50 + RSI bounce from one candle. That's it.
- DOGE: PF=4.90, LTC: PF=2.90
- **Supply/Demand**: Price touches S/D zone + reversal candle.
- BTC 15m: PF=2.90, DD=0.69%
Don't add layers. Test first.
## Production Stats
Running 24/7 since 22.02.2026 on OKX Demo:
- Timeframe: 5m candles
- 19 tradeable assets
- Evolution: daily at 07:00
- Best single-day gain: +8.25% (RSI Reverter)
- System uptime: 99%+ (VBS guardian + Task Scheduler)
---
name: okx-competition-6e277d2f8b5b
description: "5 AI trading agents compete live on OKX Demo (real prices). Evolutionary tournament β losers get replaced daily. Exchange-level stop-losses protect capital. Full autonomous trading system: strategy backtesting, agent evolution, cron automation. Use for: algorithmic trading research, paper trading, building toward live trading. Supports OKX Demo and Live modes."
version: 1.0.0
---
# OKX Competition Manager π
5 AI agents. 1 winner per day. Losers get replaced by better strategies.
Runs 24/7. You watch the leaderboard.
## How It Works
```
5 agents trade OKX Demo (real-time prices, zero risk)
β Every 5 minutes: fetch prices β calculate signals β place orders
β Exchange-level SL on every trade (survives bot crashes)
β Every 24 hours (07:00): evolve
β Rank 1-2: survive (proven)
β Rank 3: keep strategy, swap underperforming assets
β Rank 4-5: replaced by best_strategies from researcher
```
## Features
### 5 Competing Agents
Each agent has a unique strategy:
- **S&D Hunter** β Supply & Demand zones, trend-following
- **S&D Sniper** β Supply & Demand with tight SL
- **RSI Reverter** β RSI mean reversion with EMA filter
- **RSI Sniper** β Fast RSI confirmation (EMA20>50 bounce)
- **RSI Trend** β RSI trend-following with EMA50>200
### Evolutionary Tournament
```
Daily 07:00 β evolve_agents.js:
π₯ #1 β survive unchanged
π₯ #2 β survive unchanged
π₯ #3 β keep strategy, replace losing assets with backtest winners
4οΈβ£ #4 β full replacement from best_strategies/
5οΈβ£ #5 β full replacement from best_strategies/
```
### Exchange-Level Stop-Loss
Every order includes OKX native SL:
```js
slTriggerPx: entryPrice * (1 - stopLossPct)
slOrdPx: -1 // market SL
```
Bot can die. Positions stay protected.
### 3-Layer Position Safety
1. Skip trade if asset CT_VALS unknown (no sizing bugs)
2. Max 50% equity per agent per trade
3. $500 hard cap per single trade
## Setup
### Prerequisites
- OKX account (Demo or Live)
- OKX API key with trading permissions
- Node.js 18+
- OpenClaw (for cron automation)
### Step 1: OKX API Keys
**Demo Trading (recommended start):**
1. OKX β Trade β Demo Trading β Advanced Mode
2. API Management β Create API Key
3. Permissions: Read + Trade
**Live Trading:**
Same flow, but in live account.
### Step 2: Configure Secrets
Create `.secrets/okx.env`:
```
OKX_API_KEY=your_api_key
OKX_SECRET_KEY=your_secret_key
OKX_PASSPHRASE=your_passphrase
OKX_DEMO=true # set to false for live
```
### Step 3: Core Files
```
bybit-trading/ # historical name, OKX system
βββ competition_manager_okx.js β main competition loop
βββ helpers_okx.js β OKX API wrapper + indicators
βββ evolve_agents.js β daily evolution (generates pending_evolution.json)
βββ apply_evolution.js β apply evolution after Yossi approval
βββ agents_config.json β current 5 agents + strategies
βββ leaderboard_okx.json β live leaderboard (read by dashboard)
βββ competition_log_okx.txt β verbose trade log
βββ competition.lock β PID lockfile (prevents duplicates)
βββ strategies/
βββ supply_demand.js
βββ rsi_mean_reversion.js
βββ rsi_fast_confirm.js
βββ rsi_trend_filter.js
```
### Step 4: CT_VALS Configuration
**Critical β wrong CT_VALS = wrong position size = losses**
In `helpers_okx.js`, configure contract values for each asset:
```js
const CT_VALS = {
'BTC-USDT-SWAP': 0.01,
'ETH-USDT-SWAP': 0.1,
'SOL-USDT-SWAP': 1,
'XRP-USDT-SWAP': 100,
'ADA-USDT-SWAP': 100,
'DOGE-USDT-SWAP': 1000,
'TRX-USDT-SWAP': 1000,
'LTC-USDT-SWAP': 1,
'LINK-USDT-SWAP': 1,
'BNBUSDT': 0.1,
};
```
Find the correct value: OKX API `/api/v5/public/instruments?instType=SWAP&instId=ASSET-USDT-SWAP`
### Step 5: Start the Competition
```bash
node competition_manager_okx.js
```
The competition will:
- Load agents from `agents_config.json`
- Run a 5-minute loop
- Create `competition.lock` with PID
- Write results to `leaderboard_okx.json`
### Step 6: Automate with Task Scheduler (Windows)
Create `guardian.vbs` for zero-flash auto-restart:
```vbs
' guardian.vbs β starts competition if not running
Set oShell = CreateObject("WScript.Shell")
Set oFS = CreateObject("Scripting.FileSystemObject")
lockFile = "C:\Users\User\.openclaw\workspace\bybit-trading\competition.lock"
If oFS.FileExists(lockFile) Then
pid = Trim(oFS.OpenTextFile(lockFile,1).ReadLine())
' Check if PID is alive (WMI)
strCmd = "powershell -Command ""(Get-Process -Id " & pid & " -ErrorAction SilentlyContinue) -ne $null"""
result = oShell.Run(strCmd, 0, True)
If result = 0 Then WScript.Quit ' Still running
End If
' Start competition
oShell.Run "cmd /c node C:\Users\User\.openclaw\workspace\bybit-trading\competition_manager_okx.js >> competition.log 2>&1", 0, False
```
Register in Task Scheduler: every 2 minutes, run as user, run whether logged in or not.
## Agents Config (agents_config.json)
```json
{
"agents": [
{
"id": 1,
"name": "S&D Hunter #1",
"strategy": "supply_demand",
"assets": ["BTC-USDT-SWAP", "ETH-USDT-SWAP", "SOL-USDT-SWAP"],
"timeframe": "5m",
"capital": 300,
"risk_per_trade_pct": 2
}
]
}
```
**Iron Rules:**
- `timeframe` = always `"5m"` (never change)
- `risk_per_trade_pct` = 2% maximum
- Every new asset β verify CT_VALS first
## Evolution System
### Generate Recommendations (automatic, daily 07:00)
```bash
node evolve_agents.js
```
Creates `pending_evolution.json` β does NOT modify agents_config.json.
### Review & Apply
Review `pending_evolution.json`, then:
```bash
node apply_evolution.js
```
Never auto-apply without human review β this is by design.
## Strategy Researcher Integration
Pair with the `strategy-researcher` skill for continuous strategy discovery:
```
strategy-researcher/
βββ run_nightly.js β 22:00-06:00 backtesting
βββ run_daytime.js β 07:00-21:30 backtesting
βββ best_strategies/ β JSON results β fed into evolve_agents.js
```
The researcher backtests hundreds of strategy/asset/parameter combinations overnight. Best performers go into the evolution pool.
## Live Dashboard
Serve `leaderboard_okx.json` to a web dashboard for real-time monitoring:
```js
// Simple Express server for dashboard
app.get('/api/leaderboard', (req, res) => {
res.json(JSON.parse(fs.readFileSync('bybit-trading/leaderboard_okx.json')));
});
```
## Going Live
When ready to trade real money:
1. 7 consecutive profitable days on Demo
2. P&L > 15% total
3. 30+ trades executed
4. Max drawdown < 10%
5. Zero CT_VALS sizing bugs
Then:
- Remove `OKX_DEMO=true` from `.secrets/okx.env`
- Replace Demo API keys with Live keys
- Start with $100-150
## KISS Principle
> Simple > Complex. Every extra indicator costs.
The best strategies here are dead simple:
- **RSI Fast Confirm**: EMA20>50 + RSI bounce from one candle. That's it.
- DOGE: PF=4.90, LTC: PF=2.90
- **Supply/Demand**: Price touches S/D zone + reversal candle.
- BTC 15m: PF=2.90, DD=0.69%
Don't add layers. Test first.
## Production Stats
Running 24/7 since 22.02.2026 on OKX Demo:
- Timeframe: 5m candles
- 19 tradeable assets
- Evolution: daily at 07:00
- Best single-day gain: +8.25% (RSI Reverter)
- System uptime: 99%+ (VBS guardian + Task Scheduler)
Imported from the listed AgentSkill.sh category. Complete supplied package files and notices are retained. Required external tools and credentials are not installed. No bundled code was executed during import. Individual agent task behavior has not been tested.