[Quantproject-developers] QuantProject/b2_DataAccess/Tables Quotes.cs,1.7,1.8 ValidatedTickers.cs,1.
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:30:20
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19524/b2_DataAccess/Tables Modified Files: Quotes.cs ValidatedTickers.cs Log Message: Many features have been moved from the DataAccess.Tables namespace to the Data.DataTables namespace Index: ValidatedTickers.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/ValidatedTickers.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ValidatedTickers.cs 8 May 2004 17:14:32 -0000 1.3 --- ValidatedTickers.cs 26 May 2004 15:30:09 -0000 1.4 *************** *** 23,38 **** ! /// <summary> ! /// Returns the hash value for the given instrument ! /// </summary> ! /// <param name="ticker">Instrument's ticker</param> ! /// <param name="startDate">Starting instrument quote's date, for hash value computation</param> ! /// <param name="endDate">Ending instrument quote's date, for hash value computation</param> ! /// <returns></returns> ! public static string GetHashValue( string ticker , DateTime startDate , DateTime endDate ) ! { ! Quotes quotes = new Quotes( ticker ); ! return quotes.GetHashValue( startDate , endDate ); ! } /// <summary> --- 23,38 ---- ! // /// <summary> ! // /// Returns the hash value for the given instrument ! // /// </summary> ! // /// <param name="ticker">Instrument's ticker</param> ! // /// <param name="startDate">Starting instrument quote's date, for hash value computation</param> ! // /// <param name="endDate">Ending instrument quote's date, for hash value computation</param> ! // /// <returns></returns> ! // public static string GetHashValue( string ticker , DateTime startDate , DateTime endDate ) ! // { ! // Quotes quotes = new Quotes( ticker ); ! // return quotes.GetHashValue( startDate , endDate ); ! // } /// <summary> *************** *** 51,54 **** --- 51,78 ---- } + public static void Validate( string ticker , DateTime startDate , + DateTime endDate , string hashValue ) + { + try + { + SqlExecutor.ExecuteNonQuery( "delete * from validatedTickers " + + "where " + ValidatedTickers.Ticker + "='" + ticker + "'" ); + OleDbSingleTableAdapter oleDbSingleTableAdapter = + new OleDbSingleTableAdapter(); + oleDbSingleTableAdapter.SetAdapter( "validatedTickers" ); + oleDbSingleTableAdapter.DataTable.Rows.Add( oleDbSingleTableAdapter.DataTable.NewRow() ); + oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ ValidatedTickers.Ticker ] = ticker; + oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ ValidatedTickers.StartDate ] = startDate; + oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ ValidatedTickers.StartDate ] = endDate; + oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ ValidatedTickers.HashValue ] = hashValue; + oleDbSingleTableAdapter.OleDbDataAdapter.Update( oleDbSingleTableAdapter.DataTable ); + } + catch ( Exception ex ) + { + string exceptionMessage = ex.Message + "\n" + ex.StackTrace; + Console.WriteLine( exceptionMessage ); + } + } + } } Index: Quotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/Quotes.cs,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Quotes.cs 22 May 2004 07:09:04 -0000 1.7 --- Quotes.cs 26 May 2004 15:30:09 -0000 1.8 *************** *** 486,521 **** } - /// <summary> - /// returns the Date for the quote that is precedingDays before - /// quoteDate - /// </summary> - /// <param name="quoteDate"></param> - /// <param name="precedingDays"></param> - /// <returns></returns> - public DateTime GetPrecedingDate( DateTime quoteDate , int precedingDays ) - { - History history = new History(); - history.Import( this.quotes , "quDate" , "quAdjustedClose" ); - return (DateTime) history.GetKey( Math.Max( 0 , - history.IndexOfKeyOrPrevious( quoteDate ) - - precedingDays ) ); - } - /// <summary> - /// returns the Date for the quote that is followingDays after - /// quoteDate - /// </summary> - /// <param name="quoteDate"></param> - /// <param name="precedingDays"></param> - /// <returns></returns> - public DateTime GetFollowingDate( DateTime quoteDate , int followingDays ) - { - History history = new History(); - history.Import( this.quotes , "quDate" , "quAdjustedClose" ); - return (DateTime) history.GetKey( Math.Max( 0 , - history.IndexOfKeyOrPrevious( quoteDate ) - - followingDays ) ); - } - /// <summary> --- 486,490 ---- |