IndexOptionSymbol converts holiday-separated last-trading and expiration dates using calendar days

Aperta
#10,159 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
backend, databases

Direzione di ricerca

Start with IndexOptionSymbol.GetLastTradingDate and GetExpiryDate, then inspect how exchange calendars are represented and used by the shared helper. Check the InteractiveBrokersSymbolMapper.GetLeanSymbol IndexOption case and InteractiveBrokersBrokerage.CreateContract; add coverage for the December 2018 holiday in both conversion directions and mapper behavior. Done means those conversions return December 24 and December 26 while ordinary-session and PM-settled results remain correct.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

priority:p2
Observed behavior

IndexOptionSymbol.GetLastTradingDate and GetExpiryDate use a fixed calendar-day offset for AM-settled index options. When a holiday separates the last trading session from expiration, both conversions can produce the holiday instead of the correct date.

A concrete case is VIXW expiration on 2018-12-26. Its preceding business day was 2018-12-24, since December 25 was closed. The helpers return December 25 in both directions:

Console.WriteLine(IndexOptionSymbol.GetLastTradingDate(
    "VIXW", new DateTime(2018, 12, 26)).ToString("yyyy-MM-dd"));
// Actual: 2018-12-25; expected: 2018-12-24

Console.WriteLine(IndexOptionSymbol.GetExpiryDate(
    "VIXW", new DateTime(2018, 12, 24)).ToString("yyyy-MM-dd"));
// Actual: 2018-12-25; expected: 2018-12-26

The fixed +1/-1 behavior is present on master (dbacbd727).

References
Affected callers and required result

The public Interactive Brokers integration consumes both conversions:

  • InteractiveBrokersSymbolMapper.GetLeanSymbol, in the IndexOption case, calls GetExpiryDate to construct Lean's contract symbol.
  • InteractiveBrokersBrokerage.CreateContract calls GetLastTradingDate to populate LastTradeDateOrContractMonth.

Thus this is not only a display-date discrepancy: those callers can construct a different expiration or send a non-trading date when given this holiday-separated contract.

The shared conversions should produce December 24 and December 26 respectively for the reproduction, while preserving existing ordinary-session and PM-settled results. Add holiday-separated cases in both directions and mapper coverage. As a suggestion, resolve these dates against the relevant exchange calendar in the shared Lean helper, so brokerage callers can reuse the correction instead of adding their own holiday rules.

Lingua principale
C#
Stelle
22.6k
Fork
5.4k
Merge medio
11h 39m
PR unite (30g)
104

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di QuantConnect/Lean

Tutte le issue di QuantConnect/Lean

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.