public override ITransaction Storno(IAccountTypeInternal stornoAccount, B4F.TotalGiro.Stichting.Login.IInternalEmployeeLogin employee, string reason, ITradingJournalEntry tradingJournalEntry) { IOrderAllocation newStorno = new OrderAllocation(); newStorno.Order = Order; this.storno(stornoAccount, employee, reason, tradingJournalEntry, newStorno); if (this.IsClientSettled) { newStorno.IsClientSettled = true; newStorno.ClientSettlementDate = this.ClientSettlementDate; } return newStorno; }
public IOrderAllocation FillasAllocation(IOrderExecution ParentExecution, ITradingJournalEntry tradingJournalEntry, IGLLookupRecords lookups, IFeeFactory feeFactory) { if (!RequestedInstrument.IsTradeable) throw new Exception("FillasAllocation not possible when the instrument is not tradeable."); ITradeableInstrument instrument = (ITradeableInstrument)RequestedInstrument; IExchange exchange = ParentExecution.Exchange ?? instrument.DefaultExchange ?? instrument.HomeExchange; TransactionFillDetails details = instrument.GetTransactionFillDetails( this, ParentExecution.Price, ParentExecution.ContractualSettlementDate, feeFactory, ParentExecution.FillRatio, exchange); // convert servicecharge? if (details.ServiceCharge != null && details.ServiceCharge.IsNotZero) { if (!details.ServiceCharge.Underlying.Equals(ParentExecution.Price.Underlying) && !ParentExecution.Price.Underlying.IsObsoleteCurrency) details.ServiceCharge = details.ServiceCharge.Convert(ExRate, ParentExecution.Price.Underlying); } decimal exRate = (ExRate != 0 ? ExRate : ParentExecution.ExchangeRate); if (IsMonetary) exRate = ParentExecution.ExchangeRate; ListOfTransactionComponents[] components = packageComponents(details.Amount, details.ServiceCharge, details.AccruedInterest); OrderAllocation newTrade = new OrderAllocation( this, this.account, ParentExecution.AccountA, details.Size, ParentExecution.Price, exRate, ParentExecution.TransactionDate, ParentExecution.TransactionDateTime, details.ServiceChargePercentage, this.Side, feeFactory, tradingJournalEntry, lookups, components); newTrade.Exchange = ParentExecution.Exchange; newTrade.ContractualSettlementDate = ParentExecution.ContractualSettlementDate; if (details.Commission == null) instrument.CalculateCosts(newTrade, feeFactory, lookups); else newTrade.setCommission(lookups, details.Commission); fillOrder(newTrade, details.Size, ParentExecution.Price, details.Amount, details.ServiceCharge, details.AccruedInterest); ParentExecution.Allocations.AddAllocation(newTrade); return newTrade; }