[Quantproject-developers] QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag WFLagCandidate
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2006-07-30 13:53:29
|
Update of /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv14660/b7_Scripts/WalkForwardTesting/WalkForwardLag Modified Files: WFLagCandidates.cs Log Message: - added a constructor's parameter checking procedure (at least two eligible tickers are required; lastQuoteDate is checked not to lead firstQuoteDate) - the public method GetTickersReturns has been added Index: WFLagCandidates.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b7_Scripts/WalkForwardTesting/WalkForwardLag/WFLagCandidates.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** WFLagCandidates.cs 14 May 2006 21:30:01 -0000 1.3 --- WFLagCandidates.cs 30 Jul 2006 13:53:26 -0000 1.4 *************** *** 44,51 **** --- 44,63 ---- DateTime firstQuoteDate , DateTime lastQuoteDate ) { + this.checkParameters( eligibleTickers , firstQuoteDate , + lastQuoteDate ); this.eligibleTickers = eligibleTickers; this.firstQuoteDate = firstQuoteDate; this.lastQuoteDate = lastQuoteDate; } + private void checkParameters( DataTable eligibleTickers , + DateTime firstQuoteDate , DateTime lastQuoteDate ) + { + if ( eligibleTickers.Rows.Count < 2 ) + throw new Exception( "eligibleTickers is expected to have at least " + + "two rows. It has less than two rows!" ); + if ( firstQuoteDate >= lastQuoteDate ) + throw new Exception( "firstQuoteDate has to be less than" + + "lastQuoteDate!" ); + } /// <summary> /// arrays of close to close returns, one for each ticker *************** *** 67,70 **** --- 79,98 ---- } + /// <summary> + /// arrays of close to close returns, one for each ticker + /// </summary> + /// <param name="tickers"></param> + /// <returns></returns> + public float[][] GetTickersReturns( string[] tickers ) + { + if ( this.closeToCloseReturns == null ) + this.set_closeToCloseReturns(); + float[][] tickersReturns = new float[ tickers.Length ][]; + int i = 0; + for ( i = 0 ; i < tickers.Length ; i++ ) + tickersReturns[ i ] = (float[])this.closeToCloseReturns[ tickers[ i ] ]; + return tickersReturns; + } + #region set_closeToCloseReturns private float[] getCloseToCloseTickerReturns( string ticker ) |