[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRo
Brought to you by:
glauco_1
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1805/b4_Business/a1_Financial/a2_Accounting/h5_Reporting/SummaryRows Added Files: PercentageWinningPeriods.cs NumberWinningPeriods.cs NumberLosingPeriods.cs NumberEvenPeriods.cs Log Message: Account report rummary rows that compute the Equity Line vs Benchmark comparison --- NEW FILE: NumberEvenPeriods.cs --- /* QuantProject - Quantitative Finance Library NumberEvenPeriods.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using QuantProject.ADT; using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Instruments; namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows { /// <summary> /// Summary row that computes the Equity Line vs Benchmark comparison /// </summary> [Serializable] public class NumberEvenPeriods : SummaryRow { public NumberEvenPeriods( Summary summary ) { this.rowDescription = "# even periods"; this.rowValue = summary.NumberEvenPeriods; } } } --- NEW FILE: NumberWinningPeriods.cs --- /* QuantProject - Quantitative Finance Library NumberWinningPeriods.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using QuantProject.ADT; using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Instruments; namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows { /// <summary> /// Summary row that computes the Equity Line vs Benchmark comparison /// </summary> [Serializable] public class NumberWinningPeriods : SummaryRow { private Summary summary; private void setWinningLosingAndEvenPeriods_forPeriod( int i ) { double equityHistoryGain = ( (double)this.summary.AccountReport.EquityHistory.GetByIndex( i + 1 ) - (double)this.summary.AccountReport.EquityHistory.GetByIndex( i ) ) / (double)this.summary.AccountReport.EquityHistory.GetByIndex( i ); double benchmarkGain = ( (double)this.summary.AccountReport.BenchmarkEquityLine.GetByIndex( i + 1 ) - (double)this.summary.AccountReport.BenchmarkEquityLine.GetByIndex( i ) ) / (double)this.summary.AccountReport.BenchmarkEquityLine.GetByIndex( i ); if ( ( equityHistoryGain - benchmarkGain ) > ConstantsProvider.MinForDifferentGains ) this.summary.NumberWinningPeriods++; else { if ( ( benchmarkGain - equityHistoryGain ) > ConstantsProvider.MinForDifferentGains ) this.summary.NumberLosingPeriods++; else this.summary.NumberEvenPeriods++; } } public void SetWinningLosingAndEvenPeriods() { this.summary.NumberWinningPeriods = 0; this.summary.NumberLosingPeriods = 0; this.summary.NumberEvenPeriods = 0; for ( int i=0; i<this.summary.AccountReport.EquityHistory.Count - 1 ; i++ ) this.setWinningLosingAndEvenPeriods_forPeriod( i ); } public NumberWinningPeriods( Summary summary ) { this.summary = summary; this.SetWinningLosingAndEvenPeriods(); this.rowDescription = "# winning periods"; this.rowValue = this.summary.NumberWinningPeriods; } } } --- NEW FILE: NumberLosingPeriods.cs --- /* QuantProject - Quantitative Finance Library NumberLosingPeriods.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using QuantProject.ADT; using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Instruments; namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows { /// <summary> /// Summary row that computes the Equity Line vs Benchmark comparison /// </summary> [Serializable] public class NumberLosingPeriods : SummaryRow { public NumberLosingPeriods( Summary summary ) { this.rowDescription = "# losing periods"; this.rowValue = summary.NumberLosingPeriods; } } } --- NEW FILE: PercentageWinningPeriods.cs --- /* QuantProject - Quantitative Finance Library PercentageWinningPeriods.cs Copyright (C) 2003 Glauco Siliprandi This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ using System; using System.Data; using QuantProject.ADT; using QuantProject.Business.Financial.Accounting.Reporting.Tables; using QuantProject.Business.Financial.Instruments; namespace QuantProject.Business.Financial.Accounting.Reporting.SummaryRows { /// <summary> /// Summary row that computes the Equity Line vs Benchmark comparison /// </summary> [Serializable] public class PercentageWinningPeriods : SummaryRow { public PercentageWinningPeriods( Summary summary ) { this.rowDescription = "# losing periods"; this.rowValue = summary.PercentageWinningPeriods; } } } |