[Quantproject-developers] QuantDownloader/Downloader/Validate QuotesToBeValidated.cs,1.2,1.3
Brought to you by:
glauco_1
|
From: <gla...@us...> - 2003-12-16 16:32:01
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/Validate
In directory sc8-pr-cvs1:/tmp/cvs-serv27106/Validate
Modified Files:
QuotesToBeValidated.cs
Log Message:
Invokes the MultiValidator, to validate
itself.
Index: QuotesToBeValidated.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/Validate/QuotesToBeValidated.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** QuotesToBeValidated.cs 12 Dec 2003 00:16:14 -0000 1.2
--- QuotesToBeValidated.cs 16 Dec 2003 16:31:58 -0000 1.3
***************
*** 2,5 ****
--- 2,6 ----
using System.Data;
using System.Data.OleDb;
+ using QuantProject.Applications.Downloader.Validate.Validators;
namespace QuantProject.Applications.Downloader.Validate
***************
*** 12,15 ****
--- 13,24 ----
private string selectStatement;
private OleDbDataAdapter oleDbDataAdapter;
+
+ private double suspiciousRatio;
+
+ public double SuspiciousRatio
+ {
+ get { return this.suspiciousRatio; }
+ set { this.suspiciousRatio = value; }
+ }
public QuotesToBeValidated( string tickerIsLike )
***************
*** 30,80 ****
}
! public delegate void SuspiciousDataRowEventHandler(
! Object sender , SuspiciousDataRowEventArgs eventArgs );
public event SuspiciousDataRowEventHandler SuspiciousDataRow;
#region "Validate"
! #region "validate_currentQuotesRow_checkLogicalErrors"
! /// <summary>
! /// Adds a row if not ((Low <= Open) and (Open <= High) and (Low <= Close) and (Close <= High))
! /// </summary>
! /// <param name="quotesRow">Row of quotes to be checked</param>
! private void validate_currentQuotesRow_checkLogicalErrors_checkOHLC( DataRow quotesRow )
! {
! if (!
! ( ( Convert.ToDouble( quotesRow[ "quLow" ] ) <=
! ( Convert.ToDouble( quotesRow[ "quOpen" ] ) ) ) &&
! ( Convert.ToDouble( quotesRow[ "quOpen" ] ) <=
! ( Convert.ToDouble( quotesRow[ "quHigh" ] ) ) ) &&
! ( Convert.ToDouble( quotesRow[ "quLow" ] ) <=
! ( Convert.ToDouble( quotesRow[ "quClose" ] ) ) ) &&
! ( Convert.ToDouble( quotesRow[ "quClose" ] ) <=
! ( Convert.ToDouble( quotesRow[ "quHigh" ] ) ) )
! )
! )
! SuspiciousDataRow( this , new SuspiciousDataRowEventArgs( quotesRow ) );
! }
! /// <summary>
! /// Adds an error row if quotesRow doesn't respect logical constraints
! /// </summary>
! /// <param name="quotesRow">Row of quotes to be checked</param>
! private void validate_currentQuotesRow_checkLogicalErrors( DataRow quotesRow )
! {
! validate_currentQuotesRow_checkLogicalErrors_checkOHLC( quotesRow );
! }
! #endregion
! /// <summary>
! /// Adds errors for the current quotesRow (if any)
! /// </summary>
! /// <param name="quotesRow">Row of quotes to be checked</param>
! private void validate_currentQuotesRow( DataRow quotesRow )
{
! validate_currentQuotesRow_checkLogicalErrors( quotesRow );
}
public void Validate()
{
! foreach ( DataRow quotesRow in this.Rows )
! this.validate_currentQuotesRow( quotesRow );
}
}
--- 39,65 ----
}
! // public delegate void SuspiciousDataRowEventHandler(
! // Object sender , SuspiciousDataRowEventArgs eventArgs );
public event SuspiciousDataRowEventHandler SuspiciousDataRow;
#region "Validate"
! private void suspiciousDataRowHandler( Object sender ,
! SuspiciousDataRowEventArgs eventArgs )
{
! SuspiciousDataRow( this , eventArgs );
}
public void Validate()
{
! // QuantProject.Applications.Downloader.Validate.Validators.OHLCvalidator oHLCvalidator =
! // new QuantProject.Applications.Downloader.Validate.Validators.OHLCvalidator();
! // oHLCvalidator.SuspiciousDataRow +=
! // new SuspiciousDataRowEventHandler( suspiciousDataRowHandler );
! // oHLCvalidator.Validate( this );
! MultiValidator multiValidator = new MultiValidator();
! multiValidator.SuspiciousRatio = this.suspiciousRatio;
! multiValidator.SuspiciousDataRow +=
! new SuspiciousDataRowEventHandler( this.suspiciousDataRowHandler );
! multiValidator.Validate( this );
}
}
|