What does open_trade_before control?

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

  1. Timing the Hedged Position

  2. Funding fees are calculated at specific funding intervals (snapshots) in the Futures market

  3. open_trade_before specifies how early the bot should enter the trade to be eligible for the next funding payment

  4. Impact of Opening Earlier

  5. 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
  6. 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_before based 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

📎 Related Topics