예제 #1
0
        public static Trade CreateFxLeg(string tradeId, DateTime tradeDate, string exchangeCurrency1PayPartyReference, string exchangeCurrency2PayPartyReference,
                                        decimal exchangeCurrency1Amount, string exchangeCurrency1, string exchangeCurrency2, QuoteBasisEnum quoteBasis,
                                        DateTime valueDate, Decimal spotRate, Decimal?forwardRate, Decimal?forwardPoints)
        {
            var trade = new Trade {
                id = tradeId, tradeHeader = new TradeHeader()
            };
            var party1 = PartyTradeIdentifierHelper.Parse(tradeId, "party1");
            var party2 = PartyTradeIdentifierHelper.Parse(tradeId, "party2");

            trade.tradeHeader.partyTradeIdentifier = new[] { party1, party2 };
            trade.tradeHeader.tradeDate            = new IdentifiedDate {
                Value = tradeDate
            };
            FxSingleLeg fxLeg;

            if (forwardRate == null)
            {
                fxLeg = ParseSpot(exchangeCurrency1PayPartyReference, exchangeCurrency2PayPartyReference, exchangeCurrency1Amount,
                                  exchangeCurrency1, exchangeCurrency2, quoteBasis, valueDate, spotRate);
            }
            else
            {
                fxLeg = ParseForward(exchangeCurrency1PayPartyReference, exchangeCurrency2PayPartyReference, exchangeCurrency1Amount,
                                     exchangeCurrency1, exchangeCurrency2, quoteBasis, valueDate, spotRate, (decimal)forwardRate, forwardPoints);
            }
            FpMLFieldResolver.TradeSetFxLeg(trade, fxLeg);
            return(trade);
        }
예제 #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="tradeId"></param>
        /// <param name="tradeDate"></param>
        /// <param name="productType"></param>
        /// <param name="payerIsBaseParty"></param>
        /// <param name="paymentDate"></param>
        /// <param name="businessDayCalendar"></param>
        /// <param name="businessDayAdjustments"></param>
        /// <param name="currency"></param>
        /// <param name="amount"></param>
        /// <returns></returns>
        public static Trade CreateBulletPayment(string tradeId, DateTime tradeDate, string productType, Boolean payerIsBaseParty,
                                                DateTime paymentDate, string businessDayCalendar, string businessDayAdjustments, string currency, decimal amount)
        {
            var trade = new Trade {
                id = tradeId, tradeHeader = new TradeHeader()
            };
            var party1 = PartyTradeIdentifierHelper.Parse(tradeId, "party1");
            var party2 = PartyTradeIdentifierHelper.Parse(tradeId, "party2");

            trade.tradeHeader.partyTradeIdentifier = new[] { party1, party2 };
            trade.tradeHeader.tradeDate            = new IdentifiedDate {
                Value = tradeDate
            };
            var payment = Parse(productType, payerIsBaseParty, paymentDate, businessDayCalendar, businessDayAdjustments, currency, amount);

            FpMLFieldResolver.TradeSetBulletPayment(trade, payment);
            return(trade);
        }
예제 #3
0
        /// <summary>
        /// Builds a term deposit trade.
        /// </summary>
        /// <param name="tradeId"></param>
        /// <param name="productType"></param>
        /// <param name="tradeDate"></param>
        /// <param name="startDate"></param>
        /// <param name="maturityDate"></param>
        /// <param name="currency"></param>
        /// <param name="notionalAmount"></param>
        /// <param name="fixedRate"></param>
        /// <param name="dayCount"></param>
        /// <returns></returns>
        public static Trade CreateSimpleTermDepositTrade(string tradeId, string productType,
                                                         DateTime tradeDate, DateTime startDate, DateTime maturityDate, string currency,
                                                         decimal notionalAmount, decimal fixedRate, string dayCount)
        {
            var trade = new Trade {
                id = tradeId, tradeHeader = new TradeHeader()
            };
            var party1 = PartyTradeIdentifierHelper.Parse(tradeId, "party1");
            var party2 = PartyTradeIdentifierHelper.Parse(tradeId, "party2");

            trade.tradeHeader.partyTradeIdentifier = new[] { party1, party2 };
            trade.tradeHeader.tradeDate            = new IdentifiedDate {
                Value = tradeDate
            };
            var termDeposit = Parse(productType, tradeDate, startDate,
                                    maturityDate, currency, notionalAmount, fixedRate, dayCount);

            FpMLFieldResolver.TradeSetTermDeposit(trade, termDeposit);
            return(trade);
        }
