public CommClient(ITransactionOrder transaction, InstrumentSize newValue) { if (transaction == null) throw new ApplicationException("It is not possible to calculate the commission when the transaction is null."); if (newValue == null) throw new ApplicationException("It is not possible to calculate the commission when the transaction value is null."); this.transaction = transaction; this.orderValue = newValue; this.amount = newValue.GetMoney(); type = CommClientType.Transaction; }
/// <summary> /// Calculates fee for a given amount. /// </summary> /// <param name="val">Amount to calculate fee for.</param> /// <returns>The calculated fee.</returns> public override Money Calculate(InstrumentSize val) { if (val != null && !val.IsMoney) throw new ApplicationException("It is not possible to calculate the calculation for non cash."); return val.GetMoney() * (FeePercentage / 100M) + StaticChargeAmount; }