Beispiel #1
0
 public CrumbleTransaction(IOrder order, ICrumbleAccount acctA, IAccount acctB,
         InstrumentSize valueSize, Price price, decimal exRate, DateTime transactionDate,
         DateTime transactionDateTime, Decimal ServiceChargePercentage, Side txSide, ITradingJournalEntry tradingJournalEntry,
         IGLLookupRecords lookups, ListOfTransactionComponents[] components)
     : base(order, acctA, acctB, valueSize, price, exRate, transactionDate, transactionDateTime, ServiceChargePercentage,
         txSide, tradingJournalEntry, lookups, components)
 {
 }
Beispiel #2
0
 public TransactionNTM(IAccountTypeInternal acctA, IAccount acctB,
 InstrumentSize valueSize,
 Price price, decimal exRate, DateTime transactionDate, DateTime transactionDateTime,
 Decimal ServiceChargePercentage, Side txSide,
 ITradingJournalEntry tradingJournalEntry,
 IGLLookupRecords lookups, ListOfTransactionComponents[] components, string description)
     : base(acctA, acctB, valueSize, price, exRate, transactionDate,
             transactionDateTime, ServiceChargePercentage, txSide,
             tradingJournalEntry, lookups, components)
 {
     this.Description = description;
 }
Beispiel #3
0
        public void setCommission(IGLLookupRecords lookups, Money Commission)
        {
            if (this.Components.Any(x => x.BookingComponentType == BookingComponentTypes.Commission))
            {

            }
            else
            {
                ListOfTransactionComponents comm = new ListOfTransactionComponents() { ComponentType = BookingComponentTypes.Commission, ComponentValue = Commission };
                createComponents(lookups, new ListOfTransactionComponents[1] { comm });
            }
        }
Beispiel #4
0
 public BonusDistribution(IAccountTypeInternal acctA, IAccount acctB,
 InstrumentSize valueSize,
 Price price, decimal exRate, DateTime transactionDate, DateTime transactionDateTime,
 Decimal ServiceChargePercentage, Side txSide,
 ICorporateActionBonusDistribution bonusDistributionDetails, ITradingJournalEntry tradingJournalEntry,
 IGLLookupRecords lookups, ListOfTransactionComponents[] components)
     : base(acctA, acctB, valueSize,
          price, exRate, transactionDate, transactionDateTime,
          ServiceChargePercentage, txSide,
          tradingJournalEntry,
          lookups, components)
 {
     this.CorporateActionType = CorporateActionTypes.BonusDistribution;
     this.CorporateActionDetails = bonusDistributionDetails;
 }
Beispiel #5
0
        public InstrumentConversion(IAccountTypeInternal acctA, IAccount acctB,
                InstrumentSize valueSize, InstrumentSize convertedInstrumentSize, Money additionalCash,
                decimal exRate, IInstrumentHistory instrumentTransformation,
                ITradingJournalEntry tradingJournalEntry, IGLLookupRecords lookups)
            : base(acctA, acctB, valueSize, valueSize.GetPrice(0M), exRate,
                instrumentTransformation.ChangeDate, instrumentTransformation.ChangeDate, 0M,
                (valueSize.Sign ? Side.XI : Side.XO), tradingJournalEntry, lookups, null)
        {
            if (instrumentTransformation == null)
                throw new ApplicationException("Corporate action information is missing");

            if (!(valueSize != null && valueSize.IsNotZero && convertedInstrumentSize != null && convertedInstrumentSize.IsNotZero))
                throw new ApplicationException("Not all instrument information for this corporate action is available, both instruments have to be supplied");

            if (valueSize.Underlying.Equals(convertedInstrumentSize.Underlying))
                throw new ApplicationException("Both instruments can not be the same in a corporate action");

            if (valueSize.Sign.Equals(convertedInstrumentSize.Sign))
                throw new ApplicationException("Both instruments can not have the same side in a corporate action");

            IInstrumentsHistoryConversion conversion = (IInstrumentsHistoryConversion)instrumentTransformation;
            if (!(conversion.Instrument.Equals(valueSize.Underlying) && conversion.NewInstrument.Equals(convertedInstrumentSize.Underlying)))
                throw new ApplicationException("Corporate action does not equal the instrument history data");

            decimal diff = (convertedInstrumentSize.Abs().Quantity / valueSize.Abs().Quantity) - conversion.ConversionRate;
            if (diff != 0)
                throw new ApplicationException("Sizes do not correspond with conversion rate of the Corporate action");

            if (additionalCash != null && additionalCash.IsNotZero)
            {
                ListOfTransactionComponents[] components = new ListOfTransactionComponents[1];
                components[0] = new ListOfTransactionComponents() { ComponentType = BookingComponentTypes.Conversion, ComponentValue = additionalCash };
                createComponents(lookups, components);

            }

            this.CorporateActionType = CorporateActionTypes.Conversion;

            ConvertedInstrumentSize = convertedInstrumentSize;
            CorporateActionType = instrumentTransformation.CorporateActionType;
            InstrumentTransformation = instrumentTransformation;
        }
Beispiel #6
0
 private ListOfTransactionComponents[] packageComponents(Money CValue, Money serviceCharge, Money accruedInterest)
 {
     ListOfTransactionComponents[] components = new ListOfTransactionComponents[3];
     components[0] = new ListOfTransactionComponents() { ComponentType = BookingComponentTypes.CValue, ComponentValue = CValue };
     components[1] = new ListOfTransactionComponents() { ComponentType = BookingComponentTypes.ServiceCharge, ComponentValue = serviceCharge };
     components[2] = new ListOfTransactionComponents() { ComponentType = BookingComponentTypes.AccruedInterest, ComponentValue = accruedInterest };
     return components;
 }
Beispiel #7
0
        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;
        }