[Quantproject-developers] QuantProject/b2_DataAccess/Tables VisuallyValidatedQuotes.cs,1.1,1.2
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2004-04-01 15:55:03
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10666/b2_DataAccess/Tables Modified Files: VisuallyValidatedQuotes.cs Log Message: Added the GetRangeToRangeValidated method Index: VisuallyValidatedQuotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/VisuallyValidatedQuotes.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** VisuallyValidatedQuotes.cs 28 Mar 2004 20:10:05 -0000 1.1 --- VisuallyValidatedQuotes.cs 1 Apr 2004 15:43:02 -0000 1.2 *************** *** 4,7 **** --- 4,8 ---- using QuantProject.DataAccess; + using System.Collections; namespace QuantProject.DataAccess.Tables { *************** *** 17,20 **** --- 18,35 ---- // } + + + /// <summary> + /// Returns the hash value to be stored/read into/from the visuallyValidatedQuotes table + /// </summary> + /// <param name="quoteDate">Date whose neighborhood quotes are to be hashed</param> + /// <returns></returns> + private static string getHashValue( Quotes quotes , DateTime quoteDate ) + { + return quotes.GetHashValue( + quotes.GetPrecedingDate( quoteDate , ConstantsProvider.PrecedingDaysForVisualValidation ) , + quotes.GetFollowingDate( quoteDate , ConstantsProvider.PrecedingDaysForVisualValidation ) ); + } + /// <summary> /// writes to the database the visual validation of the Close to Close suspicious ratios *************** *** 33,39 **** new OleDbSingleTableAdapter( "select * from visuallyValidatedQuotes where 1=2" ); ! string hashValue = quotes.GetHashValue( ! quotes.GetPrecedingDate( quoteDate , ConstantsProvider.PrecedingDaysForVisualValidation ) , ! quotes.GetFollowingDate( quoteDate , ConstantsProvider.PrecedingDaysForVisualValidation ) ); oleDbSingleTableAdapter.DataTable.Rows.Add( oleDbSingleTableAdapter.DataTable.NewRow() ); oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ "vvTicker" ] = quotes.Ticker; --- 48,52 ---- new OleDbSingleTableAdapter( "select * from visuallyValidatedQuotes where 1=2" ); ! string hashValue = getHashValue( quotes , quoteDate ); oleDbSingleTableAdapter.DataTable.Rows.Add( oleDbSingleTableAdapter.DataTable.NewRow() ); oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ "vvTicker" ] = quotes.Ticker; *************** *** 51,54 **** --- 64,86 ---- } } + + /// <summary> + /// Returns the list of validated quote dates for the given ticker + /// </summary> + /// <param name="ticker">Instrument ticker whose validated quote dates are to be found</param> + /// <returns></returns> + public static ArrayList GetRangeToRangeValidated( string ticker ) + { + ArrayList tickers = new ArrayList(); + Quotes quotes = new Quotes( ticker ); + DataTable validatedQuotes = + SqlExecutor.GetDataTable( "select * from visuallyValidatedQuotes where vvTicker='" + ticker + "'" ); + foreach ( DataRow dataRow in validatedQuotes.Rows ) + if ( (string)dataRow[ "vvHashValue" ] == getHashValue( quotes , (DateTime)dataRow[ "vvDate" ] ) ) + // the current quote date had been visually validated with respect to the neighborhood quotes + tickers.Add( dataRow[ "vvDate" ] ); + /// TO DO !!! add else branch to raise event 'broken hash value' + return tickers; + } } } |