[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables
Brought to you by:
glauco_1
|
From: Glauco S. <gla...@us...> - 2008-08-18 21:13:28
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv12665/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables Modified Files: StatisticsSummary.cs Summary.cs Log Message: - the code has been cleaned up to avoid warnings - standard indentation has been applied Index: StatisticsSummary.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/StatisticsSummary.cs,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StatisticsSummary.cs 25 Apr 2008 17:13:42 -0000 1.2 --- StatisticsSummary.cs 18 Aug 2008 21:13:20 -0000 1.3 *************** *** 15,24 **** /// Summary description for StatisticsSummary. /// </summary> ! [Serializable] ! public class StatisticsSummary : ReportTable, ISerializable ! { ! private AccountReport accountReport; private IHistoricalQuoteProvider historicalQuoteProvider; ! private AverageReturnOnMondayWithOpenPositions averageReturnOnMondayWithOpenPositions; private AverageReturnOnTuesdayWithOpenPositions averageReturnOnTuesdayWithOpenPositions; --- 15,24 ---- /// Summary description for StatisticsSummary. /// </summary> ! [Serializable] ! public class StatisticsSummary : ReportTable, ISerializable ! { ! private AccountReport accountReport; private IHistoricalQuoteProvider historicalQuoteProvider; ! private AverageReturnOnMondayWithOpenPositions averageReturnOnMondayWithOpenPositions; private AverageReturnOnTuesdayWithOpenPositions averageReturnOnTuesdayWithOpenPositions; *************** *** 29,36 **** public AccountReport AccountReport ! { ! get { return accountReport; } ! } ! public AverageReturnOnMondayWithOpenPositions AverageReturnOnMondayWithOpenPositions { --- 29,36 ---- public AccountReport AccountReport ! { ! get { return accountReport; } ! } ! public AverageReturnOnMondayWithOpenPositions AverageReturnOnMondayWithOpenPositions { *************** *** 75,79 **** } public StatisticsSummary( AccountReport accountReport , ! IHistoricalQuoteProvider historicalDataProvider ) : base( accountReport.Name + " - StatisticsSummary" ) { --- 75,79 ---- } public StatisticsSummary( AccountReport accountReport , ! IHistoricalQuoteProvider historicalDataProvider ) : base( accountReport.Name + " - StatisticsSummary" ) { *************** *** 91,95 **** /// <param name="context"></param> protected StatisticsSummary( SerializationInfo info , StreamingContext context ) : ! base( "Summary" ) { // get the set of serializable members for this class and its base classes --- 91,95 ---- /// <param name="context"></param> protected StatisticsSummary( SerializationInfo info , StreamingContext context ) : ! base( "Summary" ) { // get the set of serializable members for this class and its base classes *************** *** 99,103 **** // deserialize the fields from the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { FieldInfo fieldInfo = (FieldInfo) mi[i]; --- 99,103 ---- // deserialize the fields from the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { FieldInfo fieldInfo = (FieldInfo) mi[i]; *************** *** 107,114 **** { fieldInfo.SetValue( this , ! info.GetValue( fieldInfo.Name, fieldInfo.FieldType ) ); } - catch(Exception ex) - {ex = ex;} } } --- 107,116 ---- { fieldInfo.SetValue( this , ! info.GetValue( fieldInfo.Name, fieldInfo.FieldType ) ); ! } ! catch (Exception ex) ! { ! string forBreakpoint = ex.Message; forBreakpoint = forBreakpoint + ""; } } } *************** *** 120,132 **** /// <param name="context"></param> void ISerializable.GetObjectData( ! SerializationInfo info, StreamingContext context) { // get the set of serializable members for this class and base classes Type thisType = this.GetType(); ! MemberInfo[] mi = FormatterServices.GetSerializableMembers( thisType , context); // serialize the fields to the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { info.AddValue(mi[i].Name, ((FieldInfo) mi[i]).GetValue(this)); --- 122,134 ---- /// <param name="context"></param> void ISerializable.GetObjectData( ! SerializationInfo info, StreamingContext context) { // get the set of serializable members for this class and base classes Type thisType = this.GetType(); ! MemberInfo[] mi = FormatterServices.GetSerializableMembers( thisType , context); // serialize the fields to the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { info.AddValue(mi[i].Name, ((FieldInfo) mi[i]).GetValue(this)); *************** *** 135,145 **** #endregion ! #region "getStatisticsSummary" ! private void getStatisticsSummary() ! { if ( this.accountReport.Equity.DataTable.Rows.Count == 0 ) throw new Exception( "A StatisticsSummary computation has been requested, but the equity line is empty" ); ! this.averageReturnOnMondayWithOpenPositions = new AverageReturnOnMondayWithOpenPositions(this); this.averageReturnOnTuesdayWithOpenPositions = new AverageReturnOnTuesdayWithOpenPositions(this); --- 137,147 ---- #endregion ! #region "getStatisticsSummary" ! private void getStatisticsSummary() ! { if ( this.accountReport.Equity.DataTable.Rows.Count == 0 ) throw new Exception( "A StatisticsSummary computation has been requested, but the equity line is empty" ); ! this.averageReturnOnMondayWithOpenPositions = new AverageReturnOnMondayWithOpenPositions(this); this.averageReturnOnTuesdayWithOpenPositions = new AverageReturnOnTuesdayWithOpenPositions(this); *************** *** 147,155 **** this.averageReturnOnThursdayWithOpenPositions = new AverageReturnOnThursdayWithOpenPositions(this); this.averageReturnOnFridayWithOpenPositions = new AverageReturnOnFridayWithOpenPositions(this); ! this.averageReturnOnDayWithOpenPositions = new AverageReturnOnDayWithOpenPositions(this); ! } ! #endregion } --- 149,157 ---- this.averageReturnOnThursdayWithOpenPositions = new AverageReturnOnThursdayWithOpenPositions(this); this.averageReturnOnFridayWithOpenPositions = new AverageReturnOnFridayWithOpenPositions(this); ! this.averageReturnOnDayWithOpenPositions = new AverageReturnOnDayWithOpenPositions(this); ! } ! #endregion } Index: Summary.cs =================================================================== RCS file: /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/Tables/Summary.cs,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Summary.cs 5 Sep 2007 22:10:16 -0000 1.20 --- Summary.cs 18 Aug 2008 21:13:20 -0000 1.21 *************** *** 15,28 **** /// Summary description for Summary. /// </summary> ! [Serializable] ! public class Summary : ReportTable, ISerializable ! { ! private AccountReport accountReport; private IHistoricalQuoteProvider historicalQuoteProvider; ! private double totalPnl; ! private BenchmarkPercentageReturn benchmarkPercentageReturn; private AnnualSystemPercentageReturn annualSystemPercentageReturn; private double finalAccountValue; ! private long intervalDays; private TotalNetProfit totalNetProfit; private ReturnOnAccount returnOnAccount; --- 15,28 ---- /// Summary description for Summary. /// </summary> ! [Serializable] ! public class Summary : ReportTable, ISerializable ! { ! private AccountReport accountReport; private IHistoricalQuoteProvider historicalQuoteProvider; ! private double totalPnl; ! private BenchmarkPercentageReturn benchmarkPercentageReturn; private AnnualSystemPercentageReturn annualSystemPercentageReturn; private double finalAccountValue; ! private long intervalDays; private TotalNetProfit totalNetProfit; private ReturnOnAccount returnOnAccount; *************** *** 50,60 **** public AccountReport AccountReport ! { ! get { return accountReport; } ! } ! public double TotalPnl ! { ! get { return totalPnl; } ! } public TotalNetProfit TotalNetProfit { --- 50,60 ---- public AccountReport AccountReport ! { ! get { return accountReport; } ! } ! public double TotalPnl ! { ! get { return totalPnl; } ! } public TotalNetProfit TotalNetProfit { *************** *** 66,80 **** } public BenchmarkPercentageReturn BenchmarkPercentageReturn ! { ! get { return this.benchmarkPercentageReturn; } ! } ! public double FinalAccountValue ! { ! get { return finalAccountValue; } ! } ! public double IntervalDays ! { ! get { return intervalDays; } ! } public AnnualSystemPercentageReturn AnnualSystemPercentageReturn { --- 66,80 ---- } public BenchmarkPercentageReturn BenchmarkPercentageReturn ! { ! get { return this.benchmarkPercentageReturn; } ! } ! public double FinalAccountValue ! { ! get { return finalAccountValue; } ! } ! public double IntervalDays ! { ! get { return intervalDays; } ! } public AnnualSystemPercentageReturn AnnualSystemPercentageReturn { *************** *** 185,189 **** } public Summary( AccountReport accountReport , ! IHistoricalQuoteProvider historicalDataProvider ) : base( accountReport.Name + " - Summary" ) { --- 185,189 ---- } public Summary( AccountReport accountReport , ! IHistoricalQuoteProvider historicalDataProvider ) : base( accountReport.Name + " - Summary" ) { *************** *** 199,203 **** /// <param name="context"></param> protected Summary( SerializationInfo info , StreamingContext context ) : ! base( "Summary" ) { // get the set of serializable members for this class and its base classes --- 199,203 ---- /// <param name="context"></param> protected Summary( SerializationInfo info , StreamingContext context ) : ! base( "Summary" ) { // get the set of serializable members for this class and its base classes *************** *** 207,211 **** // deserialize the fields from the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { FieldInfo fieldInfo = (FieldInfo) mi[i]; --- 207,211 ---- // deserialize the fields from the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { FieldInfo fieldInfo = (FieldInfo) mi[i]; *************** *** 215,222 **** { fieldInfo.SetValue( this , ! info.GetValue( fieldInfo.Name, fieldInfo.FieldType ) ); } - catch(Exception ex) - {ex = ex;} } } --- 215,224 ---- { fieldInfo.SetValue( this , ! info.GetValue( fieldInfo.Name, fieldInfo.FieldType ) ); ! } ! catch (Exception ex) ! { ! string forBreakpoint = ex.Message; forBreakpoint = forBreakpoint + ""; } } } *************** *** 229,241 **** /// <param name="context"></param> void ISerializable.GetObjectData( ! SerializationInfo info, StreamingContext context) { // get the set of serializable members for this class and base classes Type thisType = this.GetType(); ! MemberInfo[] mi = FormatterServices.GetSerializableMembers( thisType , context); // serialize the fields to the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { info.AddValue(mi[i].Name, ((FieldInfo) mi[i]).GetValue(this)); --- 231,243 ---- /// <param name="context"></param> void ISerializable.GetObjectData( ! SerializationInfo info, StreamingContext context) { // get the set of serializable members for this class and base classes Type thisType = this.GetType(); ! MemberInfo[] mi = FormatterServices.GetSerializableMembers( thisType , context); // serialize the fields to the info object ! for (Int32 i = 0 ; i < mi.Length; i++) { info.AddValue(mi[i].Name, ((FieldInfo) mi[i]).GetValue(this)); *************** *** 244,265 **** #endregion ! #region "getSummary" ! private void getSummaryTable_setColumns( DataTable equityDataTable ) ! { ! equityDataTable.Columns.Add( "Information" , Type.GetType( "System.String" ) ); ! equityDataTable.Columns.Add( "Value" , Type.GetType( "System.Double" ) ); ! } ! 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 ); --- 246,267 ---- #endregion ! #region "getSummary" ! private void getSummaryTable_setColumns( DataTable equityDataTable ) ! { ! equityDataTable.Columns.Add( "Information" , Type.GetType( "System.String" ) ); ! equityDataTable.Columns.Add( "Value" , Type.GetType( "System.Double" ) ); ! } ! 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 ); *************** *** 288,294 **** this.averageNumberOfTransactionsPerDay = new AverageNumberOfTransactionsPerDay(this); //this.DataTable = getSummaryDataTable(); ! } ! #endregion } --- 290,296 ---- this.averageNumberOfTransactionsPerDay = new AverageNumberOfTransactionsPerDay(this); //this.DataTable = getSummaryDataTable(); ! } ! #endregion } |