Skip to content

Commit

Permalink
feat: extendedMarketHours Warning Fired flag (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Romazes committed Feb 9, 2024
1 parent f8115d9 commit acb9c55
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions QuantConnect.IEX/IEXDataQueueHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,11 @@ public class IEXDataQueueHandler : SynchronizingHistoryProvider, IDataQueueHandl
{ IEXPricePlan.Enterprise, (1500, int.MaxValue) }
};

/// <summary>
/// Indicates if data transmission is limited to the extended market hours range (4am-8am).
/// </summary>
private bool _extendedMarketHoursWarningFired;

/// <summary>
/// Returns whether the data provider is connected
/// True if the data provider is connected
Expand Down Expand Up @@ -359,11 +364,11 @@ private void HandleLastSaleResponse(IEnumerable<DataStreamLastSale>? lastSales)
/// <returns>The new enumerator for this subscription request</returns>
public IEnumerator<BaseData> Subscribe(SubscriptionDataConfig dataConfig, EventHandler newDataAvailableHandler)
{
if (dataConfig.ExtendedMarketHours)
if (!_extendedMarketHoursWarningFired)
{
throw new InvalidOperationException($"{nameof(IEXDataQueueHandler)}.{nameof(Subscribe)}: " +
$"Algorithm Subscription Error - Extended market hours not supported. " +
Log.Error($"{nameof(IEXDataQueueHandler)}.{nameof(Subscribe)}: Algorithm Subscription Error - Extended market hours not supported." +
$"Subscribe during regular hours for optimal performance.");
_extendedMarketHoursWarningFired = true;
}

if (!CanSubscribe(dataConfig.Symbol))
Expand Down

0 comments on commit acb9c55

Please sign in to comment.