[Quantproject-developers] QuantProject/b2_DataAccess/Tables VisuallyValidatedQuotes.cs,1.3,1.4
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2004-05-26 15:36:04
|
Update of /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20593/b2_DataAccess/Tables Modified Files: VisuallyValidatedQuotes.cs Log Message: Many features have been moved from the DataAccess.Tables namespace to the Data.DataTables namespace Index: VisuallyValidatedQuotes.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b2_DataAccess/Tables/VisuallyValidatedQuotes.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** VisuallyValidatedQuotes.cs 9 May 2004 16:25:57 -0000 1.3 --- VisuallyValidatedQuotes.cs 26 May 2004 15:35:53 -0000 1.4 *************** *** 24,92 **** // } ! /// <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 ) ); ! } ! ! private static void validate( Quotes quotes , DateTime quoteDate , ValidationTypes validationType ) ! { ! try ! { ! SqlExecutor.ExecuteNonQuery( ! "delete * from visuallyValidatedQuotes where " + ! "vvTicker='" + quotes.Ticker + "' and " + ! "vvDate=" + SQLBuilder.GetDateConstant( quoteDate ) ); ! OleDbSingleTableAdapter oleDbSingleTableAdapter = ! new OleDbSingleTableAdapter( ! "select * from visuallyValidatedQuotes where 1=2" ); ! 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 ); ! } ! catch ( Exception ex ) ! { ! string exceptionMessage = ex.Message + "\n" + ex.StackTrace; ! Console.WriteLine( exceptionMessage ); ! } ! } ! ! /// <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 " + --- 24,90 ---- // } ! // /// <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 ) ); ! // } ! // ! // private static void validate( Quotes quotes , DateTime quoteDate , ValidationTypes validationType ) ! // { ! // try ! // { ! // SqlExecutor.ExecuteNonQuery( ! // "delete * from visuallyValidatedQuotes where " + ! // "vvTicker='" + quotes.Ticker + "' and " + ! // "vvDate=" + SQLBuilder.GetDateConstant( quoteDate ) ); ! // OleDbSingleTableAdapter oleDbSingleTableAdapter = ! // new OleDbSingleTableAdapter( ! // "select * from visuallyValidatedQuotes where 1=2" ); ! // 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 ); ! // } ! // catch ( Exception ex ) ! // { ! // string exceptionMessage = ex.Message + "\n" + ex.StackTrace; ! // Console.WriteLine( exceptionMessage ); ! // } ! // } ! // ! // /// <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 ); ! // } ! public static DataTable GetValidatedQuotes( string ticker , ValidationTypes validationType ) { DataTable validatedQuotes = SqlExecutor.GetDataTable( "select * from visuallyValidatedQuotes " + *************** *** 94,124 **** "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 ); } } } --- 92,119 ---- "and " + VisuallyValidatedQuotes.ValidationType + "=" + System.Convert.ToInt32( validationType ) ); ! // foreach ( DataRow dataRow in validatedQuotes.Rows ) ! // tickers.Add( dataRow[ "vvDate" ] ); ! return validatedQuotes; } + // /// <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 ); + // } } } |