Commit Latest
This commit is contained in:
@@ -333,59 +333,60 @@ namespace MarketData.Helper
|
||||
if(null!=httpNetResponse)httpNetResponse.Dispose();
|
||||
}
|
||||
}
|
||||
// ***************************************************************************************************************************************************************************************
|
||||
// ************************************************************************** S P L I T S F R O M E O D D A T A **********************************************************************
|
||||
// ***************************************************************************************************************************************************************************************
|
||||
// ***************************************************************************************************************************************************************************************
|
||||
// ************************************************************************** S P L I T S F R O M E O D D A T A **********************************************************************
|
||||
// ***************************************************************************************************************************************************************************************
|
||||
public static Splits GetSplits()
|
||||
{
|
||||
HttpNetResponse httpNetResponse=null;
|
||||
try
|
||||
{
|
||||
Splits splits=new Splits();
|
||||
StringBuilder sb=new StringBuilder();
|
||||
String strRequest;
|
||||
sb.Append("http://eoddata.com/splits.aspx");
|
||||
strRequest=sb.ToString();
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Getting splits {0}",strRequest));
|
||||
httpNetResponse=HttpNetRequest.GetRequestStreamZIPV2(strRequest);
|
||||
if(!httpNetResponse.Success)
|
||||
HttpNetResponse httpNetResponse = null;
|
||||
try
|
||||
{
|
||||
Splits splits = new Splits();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
String strRequest;
|
||||
sb.Append("http://eoddata.com/splits.aspx");
|
||||
strRequest = sb.ToString();
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("Getting splits {0}", strRequest));
|
||||
httpNetResponse = HttpNetRequest.GetRequestNoEncoding(strRequest);
|
||||
if (!httpNetResponse.Success)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Request:{0} failed with status {1}",httpNetResponse.Request,httpNetResponse.StatusCode));
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("Request:{0} failed with status {1}", httpNetResponse.Request, httpNetResponse.StatusCode));
|
||||
return null;
|
||||
}
|
||||
HtmlDocument htmlDocument=new HtmlDocument();
|
||||
MemoryStream memoryStream=new MemoryStream(httpNetResponse.ResponseStream.GetBuffer());
|
||||
HtmlDocument htmlDocument = new HtmlDocument();
|
||||
byte[] streamBytes = Encoding.ASCII.GetBytes(httpNetResponse.ResponseString);
|
||||
using MemoryStream memoryStream = new MemoryStream(streamBytes);
|
||||
htmlDocument.Load(memoryStream);
|
||||
HtmlNodeCollection divSection = htmlDocument.DocumentNode.SelectNodes("//*[@class=\"quotes\"]");
|
||||
HtmlNodeCollection divSection = htmlDocument.DocumentNode.SelectNodes("//*[@class=\"table-standard\"]");
|
||||
if (null == divSection || 0 == divSection.Count) return null;
|
||||
HtmlNodeCollection rows = divSection[0].SelectNodes(".//tr");
|
||||
for (int index = 0; index < rows.Count; index++)
|
||||
{
|
||||
Split split=new Split();
|
||||
Split split = new Split();
|
||||
HtmlNodeCollection headerColumns = rows[index].SelectNodes(".//th");
|
||||
if (null != headerColumns && headerColumns.Count > 0) continue;
|
||||
HtmlNodeCollection dataColumns = rows[index].SelectNodes(".//td");
|
||||
if(dataColumns.Count<4)continue;
|
||||
if(null!=dataColumns[0])split.Exchange=dataColumns[0].InnerText.Trim().ToUpper(); // exchange
|
||||
if(null!=dataColumns[1])split.Symbol=dataColumns[1].InnerText.Trim().ToUpper();
|
||||
if(null!=dataColumns[2])split.EffectiveDate=Utility.ParseDate(dataColumns[2].InnerText.Trim().ToUpper());
|
||||
if(null!=dataColumns[3])split.StrRatio=dataColumns[3].InnerText.Trim().ToUpper();
|
||||
if (dataColumns.Count < 4) continue;
|
||||
if (null != dataColumns[0]) split.Exchange = dataColumns[0].InnerText.Trim().ToUpper(); // exchange
|
||||
if (null != dataColumns[1]) split.Symbol = dataColumns[1].InnerText.Trim().ToUpper(); // symbol
|
||||
if (null != dataColumns[2]) split.EffectiveDate = DateTime.ParseExact(dataColumns[2].InnerText.Trim().ToUpper(),
|
||||
"dd MMM yyyy", new System.Globalization.CultureInfo("en-US"), DateTimeStyles.AssumeLocal);
|
||||
if (null != dataColumns[3]) split.StrRatio = dataColumns[3].InnerText.Trim().ToUpper(); // ratio
|
||||
splits.Add(split);
|
||||
}
|
||||
memoryStream.Close();
|
||||
memoryStream.Dispose();
|
||||
return splits;
|
||||
}
|
||||
catch(Exception exception)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,exception);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, exception);
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(null!=httpNetResponse)httpNetResponse.Dispose();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (null != httpNetResponse) httpNetResponse.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************************************************************************************************************************
|
||||
// ************************************************************************** G D P P E R C A P I T A D A T A W O R L D B A N K *************************************************
|
||||
// ***************************************************************************************************************************************************************************************
|
||||
@@ -1915,7 +1916,7 @@ namespace MarketData.Helper
|
||||
WebProxy webProxy=HttpNetRequest.GetProxy("GetConsumerPriceIndices");
|
||||
strRequest=sb.ToString();
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, String.Format("GetConsumerPriceIndices: {0}", strRequest));
|
||||
httpNetResponse=HttpNetRequest.GetRequestNoEncodingV5A(strRequest,300000,webProxy);
|
||||
httpNetResponse=HttpNetRequest.GetRequestNoEncodingV5C(strRequest,"www.bls.gov", 300000,webProxy);
|
||||
if(!httpNetResponse.Success)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("GetConsumerPriceIndices Request:{0} failed with status {1}",httpNetResponse.Request,httpNetResponse.StatusCode));
|
||||
|
||||
@@ -141,6 +141,7 @@ namespace MarketData.Utils
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
//"Aug 23, 2013"
|
||||
public static DateTime ParseValueDateTimeMonthFormat(String strText)
|
||||
{
|
||||
@@ -158,6 +159,7 @@ namespace MarketData.Utils
|
||||
return DateTime.Parse("01-01-0001");
|
||||
}
|
||||
}
|
||||
|
||||
// "Apr. 04"
|
||||
// "1:00pm"
|
||||
public static DateTime ParseValueDateTimeMonth(String strText)
|
||||
@@ -195,7 +197,6 @@ namespace MarketData.Utils
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sep. 25, 2022 at 4:31 p.m. ET
|
||||
public static DateTime ParseValueDateTimeMonthFormatTZ(String strText)
|
||||
{
|
||||
@@ -249,6 +250,7 @@ namespace MarketData.Utils
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static double ParseValue(String strText)
|
||||
{
|
||||
double value = double.NaN;
|
||||
|
||||
Reference in New Issue
Block a user