@349/bybit
Bybit Skill
Trade on Bybit — one of the top derivatives exchanges — directly from Starchild.
Supports Spot and Linear Perpetuals (USDT-margined). Uses the bundled scripts/ccex_core.py engine.
Setup
1. Get your Bybit API Keys
- Log in to bybit.com
- Go to Account → API (or My Profile → API Management)
- Create API key — enable Read/Write for Spot and Derivatives
- Save your API key and secret
2. Add to environment
Add to workspace/.env:
BYBIT_API_KEY=your_api_key_here
BYBIT_SECRET=your_secret_here
3. Install dependencies
pip install --break-system-packages ccxt
What You Can Do
Market Data (No API key needed)
- Get current price / ticker
- View orderbook
- Candlestick OHLCV data
- List all markets
Account (API key required)
- Check spot and derivatives balances
- View open orders
- View order history
- View open positions (perpetuals)
Trading (API key required)
- Market orders
- Limit orders
- Stop market / stop limit
- Take profit orders
- Trailing stop (amount-based)
- TP + SL attached to entry order in one shot
- Futures orders with reduce-only
Workflow
ALWAYS follow this order:
- Check balance before trading
- Get current price
- Place order
- Verify via positions or open orders
How to Execute
python3 skills/bybit/scripts/ccex_core.py <action> --exchange bybit [options]
Examples
Get ETH/USDT price:
python3 skills/bybit/scripts/ccex_core.py ticker --exchange bybit --symbol ETH/USDT
Check balances:
python3 skills/bybit/scripts/ccex_core.py balance --exchange bybit
Buy 0.01 ETH at market:
python3 skills/bybit/scripts/ccex_core.py order --exchange bybit \
--symbol ETH/USDT --side buy --type market --amount 0.01
Limit buy ETH at $2,800:
python3 skills/bybit/scripts/ccex_core.py order --exchange bybit \
--symbol ETH/USDT --side buy --type limit --amount 0.01 --price 2800
Stop loss at $2,500:
python3 skills/bybit/scripts/ccex_core.py order --exchange bybit \
--symbol ETH/USDT --side sell --type stop --amount 0.01 --stop_price 2500
Trailing stop (amount-based, $50 trail):
python3 skills/bybit/scripts/ccex_core.py order --exchange bybit \
--symbol ETH/USDT --side sell --type stop --amount 0.01 --trailing_delta 50
Futures: Long 0.1 ETH perpetual:
python3 skills/bybit/scripts/ccex_core.py order --exchange bybit \
--symbol ETH/USDT --side buy --type market --amount 0.1 --futures
Close futures position (reduce-only):
python3 skills/bybit/scripts/ccex_core.py order --exchange bybit \
--symbol ETH/USDT --side sell --type market --amount 0.1 --futures --reduce_only
View open positions:
python3 skills/bybit/scripts/ccex_core.py position --exchange bybit --futures
Cancel order:
python3 skills/bybit/scripts/ccex_core.py cancel --exchange bybit \
--symbol ETH/USDT --order_id abc123
Bybit-Specific Notes
TP + SL Combo
Bybit supports attaching both a take profit AND stop loss to an entry order simultaneously — use the raw Bybit API via a custom params dict in the script. For simple stop or TP, the unified CCXT API handles it.
For combined TP+SL on entry, use this pattern in a custom script:
exchange.create_order("ETH/USDT", "market", "buy", 0.1, None, {
"takeProfit": "3200",
"stopLoss": "2500",
"tpTriggerBy": "LastPrice",
"slTriggerBy": "LastPrice",
})
Unified Account
Bybit uses a "Unified Trading Account" — spot, derivatives, and options share the same margin pool. CCXT handles this automatically.
OCO on Bybit
Bybit does not support native OCO. ccex-core simulates OCO with two separate orders and warns you to cancel one manually when the other fills.
Rate Limits
Bybit allows 10 requests/second (order endpoints). CCXT handles this automatically.
Error Handling
| Error | Likely Cause | Fix |
|---|---|---|
10003 Invalid API key |
Wrong key in .env | Re-check BYBIT_API_KEY |
10006 Too many visits |
Rate limit hit | CCXT handles; reduce call frequency |
Insufficient balance |
Not enough funds | Check balance first |
110014 Reduce-only position does not exist |
No open position | Check positions first |