[Quantproject-developers] QuantDownloader/Downloader/OpenTickDownloader OTTickerDownloader.cs, 1.7
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2009-01-29 19:48:35
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv9501/OpenTickDownloader Modified Files: OTTickerDownloader.cs Log Message: A new constructor has been added: the goal is to let the class use either a BarsSelectorBasedOHLCRequester or a OHLCRequesterForConsecutiveBars. In this revision only the constructor that builds a BarsSelectorBasedOHLCRequester works (that's pretty much the same behavior of the previous revision). An actually new capability would be given by the OHLCRequesterForConsecutiveBars, but it doesn't work yet. Index: OTTickerDownloader.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/OTTickerDownloader.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** OTTickerDownloader.cs 11 Jan 2009 20:37:47 -0000 1.7 --- OTTickerDownloader.cs 29 Jan 2009 19:48:32 -0000 1.8 *************** *** 44,49 **** --- 44,54 ---- { private string[] tickersToDownload; + private List<Time> dailyTimes; private DateTime firstDate; + + private DateTime dateTimeForFirstBarOpenInNewYorkTimeZone; + private DateTime dateTimeForLastBarOpenInNewYorkTimeZone; + /// <summary> /// number of seconds in each bar *************** *** 64,68 **** private IExchangeSelector exchangeSelector; ! private IBarsSelector barsSelector; private BarsDownloader barsDownloader; private MessageManager messageManager; --- 69,73 ---- private IExchangeSelector exchangeSelector; ! private IOHLCRequester oHLCRequester; private BarsDownloader barsDownloader; private MessageManager messageManager; *************** *** 130,133 **** --- 135,167 ---- } + public OTTickerDownloader( + string[] tickersToDownload, + DateTime dateTimeForFirstBarOpenInNewYorkTimeZone, + DateTime dateTimeForLastBarOpenInNewYorkTimeZone, + int barInterval , + string openTickUser, + string openTickPassword) + { + this.otTickerDownloader_checkParameters(tickersToDownload, + firstDate, + dateTimeForFirstBarOpenInNewYorkTimeZone, + false, + false, + false, + openTickUser, + openTickPassword); + this.tickersToDownload = tickersToDownload; + this.dailyTimes = null; + this.dateTimeForFirstBarOpenInNewYorkTimeZone = dateTimeForFirstBarOpenInNewYorkTimeZone; + this.dateTimeForLastBarOpenInNewYorkTimeZone = dateTimeForLastBarOpenInNewYorkTimeZone; + this.barInterval = barInterval; + this.dateTimeForOverWritingQuotes = DateTime.MaxValue; + this.checkForMissingQuotes = false; + this.overwriteAllQuotesInDatabase = false; + this.downloadOnlySuccessiveQuotesToTheLastQuoteInDatabase = false; + this.openTickUser = openTickUser; + this.openTickPassword = openTickPassword; + } + public event DownloadingStartedEventHandler DownloadingStarted; public event DatabaseUpdatedEventHandler DatabaseUpdated; *************** *** 171,175 **** return date; } ! private void setBarsSelector() { DateTime firstDateForBarsSelector = --- 205,210 ---- return date; } ! #region oHLCRequester ! private void setOHLCRequester_forSpecificDailyTimes() { DateTime firstDateForBarsSelector = *************** *** 179,200 **** if ( this.checkForMissingQuotes ) // only missing quotes are to be downloaded ! this.barsSelector = ! new MissingDailyBarsSelector( ! this.tickersToDownload , ! this.setBarsSelector_getDate( this.firstDate ) , ! this.setBarsSelector_getDate( DateTime.Now ) , ! this.barInterval , ! this.dailyTimes ); else // all quotes are to be downloaded, even if they // are in the database already ! this.barsSelector = ! new DailyBarsSelector( ! this.tickersToDownload , ! this.setBarsSelector_getDate( this.firstDate ) , ! this.setBarsSelector_getDate( DateTime.Now ) , ! this.barInterval , ! this.dailyTimes ); } private void setExchangeSelector() { --- 214,256 ---- if ( this.checkForMissingQuotes ) // only missing quotes are to be downloaded ! this.oHLCRequester = ! new BarsSelectorBasedOHLCRequester( ! new MissingDailyBarsSelector( ! this.tickersToDownload , ! this.setBarsSelector_getDate( this.firstDate ) , ! this.setBarsSelector_getDate( DateTime.Now ) , ! this.barInterval , ! this.dailyTimes ) ); else // all quotes are to be downloaded, even if they // are in the database already ! this.oHLCRequester = ! new BarsSelectorBasedOHLCRequester( ! new DailyBarsSelector( ! this.tickersToDownload , ! this.setBarsSelector_getDate( this.firstDate ) , ! this.setBarsSelector_getDate( DateTime.Now ) , ! this.barInterval , ! this.dailyTimes ) ); } + private void setOHLCRequester_forAllDailyBars() + { + this.oHLCRequester = + new OHLCRequesterForConsecutiveBars( + this.tickersToDownload , + this.dateTimeForFirstBarOpenInNewYorkTimeZone , + this.dateTimeForLastBarOpenInNewYorkTimeZone , + this.barInterval ); + } + private void setOHLCRequester() + { + if ( this.dailyTimes != null ) + // only some specific daily times have been requested + this.setOHLCRequester_forSpecificDailyTimes(); + else + // all daily bars have been requested + this.setOHLCRequester_forAllDailyBars(); + } + #endregion oHLCRequester private void setExchangeSelector() { *************** *** 225,229 **** this.barsDownloader = new BarsDownloader( ! this.barsSelector , this.exchangeSelector , this.openTickUser , --- 281,285 ---- this.barsDownloader = new BarsDownloader( ! this.oHLCRequester , this.exchangeSelector , this.openTickUser , *************** *** 269,273 **** private void downloadTickersActually() { ! this.setBarsSelector(); this.setExchangeSelector(); this.setBarsDownloaderAndRunIt(); --- 325,329 ---- private void downloadTickersActually() { ! this.setOHLCRequester(); this.setExchangeSelector(); this.setBarsDownloaderAndRunIt(); |