Trading Strategy Guide
Understanding how the Wealth bot generates profits through funding rate arbitrage
Overview
The Wealth bot implements a funding rate arbitrage strategy that profits from differences in funding rates across cryptocurrency exchanges while maintaining delta-neutral positions (no exposure to price movements).
Strategy Flow
stateDiagram-v2
[*] --> Monitoring: Start Bot
Monitoring --> Evaluating: Found Opportunity
Evaluating --> Monitoring: Below Threshold
Evaluating --> Executing: Meets Criteria
state Executing {
[*] --> PlacingLong
PlacingLong --> PlacingShort
PlacingShort --> Hedging
Hedging --> Completed
PlacingLong --> RollingBack: Failure
PlacingShort --> RollingBack: Failure
RollingBack --> RolledBack
}
Executing --> Active: Completed
Executing --> Monitoring: RolledBack
Active --> Closing: Exit Trigger
Closing --> Monitoring: Position Closed
note right of Active
Exit Triggers:
- Target profit reached
- Spread reversal
- Trailing stop
- Max duration
end note
What Are Funding Rates?
Funding rates are periodic payments exchanged between traders holding long and short positions in perpetual futures contracts. They keep the perpetual futures price aligned with the spot price.
- Positive funding rate: Longs pay shorts
- Negative funding rate: Shorts pay longs
- Payment frequency: Varies by exchange:
- Binance/Bybit: Every 8 hours (3× daily)
- HyperLiquid: Every 1 hour (24× daily)
- Aster: Every 4-8 hours depending on symbol (fetched automatically)
How the Strategy Works
The Arbitrage Opportunity
flowchart TB
subgraph Funding["Funding Rate Arbitrage"]
direction TB
A[Exchange A<br/>Low Funding Rate]
B[Exchange B<br/>High Funding Rate]
A -->|"LONG Position<br/>(Pay low funding)"| POS[Delta-Neutral<br/>Position]
B -->|"SHORT Position<br/>(Receive high funding)"| POS
POS -->|"Net Profit"| PROFIT["Spread = High Rate - Low Rate"]
end
style A fill:#c8e6c9
style B fill:#ffcdd2
style POS fill:#e3f2fd
style PROFIT fill:#fff9c4
Different exchanges often have different funding rates for the same asset. The bot exploits this by:
- Opening a LONG position on the exchange with the lower (or negative) funding rate
- Opening a SHORT position on the exchange with the higher funding rate
- Collecting the spread between the two rates every funding period
Delta-Neutral = Market-Neutral
Because you hold equal and opposite positions:
- If BTC price goes up: Your long profits, your short loses → net zero
- If BTC price goes down: Your long loses, your short profits → net zero
- Your only P&L comes from the funding rate difference
Visual Example
Exchange A (Binance): Funding Rate = +0.01% → You go LONG (receive 0.01%)
Exchange B (HyperLiquid): Funding Rate = +0.05% → You go SHORT (pay 0.05%)
Your position:
┌─────────────────────────────────────────────────────────────┐
│ LONG 0.1 BTC on Binance ←→ SHORT 0.1 BTC on HyperLiquid │
│ (Receive funding) (Pay funding) │
└─────────────────────────────────────────────────────────────┘
Net result per 8-hour period:
Receive: +0.01% on Binance
Pay: -0.05% on HyperLiquid
────────────────────────────
Wait... that's negative!
Actually, you want the OPPOSITE - go SHORT where rates are HIGH:
Pay: -0.01% on Binance (you're long, you pay positive funding)
Receive: +0.05% on HyperLiquid (you're short, you receive positive funding)
────────────────────────────
Net: +0.04% profit per 8 hours
Profit Calculation Example
Position size: $10,000 per side
Funding spread: 0.04% (4 basis points)
Leverage: 10x
Per funding period (every 8 hours):
Profit = $10,000 × 0.0004 = $4.00
Daily (3 funding periods):
Profit = $4.00 × 3 = $12.00
Monthly:
Profit = $12.00 × 30 = $360.00
Annualized APY:
APY = 0.04% × 3 × 365 = 43.8%
When Does the Bot Open Positions?
The bot continuously monitors funding rates and opens positions when:
- Spread exceeds threshold: The funding rate difference meets your configured minimum (default: 0.04%)
- Sufficient balance: You have enough collateral on both exchanges
- Position limits not reached: You haven't hit your maximum concurrent positions
- Positive expected value: After accounting for fees and slippage, the trade is profitable
When Does the Bot Close Positions?
Positions are closed automatically when:
- Target profit reached: Default 5% profit on position
- Spread reverses: The funding rate advantage disappears or reverses
- Trailing stop triggered: Profit retraces too much from peak (protects gains)
- Manual shutdown: You stop the bot gracefully
Risk Management Features
Delta-Neutral Protection
- Equal position sizes on both exchanges
- No exposure to price movements
- Profit comes only from funding rate spread
Slippage Protection
- Uses limit orders with timeout
- Falls back to market orders if needed
- Configurable maximum slippage tolerance
Trailing Stop Loss
- Activates after reaching profit threshold (default: 3%)
- Locks in minimum profit (default: 2%)
- Closes if profit retraces too much from peak
Atomic Execution
- Opens both legs simultaneously
- If one leg fails, the other is rolled back
- Prevents unhedged (risky) positions
Position Size Limits
- Maximum position size cap (USD)
- Maximum percentage of balance per trade
- Maximum concurrent positions
Configuring the Strategy
Key parameters in config.toml:
[trading]
# Minimum spread to open a position (0.04% = 4 basis points)
min_funding_spread = 0.04
# Position sizing
position_size_percent = 0.30 # Use 30% of available balance
max_position_usd = 10000 # Cap at $10,000 per position
max_concurrent_positions = 5 # Maximum open positions
# Profit targets
target_profit_percent = 0.05 # Close at 5% profit
[risk]
# Trailing stop configuration
trailing_stops_enabled = true
trailing_stop_activation = 0.03 # Activate at 3% profit
trailing_stop_distance = 0.40 # Allow 40% retracement
trailing_stop_min_lock = 0.02 # Lock in minimum 2%
# Slippage protection
max_slippage_bps = 50 # Maximum 0.5% slippage
Understanding Expected Value (EV)
Before opening a position, the bot calculates the expected value - whether the trade will be profitable after costs:
flowchart LR
subgraph EV["Expected Value Calculation"]
SPREAD[Funding Spread] --> GROSS[Gross EV]
TIME[Time Weight] --> GROSS
GROSS --> NET[Net EV]
FEES[Entry + Exit Fees] --> NET
SLIP[Slippage Estimate] --> NET
NET --> DECISION{EV > Threshold?}
DECISION -->|Yes| TRADE[Execute Trade]
DECISION -->|No| SKIP[Skip Opportunity]
end
style GROSS fill:#e8f5e9
style NET fill:#fff3e0
style TRADE fill:#c8e6c9
style SKIP fill:#ffcdd2
Expected Value = (Funding Spread × Time Weight) - (Entry Fees + Exit Fees + Slippage)
- Funding Spread: The rate difference between exchanges
- Time Weight: Reduced value if close to next funding payment
- Fees: Trading fees on both exchanges (entry and exit)
- Slippage: Expected price impact
The bot only opens positions with positive expected value.
Pair Selection Strategies
The bot supports multiple strategies for selecting which trading pairs to monitor:
Arbitrage-Based Selection (Recommended)
Sort pairs by their current funding rate spread to find the best arbitrage opportunities:
[instrument_discovery]
enabled = true
use_loris_rankings = true
loris_sort_by = "arbitrage" # Sort by funding spread (default)
How it works:
- For each symbol, finds the exchange with the lowest rate (go long) and highest rate (go short)
- Calculates the spread:
short_rate - long_rate - Ranks symbols by spread size (highest first)
- Prioritizes pairs with immediate profit potential
Best for: Active traders seeking maximum returns
Liquidity-Based Selection
Sort pairs by open interest rank to prioritize the most liquid markets:
[instrument_discovery]
enabled = true
use_loris_rankings = true
loris_sort_by = "oi_rank" # Sort by liquidity
How it works:
- Uses Binance open interest rankings as a proxy for liquidity
- Lower rank = more liquid (BTC is usually rank 1)
- Prioritizes easy entry/exit with minimal slippage
Best for: Conservative traders, larger position sizes
Volume-Based Selection
Sort pairs by 24h trading volume using direct exchange APIs:
[instrument_discovery]
enabled = true
use_loris_rankings = false # Use exchange APIs
How it works:
- Fetches 24h volume from each exchange directly
- Ranks pairs by trading activity
- No third-party data dependency
Best for: Traders who prefer direct data sources
Supported Exchanges
| Exchange | Funding Interval | Max Leverage | Notes |
|---|---|---|---|
| Binance Futures | 8 hours | 125x | Most liquid |
| Bybit Perpetuals | 4-8 hours* | 100x | UTA required |
| HyperLiquid | 1 hour | 50x | 24× daily funding |
| Aster Futures | 4-8 hours* | 125x | Per-symbol intervals |
*Bybit and Aster funding intervals vary per symbol. The bot automatically fetches per-symbol intervals via API at startup, refreshes every 4 hours, and receives real-time updates from WebSocket streams.
Note: HyperLiquid's hourly funding means more frequent profit collection but requires different EV calculations.
Frequently Asked Questions
What happens if one exchange goes down?
The bot monitors connectivity and will:
- Alert you to connection issues
- Prevent new positions from opening
- Existing positions remain open (both legs on different exchanges)
Can I lose money?
While the strategy is market-neutral, risks include:
- Fee costs: If spread narrows before covering fees
- Liquidation: If leverage is too high and price moves sharply
- Exchange risk: Counterparty risk on centralized exchanges
- Execution risk: Slippage during entry/exit
How much capital do I need?
Minimum recommended: $1,000 per exchange ($2,000 total)
With leverage, you can control larger positions:
- $1,000 at 10x = $10,000 position size
- Required margin = Position / Leverage + Safety Buffer
What's a good minimum spread to trade?
- Conservative: 0.05% (5 basis points) - fewer trades, higher quality
- Moderate: 0.04% (4 basis points) - balanced approach
- Aggressive: 0.03% (3 basis points) - more trades, lower margins
How often are there opportunities?
This varies by market conditions:
- High volatility: More funding rate divergence = more opportunities
- Low volatility: Rates converge = fewer opportunities
- Typical: 2-5 high-quality opportunities per day
See Also
- Configuration Guide - Detailed parameter reference
- Getting Started - Initial setup
- Monitoring Guide - Track your positions
- Troubleshooting - Common issues