diff --git a/MarketData/MarketData/Services/MainService.cs b/MarketData/MarketData/Services/MainService.cs index c1b5474..b8ce80a 100755 --- a/MarketData/MarketData/Services/MainService.cs +++ b/MarketData/MarketData/Services/MainService.cs @@ -27,6 +27,7 @@ namespace MarketData.Services MDTrace.WriteLine(LogLevel.DEBUG,"LOADHEADLINESWATCHLIST"); MDTrace.WriteLine(LogLevel.DEBUG,"LOADPREMARKETDATA"); MDTrace.WriteLine(LogLevel.DEBUG,"UPDATEDAILY2 /DATE:"); + MDTrace.WriteLine(LogLevel.DEBUG,"UPDATEPRICESBARCHARTSWEEP /DATE: This feed is a supplement to the BigCharts feed. See description for how it works"); MDTrace.WriteLine(LogLevel.DEBUG,"UPDATELATESTPRICEOPENPOSITIONS"); MDTrace.WriteLine(LogLevel.DEBUG,"UPDATELATESTPRICEWATCHLIST /WATCHLIST:"); MDTrace.WriteLine(LogLevel.DEBUG,"UPDATEINTRADAYPRICING:"); @@ -97,6 +98,7 @@ namespace MarketData.Services tasks.Add("RUNBACKTEST",TaskMGRunMGBacktest); tasks.Add("CALCBETAS",TaskCalcBetas); tasks.Add("OPTIMIZEDB",TaskOptimizeDatabase); + tasks.Add("UPDATEPRICESBARCHARTSWEEP", TaskUpdatePricesBarChartSweep); tasks.Add("ECHO",TaskEcho); GlobalConfig.Instance.Configuration = configuration; // This call sets up configuration stuff so it needs to be first. @@ -340,6 +342,23 @@ namespace MarketData.Services MDTrace.WriteLine(LogLevel.DEBUG,$"Total took {profiler.End()} (ms)"); await Task.FromResult(true); } + + /// + /// Retrieves latest pricing from BarChart + /// This feed is intended to be run after the BIGCHART feed. This feed only retrieves the latest price. + /// It uses the DATE paramter (which should be the end of trading day date) to determine if we already have a price for the symbol. + /// If we have a price for the symbol then no attempt to retieve a price is made. Otherwise, this feed retrives a price from BarChart, + /// tags it with TODAYS date and inserts that into the database. + /// First of all don't get confused by the DATE parameter. + /// + /// + /// + public async Task TaskUpdatePricesBarChartSweep(CommandArgs commandArgs) + { + if (!commandArgs.Has("DATE")) { MDTrace.WriteLine(LogLevel.DEBUG, "UPDATEPRICESBARCHARTSWEEP MISSING DATE"); return; } + UpdatePricesBarChartSweep(commandArgs.Get("DATE")); + await Task.FromResult(true); + } /// /// Performs optimization on the database tables. Since we don't want to run this if any of the monthly updates is running we will check for those tasks and wait for them @@ -532,8 +551,9 @@ namespace MarketData.Services // Here is the start of the real workers ThreadPool.QueueUserWorkItem(delegate { - UpdatePricesBigCharts(startDate); // bigcharts.marketwatch.com - UpdatePricesYahooSweep(startDate); // The sweep variation of the method is intended to be used after the BigCharts update because the sweep will take pricing_source into consideration when fetching prices. + UpdatePricesBigCharts(startDate); // bigcharts.marketwatch.com + UpdatePricesYahooSweep(startDate); // The sweep variation of the method is intended to be used after the BigCharts update because the sweep will take pricing_source into consideration when fetching prices. + UpdatePricesBarChartSweep(startDate); // barchart. This sweep will pull any prices we failed to retrieve from BigCharts resetEvents[STAGE_1].Set(); SMSClient.SendSMSEmail("UPDATEDAILY2 STAGE_1 UPDATEPRICESBIGCHARTS/YAHOO done.", smsUserName, smsRecipients, smsSMTPAddress, smsUserName, smsPassword); MDTrace.WriteLine(LogLevel.DEBUG,$"STAGE_1 complete."); @@ -633,25 +653,31 @@ namespace MarketData.Services pricingMarketDataHelper.UpdatePricesYahooSweep(startDate); } - public static void DeletePriceWatchList(String watchListName,String strDate) + public static void UpdatePricesBarChartSweep(DateTime startDate) + { + PricingMarketDataHelper pricingMarketDataHelper=new PricingMarketDataHelper(); + pricingMarketDataHelper.UpdatePricesBarChartSweep(startDate); + } + + public static void DeletePriceWatchList(String watchListName, String strDate) { try { List symbols = WatchListDA.GetWatchList(watchListName); - if(null==symbols||0==symbols.Count) + if (null == symbols || 0 == symbols.Count) { - MDTrace.WriteLine(LogLevel.DEBUG,String.Format("There are no symbols for watchlist {0}",watchListName)); + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("There are no symbols for watchlist {0}", watchListName)); return; } foreach (String symbol in symbols) { - MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Delete price {0} on {1}, watchlist {2}",symbol,strDate,watchListName)); + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("Delete price {0} on {1}, watchlist {2}", symbol, strDate, watchListName)); DeletePriceSymbol(symbol, strDate); } } catch (Exception exception) { - MDTrace.WriteLine(LogLevel.DEBUG,exception); + MDTrace.WriteLine(LogLevel.DEBUG, exception); } } diff --git a/MarketData/MarketDataLib/Helper/MarketDataHelper.cs b/MarketData/MarketDataLib/Helper/MarketDataHelper.cs index fa49e0e..7421996 100755 --- a/MarketData/MarketDataLib/Helper/MarketDataHelper.cs +++ b/MarketData/MarketDataLib/Helper/MarketDataHelper.cs @@ -5101,9 +5101,98 @@ namespace MarketData.Helper } } + /// + /// GetLatestPriceBarChart - This is a new feed I am implementing because I am having difficulty retrieving prices from MarketWatch(BigCharts) + /// I am planning to use this field initially as a sweep to run after the BigCharts feed and prior to the Yahoo Sweep + /// + /// + /// + public static Price GetLatestPriceBarChart(String symbol) + { + HttpNetResponse httpNetResponse = null; + try + { + StringBuilder sb = new StringBuilder(); + String strRequest; + if (null == symbol) return null; + + sb = new StringBuilder(); + sb.Append("https://www.barchart.com/stocks/quotes/").Append(symbol).Append("/overview"); + strRequest = sb.ToString(); + WebProxy webProxy = HttpNetRequest.GetProxy("GetLatestPriceBarChart"); + httpNetResponse = HttpNetRequest.GetRequestNoEncodingV3C(strRequest, webProxy); + if (!httpNetResponse.Success) + { + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("GetLatestPriceBarChart: Request:{0} failed with status {1}", httpNetResponse.Request, httpNetResponse.StatusCode)); + return null; + } + String beginMarker = "data-ng-init='init(\"" + symbol + "\""; + String endMarker = ">"; + String item = Utility.BetweenString(httpNetResponse.ResponseString, beginMarker, endMarker); + if (null == item) return null; + item = item.Replace(""", "\""); + item = item.Replace("{", null); + item = item.Replace("}", null); + String[] pairs = item.Split(","); + Dictionary values = CreateBarChartValues(pairs); + Price price = new Price(); + price.Symbol = symbol; + price.Date = DateTime.Now; + price.Source = Price.PriceSource.BarChart; + if (values.ContainsKey("lowPrice")) price.Low = values["lowPrice"]; + if (values.ContainsKey("highPrice")) price.High = values["highPrice"]; + if (values.ContainsKey("openPrice")) price.Open = values["openPrice"]; + if (values.ContainsKey("lastPrice")) price.Close = values["lastPrice"]; + if (values.ContainsKey("volume")) price.Volume = (long)values["volume"]; + if (values.ContainsKey("prevClose")) price.PrevClose = values["prevClose"]; + else price.PrevClose = price.Close; + price.AdjClose = price.Close; + MarketDataHelper.CheckPrice(price); + if (double.IsNaN(price.Open) && double.IsNaN(price.High) && double.IsNaN(price.Low) && double.IsNaN(price.Close)) + { + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("*** No closing price for {0}", price.Symbol)); + return null; + } + if (double.IsNaN(price.Open)) price.Open = 0.00; + if (double.IsNaN(price.Low)) price.Low = 0.00; + if (double.IsNaN(price.High)) price.High = 0.00; + if (0 != price.Close && 0 == price.Open && 0 == price.High && 0 == price.Low) + { + price.Open = price.High = price.Low = price.Close; + } + return price; + } + catch (Exception exception) + { + MDTrace.WriteLine(LogLevel.DEBUG, exception.ToString()); + return null; + } + } + + private static Dictionary CreateBarChartValues(String[] pairs) + { + Dictionary barChartValues = new Dictionary(); + if (null == pairs || 0 == pairs.Length) return barChartValues; + foreach (String item in pairs) + { + String[] nameValue = item.Split(":"); + if (null == nameValue || 2 != nameValue.Length) continue; + String name = nameValue[0].Replace("\"", null); + String value = nameValue[1].Replace("\"",null); + double result = 0.00; + if (barChartValues.ContainsKey(name)) continue; + if (double.TryParse(value, out result)) + { + barChartValues.Add(name, result); + } + } + return barChartValues; + } + + // ******************************************************************************************************************************************************************************* -// ************************************************************** H I S T O R I C A L P R I C E S - B I G C H A R T S ******************************************************** -// ******************************************************************************************************************************************************************************* + // ************************************************************** H I S T O R I C A L P R I C E S - B I G C H A R T S ******************************************************** + // ******************************************************************************************************************************************************************************* /// /// Gets historical pricing from BigCharts /// @@ -5111,24 +5200,25 @@ namespace MarketData.Helper /// Most recent date /// Most historical date /// Prices - public static Prices GetPricesAsOf(String symbol, DateTime startDate,DateTime endDate) + public static Prices GetPricesAsOf(String symbol, DateTime startDate, DateTime endDate) { - Prices prices=new Prices(); + Prices prices = new Prices(); - if(null==symbol)return null; - CompanyProfile companyProfile=CompanyProfileDA.GetCompanyProfile(symbol); - if(null!=companyProfile && companyProfile.FreezePricing) + if (null == symbol) return null; + CompanyProfile companyProfile = CompanyProfileDA.GetCompanyProfile(symbol); + if (null != companyProfile && companyProfile.FreezePricing) { - MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Pricing for {0} is frozen.",symbol)); + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("Pricing for {0} is frozen.", symbol)); return null; } - DateGenerator dateGenerator=new DateGenerator(); - List dates=dateGenerator.GenerateHistoricalDates(startDate,endDate); - for(int index=0;index dates = dateGenerator.GenerateHistoricalDates(startDate, endDate); + for (int index = 0; index < dates.Count; index++) { - DateTime currentDate=dates[index]; - Price price=GetPriceAsOf(symbol,currentDate); - if(null==price){MDTrace.WriteLine(LogLevel.DEBUG,String.Format("No data for {0} on {1}",symbol,Utility.DateTimeToStringMMHDDHYYYY(currentDate)));continue;}; + DateTime currentDate = dates[index]; + Price price = GetPriceAsOf(symbol, currentDate); + if (null == price) { MDTrace.WriteLine(LogLevel.DEBUG, String.Format("No data for {0} on {1}", symbol, Utility.DateTimeToStringMMHDDHYYYY(currentDate))); continue; } + ; prices.Add(price); } return prices; diff --git a/MarketData/MarketDataLib/Helper/PricingMarketDataHelper.cs b/MarketData/MarketDataLib/Helper/PricingMarketDataHelper.cs index f681663..532e15a 100755 --- a/MarketData/MarketDataLib/Helper/PricingMarketDataHelper.cs +++ b/MarketData/MarketDataLib/Helper/PricingMarketDataHelper.cs @@ -165,47 +165,15 @@ namespace MarketData.Helper MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[UpdatePricesBigCharts]End, total took {0}(ms)",profiler.End())); } } - public bool UpdatePricesYahooSweep(DateTime? startDate=null) // get prices from Yahoo - { - Profiler profiler=new Profiler(); - try - { - symbols=PricingDA.GetSymbols(); - currentIndex=0; - if(null==startDate) startDate=DateTime.Now; - while(true) - { - List queueSymbols=GetQueueSymbols(); - if(null==queueSymbols||0==queueSymbols.Count) break; - ManualResetEvent[] resetEvents=new ManualResetEvent[queueSymbols.Count]; - for(int eventIndex=0;eventIndex(); - symbols.Add(symbol); - currentIndex=0; + symbols = PricingDA.GetSymbols(); + currentIndex = 0; + if (null == startDate) startDate = DateTime.Now; while (true) { List queueSymbols = GetQueueSymbols(); @@ -217,19 +185,92 @@ namespace MarketData.Helper } for (int index = 0; index < queueSymbols.Count; index++) { - PricingThreadHelper pricingThreadHelper = new PricingThreadHelper(queueSymbols[index], resetEvents[index],asOf); - ThreadPool.QueueUserWorkItem(ThreadPoolCallbackUpdatePricesAsOf, pricingThreadHelper); - try{Thread.Sleep(WaitBetweenRequests);}catch(Exception){;} + PricingThreadHelper pricingThreadHelper = new PricingThreadHelper(queueSymbols[index], startDate.Value, resetEvents[index]); + ThreadPool.QueueUserWorkItem(ThreadPoolCallbackUpdatePricesYahooSweep, pricingThreadHelper); + try { Thread.Sleep(WaitBetweenRequests); } catch (Exception) {; } } - MDTrace.WriteLine(LogLevel.DEBUG,"UpdatePricesAsOfSymbol, waiting for queued items to complete."); + MDTrace.WriteLine(LogLevel.DEBUG, "UpdatePricesYahooSweep, waiting for queued items to complete."); WaitHandle.WaitAll(resetEvents); } return true; } finally { - MDTrace.WriteLine(LogLevel.DEBUG,String.Format("[UpdatePricesAsOfSymbol]End, total took {0}(ms)",profiler.End())); - } + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("[UpdatePricesYahooSweep]End, total took {0}(ms)", profiler.End())); + } + } + + /// + /// UpdatePricesBarChartSweep - This feed will retrieve latest price. It will not use a date + /// + /// + /// + public bool UpdatePricesBarChartSweep(DateTime? startDate = null) // get prices from BarCharts + { + Profiler profiler = new Profiler(); + try + { + symbols = PricingDA.GetSymbols(); + if (null == startDate) startDate = DateTime.Now; + currentIndex = 0; + while (true) + { + List 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, "UpdatePricesBarChartSweep, waiting for queued items to complete."); + WaitHandle.WaitAll(resetEvents); + } + return true; + } + finally + { + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("[UpdatePricesBarChartSweep]End, total took {0}(ms)", profiler.End())); + } + } + + public bool UpdatePricesAsOfSymbol(String symbol, DateTime asOf) // get prices from BigCharts + { + Profiler profiler = new Profiler(); + try + { + symbols = new List(); + symbols.Add(symbol); + currentIndex = 0; + while (true) + { + List 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], resetEvents[index], asOf); + ThreadPool.QueueUserWorkItem(ThreadPoolCallbackUpdatePricesAsOf, pricingThreadHelper); + try { Thread.Sleep(WaitBetweenRequests); } catch (Exception) {; } + } + MDTrace.WriteLine(LogLevel.DEBUG, "UpdatePricesAsOfSymbol, waiting for queued items to complete."); + WaitHandle.WaitAll(resetEvents); + } + return true; + } + finally + { + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("[UpdatePricesAsOfSymbol]End, total took {0}(ms)", profiler.End())); + } } public bool UpdatePriceAsOfSymbolYahoo(String symbol,DateTime asOf) // get prices from Yahoo { @@ -492,19 +533,33 @@ namespace MarketData.Helper { pricingThreadHelper.ResetEvent.Set(); } + } + public void ThreadPoolCallbackUpdatePricesBarChartSweep(Object pricingThreadHelperContext) + { + PricingThreadHelper pricingThreadHelper=(PricingThreadHelper)pricingThreadHelperContext; + try + { + MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load price (BarChart), Thread {0} started for {1}...",Thread.CurrentThread.ManagedThreadId,pricingThreadHelper.Symbol)); + UpdatePriceBarChartSweep(pricingThreadHelper.Symbol,pricingThreadHelper.PricingDate); + MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load price (BarChart), Thread {0} ended for {1}",Thread.CurrentThread.ManagedThreadId,pricingThreadHelper.Symbol)); + } + finally + { + pricingThreadHelper.ResetEvent.Set(); + } } public void ThreadPoolCallbackUpdatePricesAsOf(Object pricingThreadHelperContext) { - PricingThreadHelper pricingThreadHelper = (PricingThreadHelper)pricingThreadHelperContext; + PricingThreadHelper pricingThreadHelper = (PricingThreadHelper)pricingThreadHelperContext; try { - MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load price, Thread {0} started for {1}...", Thread.CurrentThread.ManagedThreadId, pricingThreadHelper.Symbol)); - UpdatePriceAsOfEx(pricingThreadHelper.Symbol,pricingThreadHelper.StartDate.Value); - MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load price, Thread {0} ended for {1}", Thread.CurrentThread.ManagedThreadId, pricingThreadHelper.Symbol)); + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("Load price, Thread {0} started for {1}...", Thread.CurrentThread.ManagedThreadId, pricingThreadHelper.Symbol)); + UpdatePriceAsOfEx(pricingThreadHelper.Symbol, pricingThreadHelper.StartDate.Value); + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("Load price, Thread {0} ended for {1}", Thread.CurrentThread.ManagedThreadId, pricingThreadHelper.Symbol)); } finally { - pricingThreadHelper.ResetEvent.Set(); + pricingThreadHelper.ResetEvent.Set(); } } public void ThreadPoolCallbackGetMissingPrice(Object pricingThreadHelperContext) @@ -733,7 +788,7 @@ namespace MarketData.Helper price=MarketDataHelper.GetDailyPrice(symbol,pricingDate); if(null==price) { - MDTrace.WriteLine(LogLevel.DEBUG,"No price (UpdatePriceYahoo) for '"+symbol+"'"); + MDTrace.WriteLine(LogLevel.DEBUG,"No price (UpdatePriceYahooSweep) for '"+symbol+"'"); return; } else if(!price.IsValid) @@ -752,35 +807,86 @@ namespace MarketData.Helper MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Exception {0}",exception.ToString())); } } - public static void UpdatePriceAsOfEx(String symbol,DateTime asOf) + /// + /// This feed is intended to supplement BigCharts and Yahoo feed. + /// It should run in the UPDATEDAILY2 chain after Yahoo during the nightly price capture. + /// It will only retrieve price for the current date AND it expects us to have a price for the previous business date. + /// In other words it will not fill pricing gaps, it will only add "tonights" price to an already established pricing history + /// + /// + /// + public static void UpdatePriceBarChartSweep(String symbol, DateTime pricingDate) + { + try + { + DateGenerator dateGenerator = new DateGenerator(); + DateTime prevBusinessDay = dateGenerator.FindPrevBusinessDay(pricingDate); + Price price = PricingDA.GetPrice(symbol); // retrieve the latest price for this symbol + if (null == price) // we don't have a price for the symbol so return + { + return; + } + if (price.Date.Date.Equals(pricingDate.Date)) + { + MDTrace.WriteLine(LogLevel.DEBUG, $"Already have latest price for {symbol} on {price.Date.ToShortDateString()}"); + return; + } + if (!prevBusinessDay.Date.Equals(price.Date.Date)) + { + MDTrace.WriteLine(LogLevel.DEBUG, $"Expected a date of {prevBusinessDay.ToShortDateString()} for {symbol} but found {price.Date.ToShortDateString()}"); + return; + } + MDTrace.WriteLine(LogLevel.DEBUG,$"Latest price for {symbol} is {price.Date.Date.ToShortDateString()}"); + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("UpdatePriceBarChartSweep: Requesting latest price for {0} ", symbol)); + price = MarketDataHelper.GetLatestPriceBarChart(symbol); + if (null == price) + { + MDTrace.WriteLine(LogLevel.DEBUG, "(UpdatePriceBarChartSweep) No price for '" + symbol + "'"); + return; + } + else if (!price.IsValid) + { + MDTrace.WriteLine(LogLevel.DEBUG, "(UpdatePriceBarChartSweep) Invalid price for '" + symbol + "'"); + return; + } + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("(UpdatePriceBarChartSweep) Inserting price {0}...", price.ToString())); + PricingDA.InsertPrice(price); + } + catch (Exception exception) + { + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("(UpdatePriceBarChartSweep) Exception {0}", exception.ToString())); + } + } + + public static void UpdatePriceAsOfEx(String symbol, DateTime asOf) { try { DateTime latestDate = PricingDA.GetLatestDate(symbol); - MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Latest pricing date for {0} is {1}",symbol,latestDate.ToShortDateString())); + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("Latest pricing date for {0} is {1}", symbol, latestDate.ToShortDateString())); if (latestDate.Equals(asOf)) { - MDTrace.WriteLine(LogLevel.DEBUG,"Already have price for '" + symbol + "' on "+Utility.DateTimeToStringMMHDDHYYYY(asOf)); + MDTrace.WriteLine(LogLevel.DEBUG, "Already have price for '" + symbol + "' on " + Utility.DateTimeToStringMMHDDHYYYY(asOf)); return; } - MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Retrieving price for {0} on {1} from BigCharts",symbol,asOf.ToShortDateString())); - Price price = MarketDataHelper.GetPriceAsOf(symbol,asOf); + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("Retrieving price for {0} on {1} from BigCharts", symbol, asOf.ToShortDateString())); + Price price = MarketDataHelper.GetPriceAsOf(symbol, asOf); if (null == price) { - MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Error retrieving price for {0} on {1}",symbol,asOf.ToShortDateString())); + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("Error retrieving price for {0} on {1}", symbol, asOf.ToShortDateString())); return; } - MDTrace.WriteLine(LogLevel.DEBUG,Price.Header); - MDTrace.WriteLine(LogLevel.DEBUG,price.ToString()); - MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Inserting price {0}...",price.ToString())); + MDTrace.WriteLine(LogLevel.DEBUG, Price.Header); + MDTrace.WriteLine(LogLevel.DEBUG, price.ToString()); + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("Inserting price {0}...", price.ToString())); PricingDA.InsertPrice(price); - MDTrace.WriteLine(LogLevel.DEBUG,""); + MDTrace.WriteLine(LogLevel.DEBUG, ""); } catch (Exception exception) { - MDTrace.WriteLine(LogLevel.DEBUG,exception.ToString()); + MDTrace.WriteLine(LogLevel.DEBUG, exception.ToString()); } - } + } public static void LoadPricesSymbolEx(String symbol,DateTime pricingDate) { diff --git a/MarketData/MarketDataLib/MarketDataModel/Prices.cs b/MarketData/MarketDataLib/MarketDataModel/Prices.cs index 5d7f287..fa3abf4 100755 --- a/MarketData/MarketDataLib/MarketDataModel/Prices.cs +++ b/MarketData/MarketDataLib/MarketDataModel/Prices.cs @@ -316,7 +316,7 @@ namespace MarketData.MarketDataModel // *************************************************************************************************************************************************************************** public class Price { - public enum PriceSource{Other=0,BigCharts=1,Yahoo=2,Fidelity=3,Google=4}; + public enum PriceSource{Other=0,BigCharts=1,Yahoo=2,Fidelity=3,Google=4,BarChart=5}; // !!IMPORTANT only add to this list. private String symbol; private DateTime date; private double open; @@ -377,6 +377,8 @@ namespace MarketData.MarketDataModel return "Fidelity"; case PriceSource.Google : return "Google"; + case PriceSource.BarChart : + return "BarChart"; default : return Constants.CONST_QUESTION; }