private static IPositionTransferDetail assignProperties(TransferPositionDetailsEditView updateInput, IPositionTransferDetail updatingLine, IDalSession session) { IInstrument instrument = InstrumentMapper.GetInstrument(session, updateInput.Instrumentid); updatingLine.TxDirection = updateInput.TxDirection; updatingLine.PositionSize = new InstrumentSize(updateInput.PositionSize, instrument); updatingLine.ActualPrice = getPriceForInstrument(session, ((ITradeableInstrument)instrument), updatingLine.ParentTransfer.TransferDate); if((updateInput.TransferPriceQuantity != 0m)) updatingLine.TransferPrice = new Price(updateInput.TransferPriceQuantity, ((ITradeableInstrument)instrument).CurrencyNominal, instrument); else updatingLine.TransferPrice = updatingLine.ActualPrice; updatingLine.ValueVV = updatingLine.PositionSize.CalculateAmount(updatingLine.TransferPrice); updatingLine.ValueinEuro = updatingLine.ValueVV.CurrentBaseAmount; return updatingLine; }
private static ITransactionNTM transferPosition(IDalSession session, IPositionTransferDetail detail, IAccountTypeInternal account, bool transferOut) { IAccountTypeInternal AcctA = account; IAccount AcctB = account.DefaultAccountforTransfer; Price Price = detail.TransferPrice; ICurrency currency = detail.TransferPrice.Underlying; Money CounterValueSize = Price.Amount.ZeroedAmount(); decimal ExRate = detail.ExchangeRate; DateTime TransactionDate = detail.TransferDate; string ExternalSource = transferOut ? detail.ParentTransfer.DescriptionAccountA : detail.ParentTransfer.DescriptionAccountA; Side txSide = transferOut ? Side.XO : Side.XI; InstrumentSize ValueSize = transferOut ? detail.PositionSize.Abs().Negate() : detail.PositionSize.Abs(); ITradingJournalEntry tradingJournalEntry = TransactionAdapter.GetNewTradingJournalEntry(session, currency.Symbol, TransactionDate); IGLLookupRecords lookups = GlLookupRecordMapper.GetGLLookupRecords(session, BookingComponentParentTypes.Transaction); ListOfTransactionComponents[] txcomps = new ListOfTransactionComponents[0]; TransactionNTM ntm = new TransactionNTM(AcctA, AcctB, ValueSize, Price, ExRate, TransactionDate, TransactionDate.AddHours(10), 0M, txSide, tradingJournalEntry, lookups, txcomps, ExternalSource); IInternalEmployeeLogin employee = detail.ParentTransfer.CreatedBy; ntm.Approve(employee); return ntm; }