[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting AccountRe
Brought to you by:
glauco_1
|
From: <gla...@us...> - 2003-10-30 22:06:56
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting
In directory sc8-pr-cvs1:/tmp/cvs-serv932/b4_Business/a1_Financial/a2_Accounting/h5_Reporting
Modified Files:
AccountReport.cs
Log Message:
Improved Summary report:
- Added %Profit calculation.
- Annual system return now is normalized to 100%
- Added total number of trades statistics
- Added number of winning trades statistics
Some variable names have been fixed
Index: AccountReport.cs
===================================================================
RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/AccountReport.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AccountReport.cs 25 Oct 2003 16:48:58 -0000 1.2
--- AccountReport.cs 30 Oct 2003 22:06:51 -0000 1.3
***************
*** 265,268 ****
--- 265,269 ----
((double)roundTrade[ "ExitPrice" ] - (double)roundTrade[ "EntryPrice" ])/
((double)roundTrade[ "EntryPrice" ])*100;
+ roundTrade[ "%Profit" ] = roundTrade[ "%chg" ];
roundTrade[ "#bars" ] =
((TimeSpan)((DateTime)roundTrade[ "ExitDate" ] - (DateTime)roundTrade[ "EntryDate" ])).Days;
***************
*** 282,285 ****
--- 283,287 ----
roundTrade[ "%chg" ] =
((double)roundTrade[ "ExitPrice" ] - (double)roundTrade[ "EntryPrice" ])/100;
+ roundTrade[ "%Profit" ] = - ((double)roundTrade[ "%chg" ]);
roundTrade[ "#bars" ] =
((TimeSpan)((DateTime)roundTrade[ "ExitDate" ] - (DateTime)roundTrade[ "EntryDate" ])).Days;
***************
*** 371,377 ****
double totalROA = this.totalPnl / ( this.finalAccountValue - this.totalPnl );
summary[ "Information" ] = "Annual system % return";
! summary[ "Value" ] = ( Math.Pow( 1 + totalROA ,
! 1.0 / ( (double)this.intervalDays/365.0 ) ) ) - 1;
! // r = [(1+T)^(1/n)]-1
}
private void getSummary_setRow( DataTable summaryDataTable ,
--- 373,393 ----
double totalROA = this.totalPnl / ( this.finalAccountValue - this.totalPnl );
summary[ "Information" ] = "Annual system % return";
! summary[ "Value" ] = ( ( Math.Pow( 1 + totalROA ,
! 1.0 / ( (double)this.intervalDays/365.0 ) ) ) - 1 ) * 100;
! // r = [(1+T)^(1/n)]-1
! }
! private void getSummaryTable_setRow_TotalNumberOfTrades( DataRow summary )
! {
! double totalROA = this.totalPnl / ( this.finalAccountValue - this.totalPnl );
! summary[ "Information" ] = "Total # of trades";
! DataRow[] DataRows = this.roundTrades.DataTable.Select( "(ExitPrice is not null)" );
! summary[ "Value" ] = DataRows.Length;
! }
! private void getSummaryTable_setRow_NumberWinningTrades( DataRow summary )
! {
! double totalROA = this.totalPnl / ( this.finalAccountValue - this.totalPnl );
! summary[ "Information" ] = "Number winning trades";
! DataRow[] DataRows = this.roundTrades.DataTable.Select( "([%Profit] > 0)" );
! summary[ "Value" ] = DataRows.Length;
}
private void getSummary_setRow( DataTable summaryDataTable ,
***************
*** 390,393 ****
--- 406,413 ----
getSummary_setRow( summaryDataTable ,
new getSummaryTable_setRow( getSummaryTable_setRow_AnnualSystemPercentageReturn ) );
+ getSummary_setRow( summaryDataTable ,
+ new getSummaryTable_setRow( getSummaryTable_setRow_TotalNumberOfTrades ) );
+ getSummary_setRow( summaryDataTable ,
+ new getSummaryTable_setRow( getSummaryTable_setRow_NumberWinningTrades ) );
}
#endregion
***************
*** 408,414 ****
((TimeSpan)((DateTime)this.equity.DataTable.Rows[ this.equity.DataTable.Rows.Count - 1 ][ "Date" ] -
(DateTime)this.equity.DataTable.Rows[ 0 ][ "Date" ])).Days;
! DataTable equityDataTable = getSummaryDataTable();
return new ReportTable( reportName + " - Summary" ,
! equityDataTable );
}
--- 428,434 ----
((TimeSpan)((DateTime)this.equity.DataTable.Rows[ this.equity.DataTable.Rows.Count - 1 ][ "Date" ] -
(DateTime)this.equity.DataTable.Rows[ 0 ][ "Date" ])).Days;
! DataTable summaryDataTable = getSummaryDataTable();
return new ReportTable( reportName + " - Summary" ,
! summaryDataTable );
}
|