Future option tickers with a two-digit year resolve to the wrong decade

Open Beginner friendly
#9,955 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
csharp
Domain
backend

Research direction

Open Common/SymbolRepresentation.cs and read ParseFutureOptionSymbol, following how it builds the expiry year and where it compares against FutureTickerProperties.ExpirationYearShortLength. Compare that branch with ParseFutureSymbol, which already handles two-digit years correctly, and make the option path agree. Verify with the snippet in the issue plus the symbol-representation tests under the Tests/Common project, and confirm ParseTickerFromUserInput for the JSON symbol yields the same underlying.

Written by the indexing model from the issue text.

Description

Expected Behavior

SymbolRepresentation.ParseFutureOptionSymbol("ESZ05 C1200") returns an option on the December 2005 ES future, the same contract that SymbolRepresentation.ParseFutureSymbol("ESZ05") returns. A two-digit year already defines the decade.

Actual Behavior

ParseFutureOptionSymbol adds 20 to every year below 10, including two-digit years, so ESZ05 C1200 returns an option on the December 2025 ES future. ESH09 P800 returns a 2029 future instead of 2009. The same happens for user-friendly JSON symbols such as {"value":"ESZ05 C1200","type":"8"} and for tickers passed to the data downloader, because both go through SymbolRepresentation.ParseTickerFromUserInput.

Potential Solution

Only move single-digit years into the 2020s, using FutureTickerProperties.ExpirationYearShortLength (Common/SymbolRepresentation.cs, ParseFutureOptionSymbol).

Reproducing the Problem
var option = SymbolRepresentation.ParseFutureOptionSymbol("ESZ05 C1200");
var future = SymbolRepresentation.ParseFutureSymbol("ESZ05");
Assert.AreEqual(future, option.Underlying); // fails: the option's underlying expires in December 2025
System Information

Ubuntu x86_64, .NET SDK 10.0.403, master at 22404ea28b8d3f3c9eb74d6ed9f0444426f8e417.

Checklist
  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue
Dominant language
C#
Stars
22.4k
Forks
5.4k
Avg merge
2d 9h
Merged PRs (30d)
52

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from QuantConnect/Lean

All issues in QuantConnect/Lean

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.