diff --git a/MarketDataLib/Helper/MarketDataHelper.cs b/MarketDataLib/Helper/MarketDataHelper.cs index aff9e26..f9f08a4 100644 --- a/MarketDataLib/Helper/MarketDataHelper.cs +++ b/MarketDataLib/Helper/MarketDataHelper.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Collections.Generic; using System.Text; @@ -4380,8 +4380,6 @@ namespace MarketData.Helper memoryStream = new MemoryStream(streamBytes); HtmlDocument htmlDocument = new HtmlDocument(); htmlDocument.Load(memoryStream); - // HtmlNodeCollection nodeCollection = htmlDocument.DocumentNode.SelectNodes("//*[@class=\"snapshot-table2\"]"); -// HtmlNodeCollection nodeCollection = htmlDocument.DocumentNode.SelectNodes("//*[@class=\"snapshot-table2 screener_snapshot-table-body\"]"); HtmlNodeCollection nodeCollection = htmlDocument.DocumentNode.SelectNodes("//*[@class=\"js-snapshot-table snapshot-table2 screener_snapshot-table-body\"]"); if(null==nodeCollection || nodeCollection.Count<1)return null; fundamental.AsOf=DateTime.Now; @@ -4790,6 +4788,13 @@ namespace MarketData.Helper private delegate Price LatestPriceDelegate(String symbol); public static Price GetLatestPrice(String symbol) { + 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)); + return null; + } DateTime currentMarketDate=PremarketDA.GetLatestMarketDate(); LatestPriceDelegate[] latestPriceDelegates=new LatestPriceDelegate[]{GetLatestPriceYahoo,GetLatestPriceBigCharts,GetLatestPriceGoogle}; Price latestPrice=null; @@ -4811,7 +4816,7 @@ namespace MarketData.Helper } latestPrice=GetPriceAsOf(symbol,currentMarketDate); // try to get the price from MarketWatch historical feed using todays date if(null!=latestPrice && latestPrice.Date.Date.Equals(currentMarketDate.Date)) return latestPrice; - CompanyProfile companyProfile=CompanyProfileDA.GetCompanyProfile(symbol); + if(null!=companyProfile && companyProfile.CanRollPrevious) { latestPrice=PricingMarketDataHelper.RollPriceForward(symbol); @@ -4824,7 +4829,6 @@ namespace MarketData.Helper // ******************** L A T E S T P R I C E R E T R I E V A L F O R I N T R A - D A Y F E E D ******** // *************************************************************************************************************** - public static Price GetLatestPriceYahoo(String symbol) { HttpNetResponse httpNetResponse=null; @@ -5297,6 +5301,14 @@ namespace MarketData.Helper public static Prices GetPricesAsOf(String symbol, DateTime startDate,DateTime endDate) { Prices prices=new Prices(); + + 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)); + return null; + } DateGenerator dateGenerator=new DateGenerator(); List dates=dateGenerator.GenerateHistoricalDates(startDate,endDate); for(int index=0;indexendDate)