Eliminate TimeZoneInfo
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
using MarketData.MarketDataModel;
|
||||
using MarketData.DataAccess;
|
||||
using MarketData.Utils;
|
||||
using System.Net;
|
||||
|
||||
namespace MarketData.Helper
|
||||
{
|
||||
@@ -9,7 +8,6 @@ namespace MarketData.Helper
|
||||
{
|
||||
private DateTime pricingDate=DateTime.Parse("12-31-9999");
|
||||
private DateTime? startDate;
|
||||
private TimeZoneHelper timeZoneInfo;
|
||||
|
||||
public PricingThreadHelper(String symbol,ManualResetEvent resetEvent)
|
||||
{
|
||||
@@ -21,7 +19,6 @@ namespace MarketData.Helper
|
||||
Symbol = symbol;
|
||||
this.pricingDate=pricingDate;
|
||||
ResetEvent = resetEvent;
|
||||
timeZoneInfo=new TimeZoneHelper(pricingDate);
|
||||
}
|
||||
public PricingThreadHelper(String symbol, ManualResetEvent resetEvent,DateTime? startDate=null)
|
||||
{
|
||||
@@ -30,10 +27,6 @@ namespace MarketData.Helper
|
||||
this.startDate=startDate;
|
||||
ResetEvent = resetEvent;
|
||||
}
|
||||
public TimeZoneHelper TimeZoneInfo
|
||||
{
|
||||
get{return timeZoneInfo;}
|
||||
}
|
||||
public DateTime PricingDate
|
||||
{
|
||||
get{return pricingDate;}
|
||||
@@ -114,7 +107,6 @@ namespace MarketData.Helper
|
||||
symbols = PricingDA.GetSymbols();
|
||||
currentIndex=0;
|
||||
if(null==startDate)startDate=DateTime.Now;
|
||||
TimeZoneHelper timeZoneHelper=new TimeZoneHelper(startDate.Value);
|
||||
while (true)
|
||||
{
|
||||
List<String> queueSymbols = GetQueueSymbols();
|
||||
@@ -148,7 +140,6 @@ namespace MarketData.Helper
|
||||
symbols=PricingDA.GetSymbols();
|
||||
currentIndex=0;
|
||||
if(null==startDate) startDate=DateTime.Now;
|
||||
TimeZoneHelper timeZoneHelper=new TimeZoneHelper(startDate.Value);
|
||||
while(true)
|
||||
{
|
||||
List<String> queueSymbols=GetQueueSymbols();
|
||||
@@ -182,7 +173,6 @@ namespace MarketData.Helper
|
||||
symbols=PricingDA.GetSymbols();
|
||||
currentIndex=0;
|
||||
if(null==startDate) startDate=DateTime.Now;
|
||||
TimeZoneHelper timeZoneHelper=new TimeZoneHelper(startDate.Value);
|
||||
while(true)
|
||||
{
|
||||
List<String> queueSymbols=GetQueueSymbols();
|
||||
@@ -467,7 +457,7 @@ namespace MarketData.Helper
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load price (BigCharts), Thread {0} started for {1}...", Thread.CurrentThread.ManagedThreadId, pricingThreadHelper.Symbol));
|
||||
UpdatePriceBigChartsEx(pricingThreadHelper.Symbol,pricingThreadHelper.TimeZoneInfo);
|
||||
UpdatePriceBigChartsEx(pricingThreadHelper.Symbol,pricingThreadHelper.PricingDate);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load price (BigCharts), Thread {0} ended for {1}", Thread.CurrentThread.ManagedThreadId, pricingThreadHelper.Symbol));
|
||||
}
|
||||
finally
|
||||
@@ -481,7 +471,7 @@ namespace MarketData.Helper
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load price (Yahoo), Thread {0} started for {1}...",Thread.CurrentThread.ManagedThreadId,pricingThreadHelper.Symbol));
|
||||
UpdatePriceYahoo(pricingThreadHelper.Symbol,pricingThreadHelper.TimeZoneInfo);
|
||||
UpdatePriceYahoo(pricingThreadHelper.Symbol,pricingThreadHelper.PricingDate);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load price (Yahoo), Thread {0} ended for {1}",Thread.CurrentThread.ManagedThreadId,pricingThreadHelper.Symbol));
|
||||
}
|
||||
finally
|
||||
@@ -495,7 +485,7 @@ namespace MarketData.Helper
|
||||
try
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load price (Yahoo), Thread {0} started for {1}...",Thread.CurrentThread.ManagedThreadId,pricingThreadHelper.Symbol));
|
||||
UpdatePriceYahooSweep(pricingThreadHelper.Symbol,pricingThreadHelper.TimeZoneInfo);
|
||||
UpdatePriceYahooSweep(pricingThreadHelper.Symbol,pricingThreadHelper.PricingDate);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Load price (Yahoo), Thread {0} ended for {1}",Thread.CurrentThread.ManagedThreadId,pricingThreadHelper.Symbol));
|
||||
}
|
||||
finally
|
||||
@@ -664,18 +654,18 @@ namespace MarketData.Helper
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,exception.ToString());
|
||||
}
|
||||
}
|
||||
public static void UpdatePriceBigChartsEx(String symbol,TimeZoneHelper timeZoneInfo)
|
||||
public static void UpdatePriceBigChartsEx(String symbol,DateTime pricingDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
Price price=PricingDA.GetPrice(symbol,timeZoneInfo.StartDate);
|
||||
Price price=PricingDA.GetPrice(symbol,pricingDate);
|
||||
if(null!=price)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"Already have latest price for '" + symbol + "'");
|
||||
return;
|
||||
}
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Requesting price for {0} for start date:{1} end date:{2}",symbol,timeZoneInfo.StartDate,timeZoneInfo.StartDate));
|
||||
Prices prices = MarketDataHelper.GetPricesAsOf(symbol, timeZoneInfo.StartDate,timeZoneInfo.StartDate);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Requesting price for {0} for start date:{1} end date:{2}",symbol,pricingDate,pricingDate));
|
||||
Prices prices = MarketDataHelper.GetPricesAsOf(symbol, pricingDate,pricingDate);
|
||||
if (null == prices||0==prices.Count)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"No prices (GetPricesAsOf) for '" + symbol+ "'");
|
||||
@@ -697,18 +687,18 @@ namespace MarketData.Helper
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Exception {0}",exception.ToString()));
|
||||
}
|
||||
}
|
||||
public static void UpdatePriceYahoo(String symbol,TimeZoneHelper timeZoneInfo)
|
||||
public static void UpdatePriceYahoo(String symbol,DateTime pricingDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
Price price=PricingDA.GetPrice(symbol,timeZoneInfo.StartDate);
|
||||
Price price=PricingDA.GetPrice(symbol,pricingDate);
|
||||
if(null!=price)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"Already have latest price for '"+symbol+"'");
|
||||
return;
|
||||
}
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Requesting price for {0} for start date:{1} end date:{2}",symbol,timeZoneInfo.StartDate,timeZoneInfo.StartDate));
|
||||
price=MarketDataHelper.GetDailyPrice(symbol,timeZoneInfo.StartDate);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Requesting price for {0} for start date:{1} end date:{2}",symbol,pricingDate,pricingDate));
|
||||
price=MarketDataHelper.GetDailyPrice(symbol,pricingDate);
|
||||
if(null==price)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"No price (UpdatePriceYahoo) for '"+symbol+"'");
|
||||
@@ -725,12 +715,12 @@ namespace MarketData.Helper
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("Exception {0}",exception.ToString()));
|
||||
}
|
||||
}
|
||||
public static void UpdatePriceYahooSweep(String symbol,TimeZoneHelper timeZoneInfo)
|
||||
public static void UpdatePriceYahooSweep(String symbol,DateTime pricingDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
CompanyProfile companyProfile=CompanyProfileDA.GetCompanyProfile(symbol);
|
||||
Price price=PricingDA.GetPrice(symbol,timeZoneInfo.StartDate);
|
||||
Price price=PricingDA.GetPrice(symbol,pricingDate);
|
||||
if(null!=price)
|
||||
{
|
||||
if(companyProfile==null || !companyProfile.PricingSourceEnum.Equals(CompanyProfile.EnumPricingSource.YAHOO))
|
||||
@@ -739,8 +729,8 @@ namespace MarketData.Helper
|
||||
return;
|
||||
}
|
||||
}
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UpdatePriceYahooSweep: Requesting price for {0} for start date:{1} end date:{2}",symbol,timeZoneInfo.StartDate,timeZoneInfo.StartDate));
|
||||
price=MarketDataHelper.GetDailyPrice(symbol,timeZoneInfo.StartDate);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,String.Format("UpdatePriceYahooSweep: Requesting price for {0} for start date:{1} end date:{2}",symbol,pricingDate,pricingDate));
|
||||
price=MarketDataHelper.GetDailyPrice(symbol,pricingDate);
|
||||
if(null==price)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"No price (UpdatePriceYahoo) for '"+symbol+"'");
|
||||
|
||||
Reference in New Issue
Block a user