Fix Yahoo Fundamental retrieval.
Fix SeekingAlpha news retrieval.
This commit is contained in:
@@ -158,7 +158,45 @@ namespace MarketData.Utils
|
||||
return DateTime.Parse("01-01-0001");
|
||||
}
|
||||
}
|
||||
// Sep. 25, 2022 at 4:31 p.m. ET
|
||||
// "Apr. 04"
|
||||
// "1:00pm"
|
||||
public static DateTime ParseValueDateTimeMonth(String strText)
|
||||
{
|
||||
try
|
||||
{
|
||||
if(null==strText)return DateTime.Parse("01-01-0001");
|
||||
|
||||
if(strText.EndsWith("am") || strText.EndsWith("pm"))
|
||||
{
|
||||
return DateTime.Now;
|
||||
}
|
||||
else if(strText.Contains("."))
|
||||
{
|
||||
strText=strText.Replace(".",null);
|
||||
String[] subItems=strText.Split(' ');
|
||||
DateTime currentDate = DateTime.Now;
|
||||
StringBuilder sb=new StringBuilder();
|
||||
sb.Append(subItems[0]).Append(" ");
|
||||
sb.Append(subItems[1]).Append(",").Append(" ");
|
||||
sb.Append(currentDate.Year.ToString());
|
||||
DateTime resultingDate = ParseValueDateTimeMonthFormat(sb.ToString());
|
||||
if(resultingDate>currentDate)resultingDate = new DateTime(resultingDate.Year-1,resultingDate.Month, resultingDate.Day);
|
||||
return resultingDate;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Utility.ParseDate(strText);
|
||||
}
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG, "[ParseValueDateTimeMonth] Error parsing date '" + strText + "', " + exception.ToString());
|
||||
return DateTime.Parse("01-01-0001");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sep. 25, 2022 at 4:31 p.m. ET
|
||||
public static DateTime ParseValueDateTimeMonthFormatTZ(String strText)
|
||||
{
|
||||
try
|
||||
@@ -177,7 +215,6 @@ namespace MarketData.Utils
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static DateTime? ParseRelativeDate(String strDate)
|
||||
{
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user