[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Statisti
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2010-03-28 13:50:16
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/StatisticsSummaryRows In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv11959/a1_Financial/a2_Accounting/h5_Reporting/StatisticsSummaryRows Modified Files: AverageReturnOnDayOfWeekWithOpenPositions.cs Log Message: A little bug has been fixed, that came up when a return value next to zero was computed, and then the result was presented in exponential notation. In such cases, the first four digits of the mantissa where shown, then actully displaying a large (wrong) percentage return. Index: AverageReturnOnDayOfWeekWithOpenPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/StatisticsSummaryRows/AverageReturnOnDayOfWeekWithOpenPositions.cs,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** AverageReturnOnDayOfWeekWithOpenPositions.cs 29 Sep 2008 21:13:46 -0000 1.4 --- AverageReturnOnDayOfWeekWithOpenPositions.cs 28 Mar 2010 13:50:07 -0000 1.5 *************** *** 79,86 **** averagePercentageReturn = 100.0 * sumOfReturnsOnSpecificDayOfWeek / (double)totalNumberOfSpecificDayOfWeek; string numOfDays = totalNumberOfSpecificDayOfWeek.ToString(); ! return averagePercentageReturn.ToString().Substring(0,4) + ! "#" + ! numOfDays.Substring(0,Math.Min(numOfDays.Length,4)); } --- 79,95 ---- averagePercentageReturn = 100.0 * sumOfReturnsOnSpecificDayOfWeek / (double)totalNumberOfSpecificDayOfWeek; + averagePercentageReturn = Math.Round( averagePercentageReturn , 3 ); string numOfDays = totalNumberOfSpecificDayOfWeek.ToString(); ! ! string rowValue = averagePercentageReturn.ToString(); ! int digits = Math.Min( 4 , rowValue.Length ); ! rowValue = rowValue.Substring(0, digits ); ! rowValue += "#" + numOfDays.Substring(0,Math.Min(numOfDays.Length,4)); ! ! return rowValue; ! ! // return averagePercentageReturn.ToString().Substring(0,4) + ! // "#" + ! // numOfDays.Substring(0,Math.Min(numOfDays.Length,4)); } |