From dac3508de7d84e93c79e21d799daaea0a1716281 Mon Sep 17 00:00:00 2001 From: Romazes Date: Tue, 27 Feb 2024 00:22:59 +0200 Subject: [PATCH] feat: missed flags to prevent spamming for user --- QuantConnect.IEX/IEXDataProvider.cs | 35 +++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/QuantConnect.IEX/IEXDataProvider.cs b/QuantConnect.IEX/IEXDataProvider.cs index 4474b10..21e1a70 100644 --- a/QuantConnect.IEX/IEXDataProvider.cs +++ b/QuantConnect.IEX/IEXDataProvider.cs @@ -58,6 +58,21 @@ public class IEXDataProvider : SynchronizingHistoryProvider, IDataQueueHandler /// private static bool _invalidHistoryDataTypeWarningFired; + /// + /// Indicates whether the warning for invalid has been fired. + /// + private bool _invalidSecurityTypeWarningFired; + + /// + /// Indicates whether a warning for an invalid start time has been fired, where the start time is greater than or equal to the end time in UTC. + /// + private bool _invalidStartTimeWarningFired; + + /// + /// Indicates whether a warning for an invalid has been fired, where the resolution is neither daily nor minute-based. + /// + private bool _invalidResolutionWarningFired; + /// /// Represents two clients: one for the trade channel and another for the top-of-book channel. /// @@ -509,21 +524,33 @@ public override void Initialize(HistoryProviderInitializeParameters parameters) continue; } - if (request.Symbol.SecurityType != SecurityType.Equity) + if (!CanSubscribe(request.Symbol)) { - Log.Trace($"{nameof(IEXDataProvider)}.{nameof(GetHistory)}: Unsupported SecurityType '{request.Symbol.SecurityType}' for symbol '{request.Symbol}'"); + if (!_invalidSecurityTypeWarningFired) + { + Log.Trace($"{nameof(IEXDataProvider)}.{nameof(GetHistory)}: Unsupported SecurityType '{request.Symbol.SecurityType}' for symbol '{request.Symbol}'"); + _invalidSecurityTypeWarningFired = true; + } continue; } if (request.StartTimeUtc >= request.EndTimeUtc) { - Log.Error($"{nameof(IEXDataProvider)}.{nameof(GetHistory)}: Error - The start date in the history request must come before the end date. No historical data will be returned."); + if (!_invalidStartTimeWarningFired) + { + Log.Error($"{nameof(IEXDataProvider)}.{nameof(GetHistory)}: Error - The start date in the history request must come before the end date. No historical data will be returned."); + _invalidStartTimeWarningFired = true; + } continue; } if (request.Resolution != Resolution.Daily && request.Resolution != Resolution.Minute) { - Log.Error($"{nameof(IEXDataProvider)}.{nameof(GetHistory)}: History calls for IEX only support daily & minute resolution."); + if (!_invalidResolutionWarningFired) + { + Log.Error($"{nameof(IEXDataProvider)}.{nameof(GetHistory)}: History calls for IEX only support daily & minute resolution."); + _invalidResolutionWarningFired = true; + } continue; }