Skip to content

Add configurable futures roll date#9538

Open
scarab-systems wants to merge 1 commit into
QuantConnect:masterfrom
scarab-systems:feature-9440-configurable-futures-roll
Open

Add configurable futures roll date#9538
scarab-systems wants to merge 1 commit into
QuantConnect:masterfrom
scarab-systems:feature-9440-configurable-futures-roll

Conversation

@scarab-systems

Copy link
Copy Markdown

Summary

  • Adds DataMappingMode.TradingDaysBeforeExpiry for continuous futures that need to roll before the normal last-trading-day mapping date.
  • Threads a tradeable-day roll offset and optional contract month cycle through continuous future subscriptions, universe settings, history requests, mapping events, and the Python wrapper.
  • Reuses existing LastTradingDay map-file rows for the new mapping mode and applies the optional contract month cycle when walking continuous future contract depth.

Motivation

Fixes #9440.

The issue describes two related continuous futures needs:

  • rolling a configurable number of trading days before the normal last-trading-day roll;
  • restricting held futures contracts to selected contract months, for example skipping weak open-interest months.

Testing

  • dotnet build Tests/QuantConnect.Tests.csproj --no-restore -clp:ErrorsOnly --verbosity quiet

Added focused tests for:

  • TradingDaysBeforeExpiry reusing LastTradingDay map-file rows;
  • contract-depth walking with a selected contract month cycle;
  • skipping a current mapped contract when its month is outside the selected cycle;
  • adding tradeable days across closed exchange dates.

I was able to build the test project locally. Direct local NUnit execution in my Linux container aborted during global Python/test-host initialization before the selected tests ran, so CI should be the authoritative full test run.

Adds a TradingDaysBeforeExpiry mapping mode for continuous futures and threads the tradeable-day offset and contract month cycle through subscription, history, universe, mapping-event, and Python wrapper paths.

Reuses LastTradingDay map-file rows for the new mode and applies the optional contract month cycle when walking continuous future contract depth.

Adds coverage for LastTradingDay row reuse, contract-month-cycle depth walking, and tradeable-day offset handling.

Verification: dotnet build Tests/QuantConnect.Tests.csproj --no-restore -clp:ErrorsOnly --verbosity quiet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configurable Rolling Date With DataMappingMode

1 participant