Ejemplo n.º 1
0
        public static FxLeg CreateSpot(string exchangeCurrency1PayPartyReference, string exchangeCurrency2PayPartyReference, decimal exchangeCurrency1Amount,
                                       string exchangeCurrency1, string exchangeCurrency2, QuoteBasisEnum quoteBasis, DateTime valueDate, Decimal spotRate)
        {
            decimal exchange2Amount;

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

            return(fxforward);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Builds and fx trade from the current class.
        /// </summary>
        /// <param name="hasExpired"></param>
        /// <returns></returns>
        public FxLeg CreateFxLeg(bool hasExpired)
        {
            QuoteBasisEnum quoteBasis   = fxStrikePrice.strikeQuoteBasis == StrikeQuoteBasisEnum.CallCurrencyPerPutCurrency ? QuoteBasisEnum.Currency2PerCurrency1 : QuoteBasisEnum.Currency1PerCurrency2;
            ExchangeRate   exchangeRate = hasExpired ? ExchangeRate.Create(putCurrencyAmount.currency.Value, putCurrencyAmount.currency.Value, quoteBasis, fxStrikePrice.rate)
                                            : ExchangeRate.Create(putCurrencyAmount.currency.Value, putCurrencyAmount.currency.Value, quoteBasis, fxStrikePrice.rate, fxStrikePrice.rate, null);
            var fxforward = new FxLeg
            {
                //exchangedCurrency1 =
                //    PaymentHelper.Create(this.putCurrencyPayPartyReference, callCurrencyPayPartyReference,
                //                         putCurrency, putCurrencyAmount),
                //exchangedCurrency2 =
                //    PaymentHelper.Create(callCurrencyPayPartyReference, putCurrencyPayPartyReference,
                //                         callCurrency, callCurrencyAmount),
                Items            = new[] { valueDate },
                exchangeRate     = exchangeRate,
                ItemsElementName = new[] { ItemsChoiceType15.valueDate }
            };

            return(fxforward);
        }
Ejemplo n.º 3
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 FxLeg CreateFxLeg(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 FxLeg
            {
                exchangedCurrency1 =
                    PaymentHelper.Create(putCurrencyPayPartyReference, callCurrencyPayPartyReference,
                                         putCurrency, putCurrencyAmount),
                exchangedCurrency2 =
                    PaymentHelper.Create(callCurrencyPayPartyReference, putCurrencyPayPartyReference,
                                         callCurrency, callCurrencyAmount),
                Items            = new[] { valueDate },
                exchangeRate     = exchangeRate,
                ItemsElementName = new[] { ItemsChoiceType15.valueDate }
            };

            return(fxforward);
        }