Install
openclaw skills install @0xcii/paper-ondo-hedge-botUse when the user asks to run the PaperTrade + ONDO neutral hedge bot, configure hedging parameters, check account status, close all positions, or register a PaperTrade Session Key. Also use for loss mining, PAPER token farming, or setting up the web control panel.
openclaw skills install @0xcii/paper-ondo-hedge-botA neutral hedging bot that mines PAPER tokens on PaperTrade while hedging with ONDO Perps.
Use this skill when:
Do NOT use this skill for:
pip install -r requirements.txt
/Users/caroline/Desktop/源代码/demo/paper中性脚本/
cd /Users/caroline/Desktop/源代码/demo/paper中性脚本
python web_server.py
Open http://localhost:8765/ in browser.
Panel features:
.envcp .env.example .env
Edit .env:
# Run mode: mock (no real trades) or real
HEDGE_MODE=mock
# PaperTrade wallet private key (0x-prefixed 64-char hex)
PAPER_WALLET_PRIVATE_KEY=0x...
# PaperTrade Session Key (optional, auto-registered if empty)
PAPER_SESSION_KEY=
# ONDO API credentials
ONDO_KEY_ID=ondoKeyId_xxx
ONDO_API_SECRET=ondoApiSecret_xxx
# Strategy parameters
HEDGE_SYMBOL=BTC
HEDGE_POSITION_SIZE=50
HEDGE_PAPER_LEVERAGE=10
HEDGE_ONDO_LEVERAGE=10
HEDGE_TARGET_MOVE_PCT=1.0
HEDGE_MAX_HOLD_SECONDS=3600
HEDGE_POLL_INTERVAL=10
HEDGE_MAX_CYCLES=200
HEDGE_DIRECTION=random
cd /Users/caroline/Desktop/源代码/demo/paper中性脚本
python main.py register
Copy the output PAPER_SESSION_KEY into .env.
python main.py status
python main.py
python main.py close-all
| Mode | HEDGE_MODE | Behavior |
|---|---|---|
| Mock | mock | Uses built-in mock clients, no real trades, no credentials needed |
| Real | real | Real trading, requires wallet key and ONDO API credentials |
Mock mode uses a fixed test wallet and outputs identical log format to real mode. Good for demos and learning.
| Parameter | Default | Description |
|---|---|---|
HEDGE_SYMBOL | BTC | Trading pair (BTC/ETH) |
HEDGE_POSITION_SIZE | 50 | Notional position size per side (USD) |
HEDGE_PAPER_LEVERAGE | 10 | PaperTrade leverage |
HEDGE_ONDO_LEVERAGE | 10 | ONDO leverage (BTC/ETH max 25) |
HEDGE_TARGET_MOVE_PCT | 1.0 | Price move % to trigger close |
HEDGE_MAX_HOLD_SECONDS | 3600 | Max hold time before forced close |
HEDGE_DIRECTION | random | Direction: random / paper_long / paper_short |
cd /Users/caroline/Desktop/源代码/demo/paper中性脚本
HEDGE_MODE=mock HEDGE_MAX_CYCLES=1 HEDGE_MAX_HOLD_SECONDS=10 python main.py
python web_server.py
# Open http://localhost:8765, click "Start Bot"
HEDGE_MODE=real
HEDGE_SYMBOL=BTC
HEDGE_POSITION_SIZE=100
HEDGE_PAPER_LEVERAGE=10
HEDGE_ONDO_LEVERAGE=10
python main.py
RuntimeError: Session Key 已过期,请重新注册
Run python main.py register to re-register.
ONDO API 错误: signature invalid
Verify ONDO_KEY_ID and ONDO_API_SECRET. If still failing, the ONDO API signature format may have changed — update _sign method in ondo_client.py.
Open intents have on-chain confirmation delay. The bot has a built-in 60s wait. If timeout, retry with python main.py close-all.
Ensure both PaperTrade wallet and ONDO account have enough USDC. PaperTrade needs at least HEDGE_POSITION_SIZE / HEDGE_PAPER_LEVERAGE * 1.5 USDC.
Ensure started via python web_server.py. The service uses -u unbuffered output; logs write to bot.log in real-time.
cd /Users/caroline/Desktop/源代码/demo/paper中性脚本
# Module import
python -c "import paper_client, ondo_client, hedge_bot, mock_clients, main; print('OK')"
# Mock mode full flow
HEDGE_MODE=mock HEDGE_MAX_CYCLES=1 HEDGE_MAX_HOLD_SECONDS=10 python main.py
# ONDO public API
python -c "
from ondo_client import OndoClient, OndoConfig
c = OndoClient(OndoConfig(key_id='t', api_secret='t'))
print('BTC:', c.get_mark_price('BTC-USD.P'))
"
exchange.papertrade.xyz and api.ondoperps.xyz.127.0.0.1 only, not exposed externally.| File | Purpose |
|---|---|
paper_client.py | PaperTrade client (EIP-712 signing, Session Key, open/close) |
ondo_client.py | ONDO Perps client (HMAC signing, market orders, queries) |
mock_clients.py | Mock clients for demo mode |
hedge_bot.py | Core hedge logic (dual open, monitor, close, stats) |
main.py | CLI entry point |
web_server.py | Web control panel backend (port 8765) |
index.html | Web control panel frontend |
.env.example | Config template |