From ae01046c37b9d83434aa060036bd99485e64c7af Mon Sep 17 00:00:00 2001 From: Jhonathan Abreu Date: Wed, 5 Feb 2025 17:50:32 -0400 Subject: [PATCH 1/2] Minor changes Disabled fill forward in history requests. IndexHistoryProvider to fail when prices are 0. --- .../DerivativeUniverseGenerator.cs | 5 ++--- .../IndexHistoryProvider.cs | 6 ++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Lean.DataSource.DerivativeUniverseGenerator/DerivativeUniverseGenerator.cs b/Lean.DataSource.DerivativeUniverseGenerator/DerivativeUniverseGenerator.cs index 41ece76..56063a2 100644 --- a/Lean.DataSource.DerivativeUniverseGenerator/DerivativeUniverseGenerator.cs +++ b/Lean.DataSource.DerivativeUniverseGenerator/DerivativeUniverseGenerator.cs @@ -287,7 +287,7 @@ protected virtual bool TryGenerateAndWriteUnderlyingLine(Symbol underlyingSymbol PriceHistoryResolutions[0], marketHoursEntry.ExchangeHours, marketHoursEntry.DataTimeZone, - PriceHistoryResolutions[0], + null, includeExtendedMarketHours: false, isCustomData: false, DataNormalizationMode.ScaledRaw, @@ -325,7 +325,6 @@ private List GetHistory(HistoryRequest[] historyRequests, { var request = new HistoryRequest(x, x.Symbol, historyStartUtc, historyEndUtc); request.Resolution = resolution; - request.FillForwardResolution = resolution; return request; }).ToArray(); @@ -397,7 +396,7 @@ protected virtual HistoryRequest[] GetDerivativeHistoryRequests(Symbol symbol, D PriceHistoryResolutions[0], marketHoursEntry.ExchangeHours, marketHoursEntry.DataTimeZone, - PriceHistoryResolutions[0], + null, includeExtendedMarketHours: false, isCustomData: false, DataNormalizationMode.ScaledRaw, diff --git a/Lean.DataSource.OptionsUniverseGenerator/IndexHistoryProvider.cs b/Lean.DataSource.OptionsUniverseGenerator/IndexHistoryProvider.cs index 716d665..471a286 100644 --- a/Lean.DataSource.OptionsUniverseGenerator/IndexHistoryProvider.cs +++ b/Lean.DataSource.OptionsUniverseGenerator/IndexHistoryProvider.cs @@ -197,6 +197,12 @@ private IEnumerable ParseHistory(Symbol symbol, YahooFinanceIndexPrice var close = indexPrices.ClosePrices[i]; var volume = indexPrices.Volumes[i]; + if (open == 0 || high == 0 || low == 0 || close == 0 || volume == 0) + { + throw new Exception($"IndexHistoryProvider.ParseHistory(): Invalid data for {symbol} at {time}. " + + $"Open: {open}, High: {high}, Low: {low}, Close: {close}, Volume: {volume}."); + } + yield return new TradeBar(time, symbol, open, high, low, close, volume) { EndTime = endTime }; } } From b8ec0fb3965f7ee1eb7e63711d06f448c7844d89 Mon Sep 17 00:00:00 2001 From: Jhonathan Abreu Date: Wed, 5 Feb 2025 18:18:30 -0400 Subject: [PATCH 2/2] Minor change --- .../IndexHistoryProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lean.DataSource.OptionsUniverseGenerator/IndexHistoryProvider.cs b/Lean.DataSource.OptionsUniverseGenerator/IndexHistoryProvider.cs index 471a286..43b9bdd 100644 --- a/Lean.DataSource.OptionsUniverseGenerator/IndexHistoryProvider.cs +++ b/Lean.DataSource.OptionsUniverseGenerator/IndexHistoryProvider.cs @@ -197,7 +197,7 @@ private IEnumerable ParseHistory(Symbol symbol, YahooFinanceIndexPrice var close = indexPrices.ClosePrices[i]; var volume = indexPrices.Volumes[i]; - if (open == 0 || high == 0 || low == 0 || close == 0 || volume == 0) + if (open == 0 || high == 0 || low == 0 || close == 0) { throw new Exception($"IndexHistoryProvider.ParseHistory(): Invalid data for {symbol} at {time}. " + $"Open: {open}, High: {high}, Low: {low}, Close: {close}, Volume: {volume}.");