When defining option legs in Allasso backtests, the contract selection logic controls which specific expiry is used when opening or rolling a position. Two key parameters govern this:
🔧 1. min_dte – Minimum Days to Expiry
This sets the minimum threshold for eligible contracts based on the Number of Days to Expiry (DTE).
- The strategy will ignore any option contracts with DTE below this value at the time of entry.
- It ensures you're not entering positions that are too close to expiry, which may have unstable pricing or limited liquidity.
📌 Example:
- If min_dte = 30, and the available expiries are in 10, 25, 47, and 62 days, the strategy will only consider 47 and 62-day contracts for entry.
🔢 2. nearest – Contract Ranking
This defines which contract (among those that pass the min_dte filter) will be selected.
- nearest = 1 → the closest eligible expiry
- nearest = 2 → the second closest, and so on
📌 Example:
- Using the filtered expiries above (47, 62), if:
- nearest = 1, you'll select the contract expiring in 47 days
- nearest = 2, you'll select the one expiring in 62 days
🔁 How It Works Together
The process at each trade entry looks like this:
- Gather all available option expiries
- Filter out any with DTE < min_dte
- Rank the remaining by shortest DTE to longest
- Pick the nearest contract in that list
💡 Why It Matters
This setup allows you to:
- Target specific expiries (e.g., always trade the 2nd monthly if it has enough time left)
- Control time decay risk by staying above a DTE floor
- Roll positions predictable, especially for structured portfolios
Comments
0 comments
Please sign in to leave a comment.