20 using System.Collections.Generic;
40 if (dataConfig.TickerShouldBeMapped())
44 return resolver.ResolveMapFile(dataConfig.
Symbol, dataConfig.
Type.Name);
58 string dataType =
null)
66 symbolID = symbol.
SecurityType ==
SecurityType.Base && dataType !=
null ? symbolID.RemoveFromEnd($
".{dataType}") : symbolID;
104 if (mapFileProvider ==
null)
106 throw new ArgumentNullException(nameof(mapFileProvider));
110 var symbolMapFile = mapFileResolver.ResolveMapFile(symbol);
112 if (!symbolMapFile.Any())
117 var newStartDateTime = startDateTime;
118 foreach (var mappedTicker
in symbolMapFile.Skip(1))
120 if (mappedTicker.Date >= newStartDateTime)
123 var newEndDateTime = mappedTicker.Date.AddDays(1);
124 if (newEndDateTime > endDateTime)
126 yield
return new(mappedTicker.MappedSymbol, newStartDateTime, endDateTime);
131 yield
return new(mappedTicker.MappedSymbol, newStartDateTime, newEndDateTime);
133 newStartDateTime = newEndDateTime;
147 if (mapFileProvider ==
null || symbol ==
null)
149 throw new ArgumentException($
"The map file provider and symbol cannot be null. {(mapFileProvider == null ? nameof(mapFileProvider) : nameof(symbol))}");
157 foreach (var mapFile
in mapFileResolver)
160 if (!mapFile.Any(mapFileRow => mapFileRow.MappedSymbol == tickerUpperCase))
165 foreach (var tickerDateRange
in mapFile.GetTickerDateRanges(tickerUpperCase))
169 var newSymbol =
new Symbol(sid, tickerUpperCase);
176 yield
return new(newSymbol, tickerDateRange.StartDate, tickerDateRange.EndDate);
187 private static IEnumerable<(DateTime StartDate, DateTime EndDate)> GetTickerDateRanges(
this MapFile mapFile,
string ticker)
189 var previousRowDate = mapFile.FirstOrDefault().Date;
190 foreach (var currentRow
in mapFile.Skip(1))
192 if (ticker == currentRow.MappedSymbol)
194 yield
return (previousRowDate, currentRow.Date.AddDays(1));
197 previousRowDate = currentRow.Date.AddDays(1);