RelativeDailyVolume returns zero after the final historical time slot

Aperta Adatta ai principianti
#10,198 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à
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
data, testing

Direzione di ricerca

Leggi Indicators/RelativeDailyVolume.cs intorno alle righe 111–138 e segui come viene selezionato il volume cumulativo storico per un orario richiesto. Trova i test esistenti di RelativeDailyVolume e aggiungi un caso in cui l’orario corrente sia successivo all’ultimo intervallo storico; verifica che il risultato usi il volume cumulativo disponibile più recente e mantenga il comportamento relativo ai vuoti interni coperto da #9629.

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

Descrizione

priority:p2

Problem

When the current time-of-day is later than every historical time slot, RelativeDailyVolume leaves its fallback denominator at zero and returns zero despite having a nonzero historical cumulative volume.

Source: Indicators/RelativeDailyVolume.cs, lines 111–138.

This is a boundary case distinct from #9629: the existing break fixes selection between historical slots, but no loop iteration assigns a denominator after the final slot. A historical early close followed by a longer trading session can reach this path.

Reproduction

using System;
using QuantConnect;
using QuantConnect.Data.Market;
using QuantConnect.Indicators;

var symbol = new Symbol(SecurityIdentifier.GenerateEquity("SPY", Market.USA, false), "SPY");
var start = new DateTime(2024, 1, 2, 9, 30, 0);
TradeBar Bar(DateTime time, decimal volume) =>
    new TradeBar(time, symbol, 9, 10, 9, 10, volume, TimeSpan.FromMinutes(1));
var rdv = new RelativeDailyVolume(1);
rdv.Update(Bar(start, 100));
rdv.Update(Bar(start.AddMinutes(1), 100));
rdv.Update(Bar(start.AddDays(1).AddMinutes(2), 50));
Console.WriteLine($"{rdv.IsReady}: {rdv.Current.Value}");

Executed result: True: 0. Expected: True: 0.25.

The completed historical day has cumulative volumes 100 at 09:30 and 200 at 09:31. At 09:32, the latest historical cumulative volume is still 200, so the ratio is 50 / 200 = 0.25. No historical key is greater than 09:32, and the fallback never assigns that value.

Required result

Use the most recent available historical cumulative volume when the requested time is after the final historical slot. Add a regression test for this boundary without changing the interior-gap behavior covered by #9629.

Priority is low pending evidence of broader impact; this is limited to unmatched times beyond the historical range.

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.