예제 #4
0
        public static Trade CreateFxSwap(string tradeId, DateTime tradeDate, string exchangeCurrency1PayPartyReference, string exchangeCurrency2PayPartyReference,
                                         decimal exchangeCurrency1Amount, string exchangeCurrency1, string exchangeCurrency2, QuoteBasisEnum quoteBasis,
                                         DateTime startValueDate, DateTime forwardValueDate, Decimal startRate, Decimal forwardRate, Decimal?forwardPoints)
        {
            var trade = new Trade {
                id = tradeId, tradeHeader = new TradeHeader()
            };
            var party1 = PartyTradeIdentifierHelper.Parse(tradeId, "party1");
            var party2 = PartyTradeIdentifierHelper.Parse(tradeId, "party2");

            trade.tradeHeader.partyTradeIdentifier = new[] { party1, party2 };
            trade.tradeHeader.tradeDate            = new IdentifiedDate {
                Value = tradeDate
            };
            var fxSwap = Parse(exchangeCurrency1PayPartyReference, exchangeCurrency2PayPartyReference, exchangeCurrency1Amount,
                               exchangeCurrency1, exchangeCurrency2, quoteBasis, startValueDate, forwardValueDate, startRate, forwardRate, forwardPoints);

            FpMLFieldResolver.TradeSetFxSwap(trade, fxSwap);
            return(trade);
        }
예제 #5
0
        public static Trade CreateFxSwap(string tradeId, DateTime tradeDate, string exchangeCurrency1PayPartyReference, string exchangeCurrency2PayPartyReference,
                                         decimal exchangeCurrency1Amount, string exchangeCurrency1, string exchangeCurrency2, QuoteBasisEnum quoteBasis,
                                         DateTime valueDate, Decimal spotRate, Decimal?forwardRate, Decimal?forwardPoints)
        {
            var trade = new Trade {
                id = tradeId, tradeHeader = new TradeHeader()
            };
            var party1 = PartyTradeIdentifierHelper.Parse(tradeId, "party1");
            var party2 = PartyTradeIdentifierHelper.Parse(tradeId, "party2");

            trade.tradeHeader.partyTradeIdentifier = new[] { party1, party2 };
            trade.tradeHeader.tradeDate            = new IdentifiedDate {
                Value = tradeDate
            };
            var nearLeg = new FxSwapLeg();
            var farLeg  = new FxSwapLeg();

            if (forwardRate == null)
            {
                nearLeg = ParseSpot(exchangeCurrency1PayPartyReference, exchangeCurrency2PayPartyReference, exchangeCurrency1Amount,
                                    exchangeCurrency1, exchangeCurrency2, quoteBasis, valueDate, spotRate);
            }
            else
            {
                farLeg = PriceableFxSwapLeg.ParseForward(exchangeCurrency1PayPartyReference, exchangeCurrency2PayPartyReference, exchangeCurrency1Amount,
                                                         exchangeCurrency1, exchangeCurrency2, quoteBasis, valueDate, spotRate, (decimal)forwardRate, forwardPoints);
            }
            var fxSwap = new FxSwap
            {
                nearLeg          = nearLeg,
                farLeg           = farLeg,
                Items            = new object[] { ProductTypeHelper.Create(ProductTypeSimpleEnum.FxSwap.ToString()) },
                ItemsElementName = new[] { ItemsChoiceType2.productType }
            };

            FpMLFieldResolver.TradeSetFxSwap(trade, fxSwap);
            return(trade);
        }
예제 #6
0
        public static Trade CreateVanillaFxOption(string tradeId, DateTime tradeDate, string buyerPartyReference, string sellerPartyReference, //FxOptionType optionType,
                                                  PutCallEnum?soldAs, string period, DateTime expiryDate, DateTime time, string expiryBusinessCenter,
                                                  CutName cutName, decimal putCurrencyAmount, string putCurrency, decimal callCurrencyAmount,
                                                  string callCurrency, StrikeQuoteBasisEnum strikeQuoteBasis, DateTime valueDate, Decimal strikePrice, decimal?spotRate,
                                                  bool isCashSettled, Currency settlementCurrency, DateTime?fixingDate, QuotedCurrencyPair quotedCurrencyPair, List <FxOptionPremium> premia)
        {
            var trade = new Trade {
                id = tradeId, tradeHeader = new TradeHeader()
            };
            var party1 = PartyTradeIdentifierHelper.Parse(tradeId, "party1");
            var party2 = PartyTradeIdentifierHelper.Parse(tradeId, "party2");

            trade.tradeHeader.partyTradeIdentifier = new[] { party1, party2 };
            trade.tradeHeader.tradeDate            = new IdentifiedDate {
                Value = tradeDate
            };
            FxOption fxOption = CreateVanillaOption(buyerPartyReference, sellerPartyReference, soldAs,
                                                    period, expiryDate, time, expiryBusinessCenter, cutName, putCurrencyAmount, putCurrency, callCurrencyAmount, callCurrency,
                                                    strikeQuoteBasis, valueDate, strikePrice, spotRate, isCashSettled, settlementCurrency, fixingDate, quotedCurrencyPair, premia);

            FpMLFieldResolver.TradeSetFxOptionLeg(trade, fxOption);
            return(trade);
        }