Example #1
0
        public static ExchangeRate Create(string currency1, string currency2, QuoteBasisEnum quoteBasis,
                                          Decimal spotRate, Decimal forwardRate, Decimal?forwardPoints)
        {
            var exchangeRate = new ExchangeRate
            {
                quotedCurrencyPair = QuotedCurrencyPair.Create(currency1, currency2, quoteBasis),
                rate     = forwardRate,
                spotRate = spotRate
            };

            if (forwardPoints != null)
            {
                exchangeRate.forwardPointsField = (decimal)forwardPoints;
            }
            return(exchangeRate);
        }
Example #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);
        }
Example #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);
        }