Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce unrequired live logs for derivatives chains #8458

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Common/Data/SubscriptionDataConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,17 @@ public override int GetHashCode()
/// <filterpriority>2</filterpriority>
public override string ToString()
{
return Invariant($"{Symbol.Value},#{ContractDepthOffset},{MappedSymbol},{Resolution},{Type.Name},{TickType},{DataNormalizationMode},{DataMappingMode}{(IsInternalFeed ? ",Internal" : string.Empty)}");
return ToString(Symbol.Value);
}

/// <summary>
/// Returns a string that represents the current object.
/// </summary>
/// <param name="symbol">Symbol to use in the string representation of the object</param>
/// <returns>/// A string that represents the current object.</returns>
public string ToString(string symbol)
{
return Invariant($"{symbol},#{ContractDepthOffset},{MappedSymbol},{Resolution},{Type.Name},{TickType},{DataNormalizationMode},{DataMappingMode}{(IsInternalFeed ? ",Internal" : string.Empty)}");
}

/// <summary>
Expand Down
6 changes: 5 additions & 1 deletion Engine/DataFeeds/Enumerators/LiveDelistingEventProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ public override IEnumerable<BaseData> GetEvents(NewTradableDateEventArgs eventAr

if (currentInstance?.LastOrDefault()?.Date != newInstance?.LastOrDefault()?.Date)
{
Log.Trace($"LiveDelistingEventProvider({Config}): new tradable date {eventArgs.Date:yyyyMMdd}. " +
// All future and option contracts sharing the same canonical symbol, share the same configuration too. Thus, in
// order to reduce logs, we log the configuration using the canonical symbol. See the optional parameter
// "overrideMessageFloodProtection" in Log.Trace() method for more information
var symbol = Config.Symbol.HasCanonical() ? Config.Symbol.Canonical.Value : Config.Symbol.Value;
Log.Trace($"LiveDelistingEventProvider({Config.ToString(symbol)}): new tradable date {eventArgs.Date:yyyyMMdd}. " +
$"MapFile.LastDate Old: {currentInstance?.LastOrDefault()?.Date:yyyyMMdd} New: {newInstance?.LastOrDefault()?.Date:yyyyMMdd}");
}

Expand Down
6 changes: 5 additions & 1 deletion Engine/DataFeeds/Enumerators/LiveDividendEventProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ public override IEnumerable<BaseData> GetEvents(NewTradableDateEventArgs eventAr

if (currentInstance?.Count() != newInstance?.Count())
{
Log.Trace($"LiveDividendEventProvider({Config}): new tradable date {eventArgs.Date:yyyyMMdd}. " +
// All future and option contracts sharing the same canonical symbol, share the same configuration too. Thus, in
// order to reduce logs, we log the configuration using the canonical symbol. See the optional parameter
// "overrideMessageFloodProtection" in Log.Trace() method for more information
var symbol = Config.Symbol.HasCanonical() ? Config.Symbol.Canonical.Value : Config.Symbol.Value;
Log.Trace($"LiveDividendEventProvider({Config.ToString(symbol)}): new tradable date {eventArgs.Date:yyyyMMdd}. " +
$"New FactorFile: {!ReferenceEquals(currentInstance, newInstance)}. " +
$"FactorFile.Count Old: {currentInstance?.Count()} New: {newInstance?.Count()}");
}
Expand Down
6 changes: 5 additions & 1 deletion Engine/DataFeeds/Enumerators/LiveMappingEventProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ public override IEnumerable<BaseData> GetEvents(NewTradableDateEventArgs eventAr
InitializeMapFile();
var newInstance = MapFile;

Log.Trace($"LiveMappingEventProvider({Config}): new tradable date {eventArgs.Date:yyyyMMdd}. " +
// All future and option contracts sharing the same canonical symbol, share the same configuration too. Thus, in
// order to reduce logs, we log the configuration using the canonical symbol. See the optional parameter
// "overrideMessageFloodProtection" in Log.Trace() method for more information
var symbol = Config.Symbol.HasCanonical() ? Config.Symbol.Canonical.Value : Config.Symbol.Value;
Log.Trace($"LiveMappingEventProvider({Config.ToString(symbol)}): new tradable date {eventArgs.Date:yyyyMMdd}. " +
$"New MapFile: {!ReferenceEquals(currentInstance, newInstance)}. " +
$"MapFile.Count Old: {currentInstance?.Count()} New: {newInstance?.Count()}");

Expand Down
6 changes: 5 additions & 1 deletion Engine/DataFeeds/Enumerators/LiveSplitEventProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ public override IEnumerable<BaseData> GetEvents(NewTradableDateEventArgs eventAr

if(currentInstance?.Count() != newInstance?.Count())
{
Log.Trace($"LiveSplitEventProvider({Config}): new tradable date {eventArgs.Date:yyyyMMdd}. " +
// All future and option contracts sharing the same canonical symbol, share the same configuration too. Thus, in
// order to reduce logs, we log the configuration using the canonical symbol. See the optional parameter
// "overrideMessageFloodProtection" in Log.Trace() method for more information
var symbol = Config.Symbol.HasCanonical() ? Config.Symbol.Canonical.Value : Config.Symbol.Value;
Log.Trace($"LiveSplitEventProvider({Config.ToString(symbol)}): new tradable date {eventArgs.Date:yyyyMMdd}. " +
$"New FactorFile: {!ReferenceEquals(currentInstance, newInstance)}. " +
$"FactorFile.Count Old: {currentInstance?.Count()} New: {newInstance?.Count()}");
}
Expand Down
15 changes: 13 additions & 2 deletions Engine/RealTime/LiveTradingRealTimeHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,13 @@ protected virtual void RefreshMarketHours(DateTime date)
UpdateMarketHours(security);

var localMarketHours = security.Exchange.Hours.GetMarketHours(date);
Log.Trace($"LiveTradingRealTimeHandler.RefreshMarketHoursToday({security.Type}): Market hours set: Symbol: {security.Symbol} {localMarketHours} ({security.Exchange.Hours.TimeZone})");

// All future and option contracts sharing the same canonical symbol, share the same market
// hours too. Thus, in order to reduce logs, we log the market hours using the canonical
// symbol. See the optional parameter "overrideMessageFloodProtection" in Log.Trace()
// method for further information
var symbol = security.Symbol.HasCanonical() ? security.Symbol.Canonical : security.Symbol;
Log.Trace($"LiveTradingRealTimeHandler.RefreshMarketHoursToday({security.Type}): Market hours set: Symbol: {symbol} {localMarketHours} ({security.Exchange.Hours.TimeZone})");
}
}

Expand All @@ -166,8 +172,13 @@ protected virtual void RefreshSymbolProperties()
var security = kvp.Value;
UpdateSymbolProperties(security);

// All future and option contracts sharing the same canonical symbol, share the same symbol
// properties too. Thus, in order to reduce logs, we log the symbol properties using the
// canonical symbol. See the optional parameter "overrideMessageFloodProtection" in
// Log.Trace() method for further information
var symbol = security.Symbol.HasCanonical() ? security.Symbol.Canonical : security.Symbol;
Log.Trace($"LiveTradingRealTimeHandler.RefreshSymbolPropertiesToday(): Symbol properties set: " +
$"Symbol: {security.Symbol} {security.SymbolProperties}");
$"Symbol: {symbol} {security.SymbolProperties}");
}
}

Expand Down