[Quantproject-developers] QuantProject/b2_DataAccess/Tables VisuallyValidatedQuotes.cs,1.2,1.3
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2004-05-09 16:26:06
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13853/b2_DataAccess/Tables Modified Files: VisuallyValidatedQuotes.cs Log Message: - added properties for field names - the ValidateCloseToClose method has been added - the ValidateRangeToRange method has been rewritten - the GetCloseToCloseValidated method has been added - the GetRangeToRangeValidated method has been fixed Index: VisuallyValidatedQuotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/VisuallyValidatedQuotes.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** VisuallyValidatedQuotes.cs 1 Apr 2004 15:43:02 -0000 1.2 --- VisuallyValidatedQuotes.cs 9 May 2004 16:25:57 -0000 1.3 *************** *** 12,15 **** --- 12,21 ---- public class VisuallyValidatedQuotes { + public static string Ticker = "vvTicker"; + public static string Date = "vvDate"; + public static string ValidationType = "vvValidationType"; + public static string HashValue = "vvHashValue"; + public static string EditDate = "vvEditDate"; + public VisuallyValidatedQuotes() { *************** *** 18,23 **** // } - - /// <summary> /// Returns the hash value to be stored/read into/from the visuallyValidatedQuotes table --- 24,27 ---- *************** *** 32,41 **** } ! /// <summary> ! /// writes to the database the visual validation of the Close to Close suspicious ratios ! /// </summary> ! /// <param name="quotes">contains all the quotes for the ticker to be validated</param> ! /// <param name="quoteDate">date to be validated</param> ! public static void ValidateRangeToRange( Quotes quotes , DateTime quoteDate ) { try --- 36,40 ---- } ! private static void validate( Quotes quotes , DateTime quoteDate , ValidationTypes validationType ) { try *************** *** 50,59 **** string hashValue = getHashValue( quotes , quoteDate ); oleDbSingleTableAdapter.DataTable.Rows.Add( oleDbSingleTableAdapter.DataTable.NewRow() ); ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ "vvTicker" ] = quotes.Ticker; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ "vvDate" ] = quoteDate; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ "vvValidationType" ] = ! ValidationTypes.RangeToRangeRatio; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ "vvHashValue" ] = hashValue; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ "vvEditDate" ] = DateTime.Now; oleDbSingleTableAdapter.OleDbDataAdapter.Update( oleDbSingleTableAdapter.DataTable ); } --- 49,58 ---- string hashValue = getHashValue( quotes , quoteDate ); oleDbSingleTableAdapter.DataTable.Rows.Add( oleDbSingleTableAdapter.DataTable.NewRow() ); ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.Ticker ] = quotes.Ticker; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.Date ] = quoteDate; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.ValidationType ] = ! validationType; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.HashValue ] = hashValue; ! oleDbSingleTableAdapter.DataTable.Rows[ 0 ][ VisuallyValidatedQuotes.EditDate ] = DateTime.Now; oleDbSingleTableAdapter.OleDbDataAdapter.Update( oleDbSingleTableAdapter.DataTable ); } *************** *** 66,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; } } } --- 65,124 ---- /// <summary> ! /// writes to the database the visual validation of the Close to Close suspicious ratios /// </summary> ! /// <param name="quotes">contains all the quotes for the ticker to be validated</param> ! /// <param name="quoteDate">date to be validated</param> ! public static void ValidateCloseToClose( Quotes quotes , DateTime quoteDate ) ! { ! validate( quotes , quoteDate , ValidationTypes.CloseToCloseRatio ); ! } ! ! /// <summary> ! /// writes to the database the visual validation of the Range to Range suspicious ratios ! /// </summary> ! /// <param name="quotes">contains all the quotes for the ticker to be validated</param> ! /// <param name="quoteDate">date to be validated</param> ! public static void ValidateRangeToRange( Quotes quotes , DateTime quoteDate ) ! { ! validate( quotes , quoteDate , ValidationTypes.RangeToRangeRatio ); ! } ! ! private static ArrayList getVisuallyValidatedArrayList( ! string ticker , ValidationTypes validationType ) { ArrayList tickers = new ArrayList(); Quotes quotes = new Quotes( ticker ); ! DataTable validatedQuotes = SqlExecutor.GetDataTable( ! "select * from visuallyValidatedQuotes " + ! "where " + VisuallyValidatedQuotes.Ticker + "='" + ticker + "'" + ! "and " + VisuallyValidatedQuotes.ValidationType + "=" + ! System.Convert.ToInt32( validationType ) ); 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; } + /// <summary> + /// Returns the list of visually validated quote dates for the given ticker, + /// with respect to the Close To Close ratio + /// </summary> + /// <param name="ticker">Instrument ticker whose validated quote dates are to be found</param> + /// <returns></returns> + public static ArrayList GetCloseToCloseValidated( string ticker ) + { + return getVisuallyValidatedArrayList( ticker , ValidationTypes.CloseToCloseRatio ); + } + /// <summary> + /// Returns the list of visually validated quote dates for the given ticker, + /// with respect to the Range To Range ratio + /// </summary> + /// <param name="ticker">Instrument ticker whose validated quote dates are to be found</param> + /// <returns></returns> + public static ArrayList GetRangeToRangeValidated( string ticker ) + { + return getVisuallyValidatedArrayList( ticker , ValidationTypes.RangeToRangeRatio ); + } } } |