Merge remote-tracking branch 'origin/MKDT_BIGCHART'
This commit is contained in:
@@ -5232,9 +5232,16 @@ namespace MarketData.Helper
|
|||||||
for (int index = 0; index < dates.Count; index++)
|
for (int index = 0; index < dates.Count; index++)
|
||||||
{
|
{
|
||||||
DateTime currentDate = dates[index];
|
DateTime currentDate = dates[index];
|
||||||
Price price = GetPriceAsOf(symbol, currentDate);
|
Price price = GetPriceAsOfV2(symbol, currentDate);
|
||||||
if (null == price) { MDTrace.WriteLine(LogLevel.DEBUG, String.Format("No data for {0} on {1}", symbol, Utility.DateTimeToStringMMHDDHYYYY(currentDate))); continue; }
|
if (null == price)
|
||||||
;
|
{
|
||||||
|
price = GetPriceAsOf(symbol, currentDate);
|
||||||
|
if (null == price)
|
||||||
|
{
|
||||||
|
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("No price for {0} on {1}", symbol, Utility.DateTimeToStringMMHDDHYYYY(currentDate)));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
prices.Add(price);
|
prices.Add(price);
|
||||||
}
|
}
|
||||||
return prices;
|
return prices;
|
||||||
@@ -5372,29 +5379,38 @@ namespace MarketData.Helper
|
|||||||
if (null == tables || 0 == tables.Count) return null;
|
if (null == tables || 0 == tables.Count) return null;
|
||||||
HtmlNodeCollection rows = tables[0].SelectNodes(".//tr");
|
HtmlNodeCollection rows = tables[0].SelectNodes(".//tr");
|
||||||
if (rows.Count < 2) return null;
|
if (rows.Count < 2) return null;
|
||||||
HtmlNodeCollection data = rows[1].SelectNodes(".//td");
|
|
||||||
if (data.Count != 6)
|
|
||||||
{
|
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("The price retrieved for {0} does not contain the correct number of data elements (expected 6 data elements).", symbol));
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
Price price = new Price();
|
|
||||||
price.Source = Price.PriceSource.BigCharts;
|
|
||||||
price.Symbol = symbol.ToUpper();
|
|
||||||
String[] dateElements = data[0].InnerText.Trim().Split(" ");
|
|
||||||
|
|
||||||
price.Date = Utility.ParseDate(dateElements[0].Replace("\n",null));
|
Prices prices = new Prices();
|
||||||
price.Open = Utility.ParseCurrency(data[1].InnerText.Trim().Replace("\n",null));
|
for (int rowIndex = 1; rowIndex < rows.Count; rowIndex++)
|
||||||
price.High = Utility.ParseCurrency(data[2].InnerText.Trim().Replace("\n",null));
|
|
||||||
price.Low = Utility.ParseCurrency(data[3].InnerText.Trim().Replace("\n",null));
|
|
||||||
price.Close = price.AdjClose = Utility.ParseCurrency(data[4].InnerText.Trim().Replace("\n",null));
|
|
||||||
price.Volume = FeedParser.ParseValueLong(data[5].InnerText.Trim());
|
|
||||||
if (!(price.Date.Date.Equals(asOf.Date.Date)))
|
|
||||||
{
|
{
|
||||||
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("The price retrieved for {0} does not contain the requested date. Requested date {1} Retrieved date {2}", symbol, price.Date.ToShortDateString(), asOf.ToShortDateString()));
|
HtmlNodeCollection data = rows[rowIndex].SelectNodes(".//td");
|
||||||
|
if (data.Count != 6)
|
||||||
|
{
|
||||||
|
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("The price retrieved for {0} does not contain the correct number of data elements (expected 6 data elements).", symbol));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Price price = new Price();
|
||||||
|
price.Source = Price.PriceSource.BigCharts;
|
||||||
|
price.Symbol = symbol.ToUpper();
|
||||||
|
String[] dateElements = data[0].InnerText.Trim().Split(" ");
|
||||||
|
price.Date = Utility.ParseDate(dateElements[0].Replace("\n", null));
|
||||||
|
price.Open = Utility.ParseCurrency(data[1].InnerText.Trim().Replace("\n", null));
|
||||||
|
price.High = Utility.ParseCurrency(data[2].InnerText.Trim().Replace("\n", null));
|
||||||
|
price.Low = Utility.ParseCurrency(data[3].InnerText.Trim().Replace("\n", null));
|
||||||
|
price.Close = price.AdjClose = Utility.ParseCurrency(data[4].InnerText.Trim().Replace("\n", null));
|
||||||
|
price.Volume = FeedParser.ParseValueLong(data[5].InnerText.Trim());
|
||||||
|
prices.Add(price);
|
||||||
|
}
|
||||||
|
|
||||||
|
Price selectedPrice = prices.Where(x => x.Date.Date.Equals(asOf.Date.Date)).FirstOrDefault();
|
||||||
|
|
||||||
|
if (null == selectedPrice)
|
||||||
|
{
|
||||||
|
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("No price for {0} on {1}", symbol, asOf.ToShortDateString()));
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return price;
|
|
||||||
|
return selectedPrice;
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user