[Quantproject-developers] QuantDownloader/Downloader/Validate ValidateDataTable.cs,1.1,1.2
Brought to you by:
glauco_1
|
From: <gla...@us...> - 2003-12-12 00:14:42
|
Update of /cvsroot/quantproject/QuantDownloader/Downloader/Validate
In directory sc8-pr-cvs1:/tmp/cvs-serv4618/Downloader/Validate
Modified Files:
ValidateDataTable.cs
Log Message:
Data validation has been moved to the
QuotesToBeValidated object.
Suspicious data rows now fire an event in
the QuotesToBeValidated object: this event is
handled by ValidateDataTable.
Index: ValidateDataTable.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantDownloader/Downloader/Validate/ValidateDataTable.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ValidateDataTable.cs 9 Dec 2003 22:17:59 -0000 1.1
--- ValidateDataTable.cs 12 Dec 2003 00:14:39 -0000 1.2
***************
*** 26,36 ****
}
- #region "addRows_forCurrentQuotesRow"
/// <summary>
/// Adds quotesRow to the ValidateDataTable
/// </summary>
/// <param name="quotesRow">Row of quotes to added</param>
! private void addRow( DataRow quotesRow )
{
DataRow dataRow = this.NewRow();
foreach (DataColumn dataColumn in quotesRow.Table.Columns )
--- 26,37 ----
}
/// <summary>
/// Adds quotesRow to the ValidateDataTable
/// </summary>
/// <param name="quotesRow">Row of quotes to added</param>
! private void suspiciousDataRowEventHandler( Object sender ,
! SuspiciousDataRowEventArgs eventArgs )
{
+ DataRow quotesRow = eventArgs.DataRow;
DataRow dataRow = this.NewRow();
foreach (DataColumn dataColumn in quotesRow.Table.Columns )
***************
*** 39,91 ****
//this.Rows.Add( quotesRow );
}
- #region "addRows_forCurrentQuotesRow_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 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" ] ) ) )
- )
- )
- addRow( 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 addRows_forCurrentQuotesRow_checkLogicalErrors( DataRow quotesRow )
- {
- 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 addRows_forCurrentQuotesRow( DataRow quotesRow )
- {
- addRows_forCurrentQuotesRow_checkLogicalErrors( quotesRow );
- }
- #endregion
-
- /// <summary>
- /// Adds all the probably wrong data quotes rows
- /// </summary>
- /// <param name="tickerIsLike">Contains the is like clause to fetch the tickers
- /// whose quotes are to be checked</param>
public void AddRows( string tickerIsLike )
{
QuotesToBeValidated quotesToBeValidated = new QuotesToBeValidated( tickerIsLike );
! foreach ( DataRow quotesRow in quotesToBeValidated.Rows )
! this.addRows_forCurrentQuotesRow( quotesRow );
this.AcceptChanges();
}
--- 40,49 ----
//this.Rows.Add( quotesRow );
}
public void AddRows( string tickerIsLike )
{
QuotesToBeValidated quotesToBeValidated = new QuotesToBeValidated( tickerIsLike );
! quotesToBeValidated.SuspiciousDataRow +=
! new QuotesToBeValidated.SuspiciousDataRowEventHandler( suspiciousDataRowEventHandler );
! quotesToBeValidated.Validate();
this.AcceptChanges();
}
|