[Quantproject-developers] QuantProject/b4_Business/a1_Financial/a2_Accounting/Commissions FixedCom
Brought to you by:
glauco_1
|
From: Marco M. <mi...@us...> - 2009-08-31 20:56:38
|
Update of /cvsroot/quantproject/QuantProject/b4_Business/a1_Financial/a2_Accounting/Commissions In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22782/b4_Business/a1_Financial/a2_Accounting/Commissions Added Files: FixedCommission.cs FixedCommissionManager.cs Log Message: Added FixedCommission and FixedCommissionManager, for management of fixed commissions --- NEW FILE: FixedCommission.cs --- /* QuantProject - Quantitative Finance Library FixedCommission.cs Copyright (C) 2009 Marco Milletti 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; namespace QuantProject.Business.Financial.Accounting.Commissions { /// <summary> /// Fixed commission. /// </summary> [Serializable] public class FixedCommission : Commission { double fixedCommission; public override double Value { get { double returnValue; if ( ( this.transaction.Type == TransactionType.AddCash ) || ( this.transaction.Type == TransactionType.Withdraw ) ) returnValue = 0.0; else returnValue = this.fixedCommission; return returnValue; } } public FixedCommission( Transaction transaction, double fixedCommission ) : base( transaction ) { this.fixedCommission = fixedCommission; } } } --- NEW FILE: FixedCommissionManager.cs --- /* QuantProject - Quantitative Finance Library FixedCommissionManager.cs Copyright (C) 2009 Marco Milletti 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; namespace QuantProject.Business.Financial.Accounting.Commissions { /// <summary> /// Commission Manager for fixed value commissions. /// </summary> [Serializable] public class FixedCommissionManager : ICommissionManager { double fixedCommission; public FixedCommissionManager(double fixedCommission) { this.fixedCommission = fixedCommission; } public Commission GetCommission( Transaction transaction ) { return new FixedCommission( transaction, this.fixedCommission ); } } } |