Skip to content

Skip stale chain universe open interest when a newer tick was received - #9737

Merged
Martin-Molinero merged 2 commits into
QuantConnect:masterfrom
Martin-Molinero:bug-universe-open-interest-stale-override
Aug 21, 2026
Merged

Skip stale chain universe open interest when a newer tick was received#9737
Martin-Molinero merged 2 commits into
QuantConnect:masterfrom
Martin-Molinero:bug-universe-open-interest-stale-override

Conversation

@Martin-Molinero

Copy link
Copy Markdown
Member

Description

Follow up of #9601. SecurityCache now tracks the end time of the last open interest update and only sets OpenInterest from a chain universe data point (OptionUniverse, FutureUniverse) when it isn't older than the last open interest tick received. Open interest ticks keep overriding the cache value as before, and Reset() clears the tracked time.

Motivation and Context

The chain universe data point can reach the security cache after a more recent open interest tick was already received, replacing it with an older value.

Requires Documentation Change

None.

How Has This Been Tested?

  • New SecurityCacheTests cases for OptionCache, IndexOptionCache, FutureOptionCache and FutureCache: universe data sets the open interest, a newer tick is not overridden, an older tick is, and the value is set again after Reset().
  • OptionUniverseOpenInterestRegressionAlgorithm, IndexOptionUniverseOpenInterestRegressionAlgorithm and FutureUniverseOpenInterestRegressionAlgorithm pass unchanged.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • Refactor (non-breaking change which improves implementation)
  • Performance (non-breaking change which improves performance. Please add associated performance test and results)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Non-functional change (xml comments/documentation/etc)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • My branch follows the naming convention bug-<issue#>-<description> or feature-<issue#>-<description>

Track the end time of the last open interest update in the security cache
and only take the chain universe open interest when it's not older.
…time

Daily open interest data is stamped at midnight, matching the end time of
the previous date's chain universe data, so the tick is the newer value.
@Martin-Molinero
Martin-Molinero merged commit 2486390 into QuantConnect:master Aug 21, 2026
7 of 8 checks passed
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.

1 participant