The open_trade_before setting in MagicTradeBot defines how many minutes before the funding snapshot the bot opens a hedged Spot + Futures position.
This parameter helps ensure the bot qualifies for the upcoming funding payment while controlling exposure duration.
🔹 How It Works
Timing the Hedged Position
Funding fees are calculated at specific funding intervals (snapshots) in the Futures market
open_trade_beforespecifies how early the bot should enter the trade to be eligible for the next funding paymentImpact of Opening Earlier
Pros:
- Ensures the bot is positioned in time to receive funding fees
- Can capture funding payments even if funding snapshot time is unpredictable or slightly delayed
Cons:
- Increases market exposure duration
- Longer exposure may slightly increase risk from price swings, though hedged
🔹 Practical Example
| Parameter | Example | Explanation |
|---|---|---|
open_trade_before |
120 | Open positions 2 hours before funding snapshot |
| Funding snapshot | 12:00 PM | Bot opens hedged positions at 10:00 AM |
| Result | Eligible for funding fee at 12:00 PM, positions remain open until close |
- Adjust
open_trade_beforebased on symbol volatility and funding timing
🔹 Key Takeaways
- Purpose: Ensure bot positions are eligible for the upcoming funding payment
- Earlier opening: Improves eligibility but increases market exposure time
- Recommendation: Balance early positioning with safe hedge and risk tolerance