[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Statisti
Brought to you by:
glauco_1
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/StatisticsSummaryRows In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13426/a2_Accounting/h5_Reporting/StatisticsSummaryRows Modified Files: AverageReturnOnDayOfWeekWithOpenPositions.cs AverageReturnOnDayWithOpenPositions.cs Log Message: The new revision moves toward an intraday enabled framework. EndOfDayDate time has been removed, DateTime is used now. The code has been changed accordingly. Index: AverageReturnOnDayOfWeekWithOpenPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/StatisticsSummaryRows/AverageReturnOnDayOfWeekWithOpenPositions.cs,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AverageReturnOnDayOfWeekWithOpenPositions.cs 18 Aug 2008 21:13:16 -0000 1.3 --- AverageReturnOnDayOfWeekWithOpenPositions.cs 29 Sep 2008 21:13:46 -0000 1.4 *************** *** 28,31 **** --- 28,32 ---- using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Accounting.Reporting.SummaryRows; + using QuantProject.Business.Timing; namespace QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows *************** *** 41,48 **** private double getReturnForDate(DateTime date, DateTime previousDate) { double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return (accountValueOnCloseForDate / accountValueOnCloseForPreviousDate) - 1.0; --- 42,54 ---- private double getReturnForDate(DateTime date, DateTime previousDate) { + // TODO: this method works only if the equity line is computed + // at market close; an exception is thrown otherwise; change the + // logic to be more general double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( date ) ); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( previousDate ) ); return (accountValueOnCloseForDate / accountValueOnCloseForPreviousDate) - 1.0; *************** *** 51,58 **** private bool hasPositionsOnDate( DateTime date, DateTime previousDate ) { double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return accountValueOnCloseForDate != accountValueOnCloseForPreviousDate; --- 57,69 ---- private bool hasPositionsOnDate( DateTime date, DateTime previousDate ) { + // TODO: this method works only if the equity line is computed + // at market close; an exception is thrown otherwise; change the + // logic to be more general double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( date ) ); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( previousDate ) ); return accountValueOnCloseForDate != accountValueOnCloseForPreviousDate; *************** *** 80,87 **** this.rowDescription = this.getRowDescription(); DayOfWeek specificDayOfWeek = this.getSpecificDayOfWeek(); ! History marketDays = Quotes.GetMarketDays( ! statisticsSummary.AccountReport.Benchmark, ! statisticsSummary.AccountReport.StartDateTime, ! statisticsSummary.AccountReport.EndDateTime.DateTime); DateTime date; DateTime previousDate; --- 91,100 ---- this.rowDescription = this.getRowDescription(); DayOfWeek specificDayOfWeek = this.getSpecificDayOfWeek(); ! // History marketDays = Quotes.GetMarketDays( ! // statisticsSummary.AccountReport.Benchmark, ! // statisticsSummary.AccountReport.StartDateTime, ! // statisticsSummary.AccountReport.EndDateTime); ! History marketDays = ! this.statisticsSummary.AccountReport.EquityLine; DateTime date; DateTime previousDate; Index: AverageReturnOnDayWithOpenPositions.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/StatisticsSummaryRows/AverageReturnOnDayWithOpenPositions.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** AverageReturnOnDayWithOpenPositions.cs 25 Apr 2008 17:11:41 -0000 1.1 --- AverageReturnOnDayWithOpenPositions.cs 29 Sep 2008 21:13:46 -0000 1.2 *************** *** 30,33 **** --- 30,34 ---- using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Accounting.Reporting.SummaryRows; + using QuantProject.Business.Timing; namespace QuantProject.Business.Financial.Accounting.Reporting.StatisticsSummaryRows *************** *** 56,63 **** private double getReturnForDate(DateTime date, DateTime previousDate) { double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return (accountValueOnCloseForDate / accountValueOnCloseForPreviousDate) - 1.0; --- 57,70 ---- private double getReturnForDate(DateTime date, DateTime previousDate) { + // TODO: this method works only if the equity line is computed + // at market close; an exception is thrown otherwise; change the + // logic to be more general; furthermore, this code is duplicated + // and common to AverageReturnOnDayOfWeekWithOpenPositions.cs double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( date ) ); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( previousDate ) ); return (accountValueOnCloseForDate / accountValueOnCloseForPreviousDate) - 1.0; *************** *** 66,73 **** private bool hasPositionsOnDate( DateTime date, DateTime previousDate ) { double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(date); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue(previousDate); return accountValueOnCloseForDate != accountValueOnCloseForPreviousDate; --- 73,87 ---- private bool hasPositionsOnDate( DateTime date, DateTime previousDate ) { + // TODO: this method works only if the equity line is computed + // at market close; an exception is thrown otherwise; change the + // logic to be more general; furthermore, this code is duplicated + // and common to AverageReturnOnDayOfWeekWithOpenPositions.cs double accountValueOnCloseForDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( date ) ); double accountValueOnCloseForPreviousDate = ! (double)this.statisticsSummary.AccountReport.EquityLine.GetValue( ! HistoricalEndOfDayTimer.GetMarketClose( ! previousDate ) ); return accountValueOnCloseForDate != accountValueOnCloseForPreviousDate; *************** *** 79,86 **** this.statisticsSummary = statisticsSummary; this.rowDescription = "Average % return on days with open positions "; ! History marketDays = Quotes.GetMarketDays( ! statisticsSummary.AccountReport.Benchmark, ! statisticsSummary.AccountReport.StartDateTime, ! statisticsSummary.AccountReport.EndDateTime.DateTime); DateTime date; DateTime previousDate; --- 93,102 ---- this.statisticsSummary = statisticsSummary; this.rowDescription = "Average % return on days with open positions "; ! // History marketDays = Quotes.GetMarketDays( ! // statisticsSummary.AccountReport.Benchmark, ! // statisticsSummary.AccountReport.StartDateTime, ! // statisticsSummary.AccountReport.EndDateTime); ! History marketDays = ! this.statisticsSummary.AccountReport.EquityLine; DateTime date; DateTime previousDate; |