示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="exchangeCurrency1PayPartyReference"></param>
        /// <param name="exchangeCurrency2PayPartyReference"></param>
        /// <param name="exchangeCurrency1Amount"></param>
        /// <param name="exchangeCurrency1"></param>
        /// <param name="exchangeCurrency2"></param>
        /// <param name="quoteBasis"></param>
        /// <param name="valueDate"></param>
        /// <param name="spotRate"></param>
        /// <param name="forwardRate"></param>
        /// <param name="forwardPoints"></param>
        /// <returns></returns>
        public static FxSingleLeg CreateForward(string exchangeCurrency1PayPartyReference, string exchangeCurrency2PayPartyReference,
                                                decimal exchangeCurrency1Amount, string exchangeCurrency1, string exchangeCurrency2, QuoteBasisEnum quoteBasis,
                                                DateTime valueDate, Decimal spotRate, Decimal forwardRate, Decimal?forwardPoints)
        {
            decimal exchange2Amount;

            if (quoteBasis == QuoteBasisEnum.Currency2PerCurrency1)
            {
                exchange2Amount = exchangeCurrency1Amount * forwardRate;
            }
            else
            {
                exchange2Amount = exchangeCurrency1Amount / forwardRate;
            }
            var fxForward = new FxSingleLeg
            {
                exchangedCurrency1 =
                    PaymentHelper.Create(exchangeCurrency1PayPartyReference,
                                         exchangeCurrency2PayPartyReference, exchangeCurrency1,
                                         exchangeCurrency1Amount),
                exchangedCurrency2 =
                    PaymentHelper.Create(exchangeCurrency2PayPartyReference,
                                         exchangeCurrency1PayPartyReference, exchangeCurrency2,
                                         exchange2Amount),
                Items        = new[] { valueDate },
                exchangeRate =
                    ExchangeRate.Create(exchangeCurrency1, exchangeCurrency2, quoteBasis, spotRate,
                                        forwardRate, forwardPoints),
                ItemsElementName = new[] { ItemsChoiceType31.valueDate }
            };

            return(fxForward);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="hasExpired"></param>
        /// <param name="putCurrencyPayPartyReference"></param>
        /// <param name="callCurrencyPayPartyReference"></param>
        /// <param name="putCurrencyAmount"></param>
        /// <param name="putCurrency"></param>
        /// <param name="callCurrencyAmount"></param>
        /// <param name="callCurrency"></param>
        /// <param name="strikeQuoteBasis"></param>
        /// <param name="valueDate"></param>
        /// <param name="fxRate"></param>
        /// <returns></returns>
        public static FxSingleLeg CreateFxSingleLeg(bool hasExpired, string putCurrencyPayPartyReference, string callCurrencyPayPartyReference, decimal putCurrencyAmount,
                                                    string putCurrency, decimal callCurrencyAmount, string callCurrency, StrikeQuoteBasisEnum strikeQuoteBasis, DateTime valueDate, Decimal fxRate)
        {
            QuoteBasisEnum quoteBasis   = strikeQuoteBasis == StrikeQuoteBasisEnum.CallCurrencyPerPutCurrency ? QuoteBasisEnum.Currency2PerCurrency1 : QuoteBasisEnum.Currency1PerCurrency2;
            ExchangeRate   exchangeRate = hasExpired ? ExchangeRate.Create(putCurrency, callCurrency, quoteBasis, fxRate)
                                            : ExchangeRate.Create(putCurrency, callCurrency, quoteBasis, fxRate, fxRate, null);
            var fxForward = new FxSingleLeg
            {
                exchangedCurrency1 =
                    PaymentHelper.Create(putCurrencyPayPartyReference, callCurrencyPayPartyReference,
                                         putCurrency, putCurrencyAmount),
                exchangedCurrency2 =
                    PaymentHelper.Create(callCurrencyPayPartyReference, putCurrencyPayPartyReference,
                                         callCurrency, callCurrencyAmount),
                Items            = new[] { valueDate },
                ItemsElementName = new[] { ItemsChoiceType31.valueDate },
                exchangeRate     = exchangeRate,
            };

            return(fxForward);
        }