Overview
The Funding Farming Time-Based Strategy allows you to automatically open and close trades around funding rate events. This strategy helps capture funding payments with minimal market exposure by trading at precise times relative to funding periods.
You can configure the system to:
- Open trades before a funding event (e.g., 60 minutes before)
- Close trades shortly after funding is awarded (e.g., 10 minutes after)
- Use UTC time zones for consistent operation across exchanges (00:00, 08:00, 16:00 UTC)
⚙️ Configuration
All configuration values are defined under the funding_farming_settings section in your YAML settings file.
funding_farming_settings:
is_enabled: true
max_open_trades: 5
max_symbols_to_pick: 10
funding_rate_threshold: 0.0003 # 0.03% minimum
spot_order_size: 100.0
future_order_size: 100.0
liquidation_percent: 5.0
# Time-based controls
open_trade_before: 60 # Open trades 60 minutes before funding time
close_trade_after: 10 # Close trades 10 minutes after funding is paid
🧭 Common Configuration Scenarios
| Scenario | Description | Recommended Use |
|---|---|---|
| Precision Timing (Recommended) | Opens 1 hour before, closes 10 minutes after | Best for consistent funding capture |
| Quick Entry/Exit | Opens 15 min before, closes 5 min after | Suitable for active traders |
| Always Trading | No time limits | For continuous funding-based trading |
| Extended Window | Opens 2 hours before, closes 30 minutes after | For slower exchanges or high volatility |
Example Settings
1. Precision Timing
open_trade_before: 60
close_trade_after: 10
Opens: 23:00, 07:00, 15:00 UTC
Closes: 00:10, 08:10, 16:10 UTC
2. Quick Entry/Exit
open_trade_before: 15
close_trade_after: 5
Opens: 23:45, 07:45, 15:45 UTC
Closes: 00:05, 08:05, 16:05 UTC
3. Always Trading
open_trade_before: 0
close_trade_after: 0
Opens anytime when funding rate meets threshold
No auto-close timing restriction
4. Extended Window
open_trade_before: 120
close_trade_after: 30
Opens: 22:00, 06:00, 14:00 UTC
Closes: 00:30, 08:30, 16:30 UTC
🔄 How It Works
1. Opening Positions
Funding times occur three times per day: 00:00, 08:00, and 16:00 UTC.
The system starts monitoring before each funding event and only opens trades within the time window defined by open_trade_before.
Example: For open_trade_before: 60, trades open between 23:00–00:00 UTC.
2. Closing Positions
After funding is awarded, the system holds positions for the duration defined by close_trade_after.
It then automatically closes positions when the delay expires.
3. Check Intervals
| Opening Window | Check Frequency |
|---|---|
| 0 minutes | Every 10 minutes |
| 1–10 minutes | Every 2 minutes |
| 11–30 minutes | Every 5 minutes |
| 31+ minutes | Every 10 minutes |
📋 Log Examples
✅ Opening window active: 45 minutes until funding at 16:00 UTC
🎯 Matched BTCUSDT (Funding: 0.0850%)
✅ Position opened for BTCUSDT at 15:15 UTC
⏳ Not in opening window. Next window opens in 85 minutes at 15:00 UTC.
📍 Monitoring active positions...
⚠️ Position BTCUSDT closing after funding (12 minutes passed)
✅ Position closed successfully.
🛡️ Risk Management
- Funding Rate Threshold – Trades only if rate meets the minimum
- Liquidation Protection – Closes trades approaching liquidation
- Spread Validation – Avoids wide bid-ask spreads
- Price Movement Checks – Warns on sudden volatility
- Max Trade Limit – Respects configured trade limits
⏱️ Close Priority Order
- ✅ Time-based closure (funding + delay)
- ⚠️ Funding rate drops below threshold
- 🚨 Approaching liquidation
- ⚡ Large market movement (warning only)
💡 Benefits
Advantages
- Predictable trading schedule
- Reduced market exposure
- Guaranteed funding capture
- Fully automated cycles
- Multiple daily opportunities
Considerations
- May miss trades in short windows
- Possible funding update delays
- Higher competition during funding
- Potential slippage near funding time
✅ Best Practices
- Start with wider time windows (60–120 minutes)
- Monitor logs to confirm accurate timing
- Add 10–15 min buffer on slow exchanges
- Verify funding payments after each cycle
- Use limit/post-only orders to reduce fees
- Start small when testing strategy
🧩 Troubleshooting
| Issue | Possible Causes | Suggested Fix |
|---|---|---|
| Positions not opening | Outside window / low funding rate / max trades reached | Check timing and thresholds |
| Positions not closing | close_trade_after = 0 or funding not processed yet |
Adjust timing, review logs |
| Missed funding payment | Opened too late or funding delay | Open earlier or verify exchange schedule |
🕓 Example Timeline
Settings:open_trade_before: 60close_trade_after: 10
| Time (UTC) | Event |
|---|---|
| 22:30 | System idle, waiting for window |
| 23:00 | Opening window starts |
| 23:05 | BTCUSDT trade opened |
| 00:00 | Funding payment processed |
| 00:10 | Auto-close triggered |
| 00:15 | Trade recorded, ready for next cycle |
Next window begins at 07:00 UTC for the 08:00 UTC funding.
📊 Performance Tracking
| Metric | Description |
|---|---|
| Funding Earned | Total funding fees collected |
| Net P&L | Profit after fees and slippage |
| Win Rate | Percentage of profitable cycles |
| Avg Holding Time | Should match configured window |
| Execution Rate | Successful trades per funding cycle |
🚀 Advanced Configuration
Dynamic Timing (Planned Feature)
- Adjusts based on funding rate magnitude
- Adapts to market volatility
- Uses historical slippage data
- Accounts for exchange latency
Multi-Exchange Strategy
- Run across multiple exchanges with different funding times
- Capture more daily opportunities
- Reduce risk through diversification