[Quantproject-developers] QuantDownloader/Downloader/OpenTickDownloader/BarsSelectors MissingDaily
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2009-01-04 17:48:02
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/BarsSelectors In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6211/Downloader/OpenTickDownloader/BarsSelectors Modified Files: MissingDailyBarsSelector.cs Log Message: Sql code has been removed from this class: a new constructor for QuantProject.Data.DataTables.Bars has been added Index: MissingDailyBarsSelector.cs =================================================================== RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/OpenTickDownloader/BarsSelectors/MissingDailyBarsSelector.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** MissingDailyBarsSelector.cs 20 Jul 2008 20:27:09 -0000 1.1 --- MissingDailyBarsSelector.cs 4 Jan 2009 17:47:57 -0000 1.2 *************** *** 3,7 **** MissingDailyBarsSelector.cs ! Copyright (C) 2008 Glauco Siliprandi --- 3,7 ---- MissingDailyBarsSelector.cs ! Copyright (C) 2008 Glauco Siliprandi *************** *** 19,23 **** along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; --- 19,23 ---- along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! */ using System; *************** *** 26,29 **** --- 26,30 ---- using QuantProject.ADT.Collections; + using QuantProject.ADT.Timing; using QuantProject.Data; using QuantProject.DataAccess; *************** *** 50,54 **** public MissingDailyBarsSelector( ! string[] tickers , DateTime firstDate , DateTime lastDate , --- 51,55 ---- public MissingDailyBarsSelector( ! string[] tickers , DateTime firstDate , DateTime lastDate , *************** *** 75,132 **** #region getBarsInTheDatabase ! private string getSqlTimeConstant( DateTime time ) ! { ! string sqlTimeConstant = ! time.Hour.ToString().PadLeft( 2 , '0' ) + ":" + ! time.Minute.ToString().PadLeft( 2 , '0' ) + ":" + ! time.Second.ToString().PadLeft( 2 , '0' ); ! return sqlTimeConstant; ! } ! private string getSqlTimeConstantForFirstDailyBar() ! { ! string sqlTimeConstantForFirstDailyBar = ! this.getSqlTimeConstant( ! this.firstBarOpenTimeInNewYorkTimeZone ); ! return sqlTimeConstantForFirstDailyBar; ! } ! #region getSqlTimeConstantForLastDailyBar ! private DateTime getLastBarOpenTimeInNewYorkTimeZone() { int secondsToBeAdded = this.barInterval * ( this.numberOfBarsToBeDownloadedForEachDay - 1 ); ! DateTime lastBarOpenTimeInNewYorkTimeZone = this.firstBarOpenTimeInNewYorkTimeZone.AddSeconds( secondsToBeAdded ); return lastBarOpenTimeInNewYorkTimeZone; } - private string getSqlTimeConstantForLastDailyBar() - { - DateTime lastBarOpenTimeInNewYorkTimeZone = - this.getLastBarOpenTimeInNewYorkTimeZone(); - string sqlTimeConstantForLastDailyBar = - this.getSqlTimeConstant( - lastBarOpenTimeInNewYorkTimeZone ); - return sqlTimeConstantForLastDailyBar; - } - #endregion getSqlTimeConstantForLastDailyBar private DataTable getBarsInTheDatabase( string ticker ) { ! string sql = ! "select baDateTimeForOpen from bars " + ! "where (baTicker='" + ticker + "') and " + ! "(baInterval=" + this.barInterval + ") and" + ! "(baDateTimeForOpen>=" + ! DataBaseWriter.GetDateConstant( this.firstDate ) + ") and" + ! "(baDateTimeForOpen<" + ! DataBaseWriter.GetDateConstant( this.lastDate.AddDays( 1 ) ) ! + ") and" + ! "(Format([baDateTimeForOpen],'hh:mm:ss')>='" + ! this.getSqlTimeConstantForFirstDailyBar() + "') and" + ! "(Format([baDateTimeForOpen],'hh:mm:ss')<='" + ! this.getSqlTimeConstantForLastDailyBar() + "');"; DataTable barsInTheDatabase = ! SqlExecutor.GetDataTable( sql ); return barsInTheDatabase; } --- 76,154 ---- #region getBarsInTheDatabase ! // private string getSqlTimeConstant( DateTime time ) ! // { ! // string sqlTimeConstant = ! // time.Hour.ToString().PadLeft( 2 , '0' ) + ":" + ! // time.Minute.ToString().PadLeft( 2 , '0' ) + ":" + ! // time.Second.ToString().PadLeft( 2 , '0' ); ! // return sqlTimeConstant; ! // } ! // private string getSqlTimeConstantForFirstDailyBar() ! // { ! // string sqlTimeConstantForFirstDailyBar = ! // this.getSqlTimeConstant( ! // this.firstBarOpenTimeInNewYorkTimeZone ); ! // return sqlTimeConstantForFirstDailyBar; ! // } ! // #region getSqlTimeConstantForLastDailyBar ! // private DateTime getLastBarOpenTimeInNewYorkTimeZone() ! // { ! // int secondsToBeAdded = this.barInterval * ! // ( this.numberOfBarsToBeDownloadedForEachDay - 1 ); ! // DateTime lastBarOpenTimeInNewYorkTimeZone = ! // this.firstBarOpenTimeInNewYorkTimeZone.AddSeconds( ! // secondsToBeAdded ); ! // return lastBarOpenTimeInNewYorkTimeZone; ! // } ! // private string getSqlTimeConstantForLastDailyBar() ! // { ! // DateTime lastBarOpenTimeInNewYorkTimeZone = ! // this.getLastBarOpenTimeInNewYorkTimeZone(); ! // string sqlTimeConstantForLastDailyBar = ! // this.getSqlTimeConstant( ! // lastBarOpenTimeInNewYorkTimeZone ); ! // return sqlTimeConstantForLastDailyBar; ! // } ! // #endregion getSqlTimeConstantForLastDailyBar ! ! ! private Time getLastBarOpenTimeInNewYorkTimeZone() { int secondsToBeAdded = this.barInterval * ( this.numberOfBarsToBeDownloadedForEachDay - 1 ); ! DateTime lastBarOpenDateTimeInNewYorkTimeZone = this.firstBarOpenTimeInNewYorkTimeZone.AddSeconds( secondsToBeAdded ); + Time lastBarOpenTimeInNewYorkTimeZone = + new Time( lastBarOpenDateTimeInNewYorkTimeZone ); return lastBarOpenTimeInNewYorkTimeZone; } private DataTable getBarsInTheDatabase( string ticker ) { ! Time lastBarOpenTimeInNewYorkTimeZone = ! this.getLastBarOpenTimeInNewYorkTimeZone(); DataTable barsInTheDatabase = ! new QuantProject.Data.DataTables.Bars( ! ticker , this.firstDate , this.lastDate , ! new Time( this.firstBarOpenTimeInNewYorkTimeZone ) , ! lastBarOpenTimeInNewYorkTimeZone , ! this.barInterval ); ! // string sql = ! // "select baDateTimeForOpen from bars " + ! // "where (baTicker='" + ticker + "') and " + ! // "(baInterval=" + this.barInterval + ") and" + ! // "(baDateTimeForOpen>=" + ! // DataBaseWriter.GetDateConstant( this.firstDate ) + ") and" + ! // "(baDateTimeForOpen<" + ! // DataBaseWriter.GetDateConstant( this.lastDate.AddDays( 1 ) ) ! // + ") and" + ! // "(Format([baDateTimeForOpen],'hh:mm:ss')>='" + ! // this.getSqlTimeConstantForFirstDailyBar() + "') and" + ! // "(Format([baDateTimeForOpen],'hh:mm:ss')<='" + ! // this.getSqlTimeConstantForLastDailyBar() + "');"; ! // DataTable barsInTheDatabase = ! // SqlExecutor.GetDataTable( sql ); return barsInTheDatabase; } |