[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRo
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2005-02-19 16:02:24
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16858/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows Modified Files: TotalNumberOfTrades.cs LargestWinningTradePercentage.cs LargestLosingTradePercentage.cs AverageTradePercentageReturn.cs AverageShortTradePercentageReturn.cs AverageLongTradePercentageReturn.cs Log Message: Added try catch to avoid run time errors when there are no round trades Index: AverageLongTradePercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/AverageLongTradePercentageReturn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AverageLongTradePercentageReturn.cs 15 Feb 2005 19:09:02 -0000 1.2 --- AverageLongTradePercentageReturn.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 16,21 **** { this.rowDescription = "Average long trade % Return"; ! double avgReturn = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "(Trade='Long')" ); this.rowValue = avgReturn; } --- 16,29 ---- { this.rowDescription = "Average long trade % Return"; ! double avgReturn = 0.0; ! try ! { ! avgReturn = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "(Trade='Long')" ); ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } this.rowValue = avgReturn; } Index: LargestWinningTradePercentage.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/LargestWinningTradePercentage.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LargestWinningTradePercentage.cs 15 Feb 2005 19:09:03 -0000 1.2 --- LargestWinningTradePercentage.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 16,21 **** { this.rowDescription = "Largest winning trade"; ! this.rowValue = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "max([%Profit])" , "([%Profit]>0)" ); } } --- 16,28 ---- { this.rowDescription = "Largest winning trade"; ! try ! { ! this.rowValue = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "max([%Profit])" , "([%Profit]>0)" ); ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } } } Index: AverageShortTradePercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/AverageShortTradePercentageReturn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AverageShortTradePercentageReturn.cs 15 Feb 2005 19:09:02 -0000 1.2 --- AverageShortTradePercentageReturn.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 16,22 **** { this.rowDescription = "Average short trade % Return"; ! double avgReturn = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( ! "avg([%Profit])" , "(Trade='Short')" ); this.rowValue = avgReturn; } --- 16,30 ---- { this.rowDescription = "Average short trade % Return"; ! double avgReturn = 0.0; ! try ! { ! avgReturn = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( ! "avg([%Profit])" , "(Trade='Short')" ); ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } this.rowValue = avgReturn; } Index: AverageTradePercentageReturn.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/AverageTradePercentageReturn.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** AverageTradePercentageReturn.cs 15 Feb 2005 19:09:02 -0000 1.2 --- AverageTradePercentageReturn.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 16,21 **** { this.rowDescription = "Average trade % Return"; ! double avgReturn = (double) summary.AccountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "true" ); ! this.rowValue = avgReturn; } } --- 16,27 ---- { this.rowDescription = "Average trade % Return"; ! try ! { ! this.rowValue = (double) summary.AccountReport.RoundTrades.DataTable.Compute( "avg([%Profit])" , "true" ); ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } } } Index: LargestLosingTradePercentage.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/LargestLosingTradePercentage.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** LargestLosingTradePercentage.cs 15 Feb 2005 19:09:03 -0000 1.2 --- LargestLosingTradePercentage.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 16,21 **** { this.rowDescription = "Largest losing trade"; ! this.rowValue = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "min([%Profit])" , "([%Profit]<0)" ); } } --- 16,28 ---- { this.rowDescription = "Largest losing trade"; ! try ! { ! this.rowValue = ! (double) summary.AccountReport.RoundTrades.DataTable.Compute( "min([%Profit])" , "([%Profit]<0)" ); ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } } } Index: TotalNumberOfTrades.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows/TotalNumberOfTrades.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TotalNumberOfTrades.cs 15 Feb 2005 19:09:04 -0000 1.2 --- TotalNumberOfTrades.cs 19 Feb 2005 16:02:15 -0000 1.3 *************** *** 15,21 **** double totalROA = summary.TotalPnl / ( summary.FinalAccountValue - summary.TotalPnl ); this.rowDescription = "Total # of trades"; ! DataRow[] DataRows = ! summary.AccountReport.RoundTrades.DataTable.Select( "(ExitPrice is not null)" ); ! this.rowValue = DataRows.Length; } } --- 15,28 ---- double totalROA = summary.TotalPnl / ( summary.FinalAccountValue - summary.TotalPnl ); this.rowDescription = "Total # of trades"; ! try ! { ! DataRow[] DataRows = ! summary.AccountReport.RoundTrades.DataTable.Select( "(ExitPrice is not null)" ); ! this.rowValue = DataRows.Length; ! } ! catch (Exception ex) ! { ! ex = ex; // to avoid compilation warning; ! } } } |