[Quantproject-developers] QuantProject/b4_Business/a2_Strategies/TickersRelationships CorrelationP
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2008-01-30 23:11:38
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv4811/b4_Business/a2_Strategies/TickersRelationships Modified Files: CorrelationProvider.cs Log Message: GetPearsonCorrelation method has been improved (control and efficiency) Index: CorrelationProvider.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a2_Strategies/TickersRelationships/CorrelationProvider.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** CorrelationProvider.cs 14 Jan 2008 23:02:30 -0000 1.1 --- CorrelationProvider.cs 30 Jan 2008 23:11:32 -0000 1.2 *************** *** 178,182 **** public double GetPearsonCorrelation(string firstTicker, string secondTicker) { ! double returnValue = -2.0; if( this.pearsonCorrelations == null ) this.getOrderedTickersPearsonCorrelations_setCorrelations(); --- 178,182 ---- public double GetPearsonCorrelation(string firstTicker, string secondTicker) { ! double returnValue = double.NaN; if( this.pearsonCorrelations == null ) this.getOrderedTickersPearsonCorrelations_setCorrelations(); *************** *** 188,195 **** (this.pearsonCorrelations[i].FirstTicker == secondTicker && this.pearsonCorrelations[i].SecondTicker == firstTicker) ) ! returnValue = this.pearsonCorrelations[i].CorrelationValue; } ! ! return returnValue; } --- 188,200 ---- (this.pearsonCorrelations[i].FirstTicker == secondTicker && this.pearsonCorrelations[i].SecondTicker == firstTicker) ) ! { ! returnValue = this.pearsonCorrelations[i].CorrelationValue; ! i = this.pearsonCorrelations.Length;//exit from for ! } } ! if( double.IsNaN(returnValue) ) ! throw new MissingCorrelationException(firstTicker, secondTicker); ! ! return returnValue; } |