[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables Su
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2005-09-03 23:23:40
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6791/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables Modified Files: Summary.cs Log Message: - SharpeRatio has been introduced - old, useless code has been commented out Index: Summary.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/Summary.cs,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** Summary.cs 19 Jun 2005 14:46:59 -0000 1.16 --- Summary.cs 3 Sep 2005 23:23:32 -0000 1.17 *************** *** 25,28 **** --- 25,29 ---- private ReturnOnAccount returnOnAccount; private MaxEquityDrawDown maxEquityDrawDown; + private SharpeRatio sharpeRatio; private TotalNumberOfTrades totalNumberOfTrades; private NumberWinningTrades numberWinningTrades; *************** *** 75,78 **** --- 76,83 ---- get { return this.maxEquityDrawDown; } } + public SharpeRatio SharpeRatio + { + get { return this.sharpeRatio; } + } public TotalCommissionAmount TotalCommissionAmount { *************** *** 164,248 **** } #region "getSummaryTable_setRows" ! private void getSummary_setRow( SummaryRow summaryRow , DataTable summaryDataTable ) ! { ! if ( summaryRow.Value != null ) ! { ! DataRow summary = summaryDataTable.NewRow(); ! summary[ "Information" ] = summaryRow.Description; ! summary[ "Value" ] = summaryRow.Value; ! summaryDataTable.Rows.Add( summary ); ! } ! } ! private void getSummaryTable_setRows( DataTable summaryDataTable ) { ! getSummary_setRow( new TotalNetProfit( this ) , summaryDataTable ); this.returnOnAccount = new ReturnOnAccount( this ); - getSummary_setRow( this.returnOnAccount , summaryDataTable ); this.benchmarkPercentageReturn = new BenchmarkPercentageReturn( this , this.historicalQuoteProvider ); - getSummary_setRow( this.benchmarkPercentageReturn , - summaryDataTable ); this.numberWinningPeriods = new NumberWinningPeriods( this ); - getSummary_setRow( this.numberWinningPeriods , summaryDataTable ); this.numberLosingPeriods = new NumberLosingPeriods( this ); - getSummary_setRow( this.numberLosingPeriods , summaryDataTable ); - getSummary_setRow( new NumberEvenPeriods( this ) , summaryDataTable ); this.percentageWinningPeriods = new PercentageWinningPeriods( this ); - getSummary_setRow( this.percentageWinningPeriods , summaryDataTable ); - //this.getSummary_setRows_forEquityVsBenchmarkComparison(); this.totalNetProfit = new TotalNetProfit( this ); this.annualSystemPercentageReturn = new AnnualSystemPercentageReturn( this ); - getSummary_setRow( this.annualSystemPercentageReturn , summaryDataTable ); this.maxEquityDrawDown = new MaxEquityDrawDown( this ); ! getSummary_setRow( this.maxEquityDrawDown , summaryDataTable ); this.totalNumberOfTrades = new TotalNumberOfTrades( this ); - getSummary_setRow( this.totalNumberOfTrades , summaryDataTable ); this.numberWinningTrades = new NumberWinningTrades( this ); - getSummary_setRow( this.numberWinningTrades , summaryDataTable ); this.averageTradePercentageReturn = new AverageTradePercentageReturn( this ); - getSummary_setRow( this.averageTradePercentageReturn , summaryDataTable ); this.largestWinningTradePercentage = new LargestWinningTradePercentage( this ); - getSummary_setRow( this.largestWinningTradePercentage , summaryDataTable ); this.largestLosingTradePercentage = new LargestLosingTradePercentage( this ); - getSummary_setRow( this.largestLosingTradePercentage , summaryDataTable ); this.totalNumberOfLongTrades = new TotalNumberOfLongTrades( this ); - getSummary_setRow( this.totalNumberOfLongTrades , summaryDataTable ); this.numberWinningLongTrades = new NumberWinningLongTrades( this ); - getSummary_setRow( this.numberWinningLongTrades , summaryDataTable ); this.averageLongTradePercentageReturn = new AverageLongTradePercentageReturn( this ); - getSummary_setRow( this.averageLongTradePercentageReturn , summaryDataTable ); this.totalNumberOfShortTrades = new TotalNumberOfShortTrades( this ); - getSummary_setRow( this.totalNumberOfShortTrades , summaryDataTable ); this.numberWinningShortTrades = new NumberWinningShortTrades( this ); - getSummary_setRow( this.numberWinningShortTrades , summaryDataTable ); this.totalCommissionAmount = new TotalCommissionAmount( this ); ! getSummary_setRow( this.totalCommissionAmount , summaryDataTable ); ! // getSummary_setRow( summaryDataTable , ! // new getSummaryTable_setRow( getSummaryTable_setRow_TotalNumberOfShortTrades ) ); ! // getSummary_setRow( summaryDataTable , ! // new getSummaryTable_setRow( getSummaryTable_setRow_NumberWinningShortTrades ) ); ! // getSummary_setRow( summaryDataTable , ! // new getSummaryTable_setRow( getSummaryTable_setRow_AverageShortTradePercentageReturn ) ); ! } ! #endregion ! private DataTable getSummaryDataTable() ! { ! DataTable summaryDataTable = new DataTable(); ! getSummaryTable_setColumns( summaryDataTable ); ! getSummaryTable_setRows( summaryDataTable ); ! return summaryDataTable; ! } ! private void getSummary() ! { ! if ( this.accountReport.Equity.DataTable.Rows.Count == 0 ) ! throw new Exception( "A Summary computation has been requested, but the equity line is empty" ); ! this.totalPnl = ! (double)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "PnL" ]; ! this.finalAccountValue = ! (double)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "AccountValue" ]; ! this.intervalDays = ! ((TimeSpan)((DateTime)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "Date" ] - ! (DateTime)this.accountReport.Equity.DataTable.Rows[ 0 ][ "Date" ])).Days; ! this.DataTable = getSummaryDataTable(); } --- 169,274 ---- } #region "getSummaryTable_setRows" ! // private void getSummary_setRow( SummaryRow summaryRow , DataTable summaryDataTable ) ! // { ! // if ( summaryRow.Value != null ) ! // { ! // DataRow summary = summaryDataTable.NewRow(); ! // summary[ "Information" ] = summaryRow.Description; ! // summary[ "Value" ] = summaryRow.Value; ! // summaryDataTable.Rows.Add( summary ); ! // } ! // } ! // private void getSummaryTable_setRows( DataTable summaryDataTable ) ! // { ! //// getSummary_setRow( new TotalNetProfit( this ) , summaryDataTable ); ! // this.returnOnAccount = new ReturnOnAccount( this ); ! //// getSummary_setRow( this.returnOnAccount , summaryDataTable ); ! // this.benchmarkPercentageReturn = ! // new BenchmarkPercentageReturn( this , this.historicalQuoteProvider ); ! //// getSummary_setRow( this.benchmarkPercentageReturn , ! //// summaryDataTable ); ! // this.numberWinningPeriods = new NumberWinningPeriods( this ); ! //// getSummary_setRow( this.numberWinningPeriods , summaryDataTable ); ! // this.numberLosingPeriods = new NumberLosingPeriods( this ); ! //// getSummary_setRow( this.numberLosingPeriods , summaryDataTable ); ! //// getSummary_setRow( new NumberEvenPeriods( this ) , summaryDataTable ); ! // this.percentageWinningPeriods = new PercentageWinningPeriods( this ); ! //// getSummary_setRow( this.percentageWinningPeriods , summaryDataTable ); ! // //this.getSummary_setRows_forEquityVsBenchmarkComparison(); ! // this.totalNetProfit = new TotalNetProfit( this ); ! // this.annualSystemPercentageReturn = new AnnualSystemPercentageReturn( this ); ! //// getSummary_setRow( this.annualSystemPercentageReturn , summaryDataTable ); ! // this.maxEquityDrawDown = new MaxEquityDrawDown( this ); ! // // getSummary_setRow( this.maxEquityDrawDown , summaryDataTable ); ! // this.totalNumberOfTrades = new TotalNumberOfTrades( this ); ! //// getSummary_setRow( this.totalNumberOfTrades , summaryDataTable ); ! // this.numberWinningTrades = new NumberWinningTrades( this ); ! //// getSummary_setRow( this.numberWinningTrades , summaryDataTable ); ! // this.averageTradePercentageReturn = new AverageTradePercentageReturn( this ); ! //// getSummary_setRow( this.averageTradePercentageReturn , summaryDataTable ); ! // this.largestWinningTradePercentage = new LargestWinningTradePercentage( this ); ! //// getSummary_setRow( this.largestWinningTradePercentage , summaryDataTable ); ! // this.largestLosingTradePercentage = new LargestLosingTradePercentage( this ); ! //// getSummary_setRow( this.largestLosingTradePercentage , summaryDataTable ); ! // this.totalNumberOfLongTrades = new TotalNumberOfLongTrades( this ); ! //// getSummary_setRow( this.totalNumberOfLongTrades , summaryDataTable ); ! // this.numberWinningLongTrades = new NumberWinningLongTrades( this ); ! //// getSummary_setRow( this.numberWinningLongTrades , summaryDataTable ); ! // this.averageLongTradePercentageReturn = new AverageLongTradePercentageReturn( this ); ! //// getSummary_setRow( this.averageLongTradePercentageReturn , summaryDataTable ); ! // this.totalNumberOfShortTrades = new TotalNumberOfShortTrades( this ); ! //// getSummary_setRow( this.totalNumberOfShortTrades , summaryDataTable ); ! // this.numberWinningShortTrades = new NumberWinningShortTrades( this ); ! //// getSummary_setRow( this.numberWinningShortTrades , summaryDataTable ); ! // this.totalCommissionAmount = new TotalCommissionAmount( this ); ! //// getSummary_setRow( this.totalCommissionAmount , summaryDataTable ); ! // // getSummary_setRow( summaryDataTable , ! //// new getSummaryTable_setRow( getSummaryTable_setRow_TotalNumberOfShortTrades ) ); ! //// getSummary_setRow( summaryDataTable , ! //// new getSummaryTable_setRow( getSummaryTable_setRow_NumberWinningShortTrades ) ); ! //// getSummary_setRow( summaryDataTable , ! //// new getSummaryTable_setRow( getSummaryTable_setRow_AverageShortTradePercentageReturn ) ); ! // } ! #endregion ! // private DataTable getSummaryDataTable() ! // { ! // DataTable summaryDataTable = new DataTable(); ! // getSummaryTable_setColumns( summaryDataTable ); ! // getSummaryTable_setRows( summaryDataTable ); ! // return summaryDataTable; ! // } ! private void getSummary() { ! if ( this.accountReport.Equity.DataTable.Rows.Count == 0 ) ! throw new Exception( "A Summary computation has been requested, but the equity line is empty" ); ! this.totalPnl = ! (double)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "PnL" ]; ! this.finalAccountValue = ! (double)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "AccountValue" ]; ! this.intervalDays = ! ((TimeSpan)((DateTime)this.accountReport.Equity.DataTable.Rows[ this.accountReport.Equity.DataTable.Rows.Count - 1 ][ "Date" ] - ! (DateTime)this.accountReport.Equity.DataTable.Rows[ 0 ][ "Date" ])).Days; this.returnOnAccount = new ReturnOnAccount( this ); this.benchmarkPercentageReturn = new BenchmarkPercentageReturn( this , this.historicalQuoteProvider ); this.numberWinningPeriods = new NumberWinningPeriods( this ); this.numberLosingPeriods = new NumberLosingPeriods( this ); this.percentageWinningPeriods = new PercentageWinningPeriods( this ); this.totalNetProfit = new TotalNetProfit( this ); this.annualSystemPercentageReturn = new AnnualSystemPercentageReturn( this ); this.maxEquityDrawDown = new MaxEquityDrawDown( this ); ! this.sharpeRatio = new SharpeRatio( this.accountReport.EquityHistory ); this.totalNumberOfTrades = new TotalNumberOfTrades( this ); this.numberWinningTrades = new NumberWinningTrades( this ); this.averageTradePercentageReturn = new AverageTradePercentageReturn( this ); this.largestWinningTradePercentage = new LargestWinningTradePercentage( this ); this.largestLosingTradePercentage = new LargestLosingTradePercentage( this ); this.totalNumberOfLongTrades = new TotalNumberOfLongTrades( this ); this.numberWinningLongTrades = new NumberWinningLongTrades( this ); this.averageLongTradePercentageReturn = new AverageLongTradePercentageReturn( this ); this.totalNumberOfShortTrades = new TotalNumberOfShortTrades( this ); this.numberWinningShortTrades = new NumberWinningShortTrades( this ); this.totalCommissionAmount = new TotalCommissionAmount( this ); ! // this.DataTable = getSummaryDataTable(); } |