Daily + Incorporate check in UPDATEDAILY2 to ensure pricing availabilty for current trade date for open positions. Incorporate an extra sweep to cover open position pricing and send an email if any open positions are missing pricing for current trade date.
Some checks failed
Build .NET Project / build (push) Has been cancelled
Some checks failed
Build .NET Project / build (push) Has been cancelled
This commit is contained in:
@@ -249,8 +249,6 @@ namespace MarketData.Helper
|
||||
// ********************************************************************************************************************************************
|
||||
// ********************************************************************** B A R C H A R T ***************************************************
|
||||
// ********************************************************************************************************************************************
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// UpdatePricesBarChartSweep - This feed is intended to supplement BigCharts nightly price feed in UPDATEDAILY2 by filling any gaps that may occur
|
||||
/// in that feed. This feed will only pull a price for which we had a price yesterday (findprevbusinessday) and for which do not have
|
||||
@@ -313,6 +311,56 @@ namespace MarketData.Helper
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("[UpdatePricesBarChartSweep]End, total took {0}(ms)", profiler.End()));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UpdatePricesBarChart - This feed is used by UPDATEDAILY2 as a final sweep for open positions.
|
||||
/// If we already have the price for the given date then it will not be fetched.
|
||||
/// </summary>
|
||||
/// <param name="symbolsToFetch">The symbols to fetch. This should be a list of symbols for which we need pricing for startDate</param>
|
||||
/// <param name="startDate">The date we are requesting</param>
|
||||
/// <returns></returns>
|
||||
public bool UpdatePricesBarChartSweepOpenPositions(List<String> symbolsToFetch, DateTime? startDate = null)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, "[UpdatePricesBarChartSweepOpenPositions]Enter");
|
||||
DateGenerator dateGenerator = new DateGenerator();
|
||||
if(null == symbols || 0==symbols.Count)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, $"[UpdatePricesBarChartSweepOpenPositions] No symbols provided, nothing to do");
|
||||
return false;
|
||||
}
|
||||
if (null == startDate) startDate = DateTime.Now;
|
||||
symbols = symbolsToFetch;
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, $"[UpdatePricesBarChartSweepOpenPositions] Preparing to supplement {symbolsToFetch.Count} prices for pricing date {startDate.Value.ToShortDateString()} .");
|
||||
currentIndex = 0;
|
||||
while (true)
|
||||
{
|
||||
List<String> queueSymbols = GetQueueSymbols();
|
||||
if (null == queueSymbols || 0 == queueSymbols.Count) break;
|
||||
ManualResetEvent[] resetEvents = new ManualResetEvent[queueSymbols.Count];
|
||||
for (int eventIndex = 0; eventIndex < resetEvents.Length; eventIndex++)
|
||||
{
|
||||
resetEvents[eventIndex] = new ManualResetEvent(false);
|
||||
}
|
||||
for (int index = 0; index < queueSymbols.Count; index++)
|
||||
{
|
||||
PricingThreadHelper pricingThreadHelper = new PricingThreadHelper(queueSymbols[index], startDate.Value, resetEvents[index]);
|
||||
ThreadPool.QueueUserWorkItem(ThreadPoolCallbackUpdatePricesBarChartSweep, pricingThreadHelper);
|
||||
try { Thread.Sleep(WaitBetweenRequests); } catch (Exception) {; }
|
||||
}
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, "UpdatePricesBarChartSweepOpenPositions, waiting for queued items to complete.");
|
||||
WaitHandle.WaitAll(resetEvents);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
finally
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("[UpdatePricesBarChartSweepOpenPositions]End, total took {0}(ms)", profiler.End()));
|
||||
}
|
||||
}
|
||||
|
||||
// ********************************************************************************************************************************************
|
||||
// ********************************************************************** E N D B A R C H A R T ***************************************************
|
||||
// ********************************************************************************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user