private ResolvedFxNdfTrade(TradeInfo info, ResolvedFxNdf product)
 {
     JodaBeanUtils.notNull(info, "info");
     JodaBeanUtils.notNull(product, "product");
     this.info    = info;
     this.product = product;
 }
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            ResolvedFxNdf test = sut();

            assertEquals(test.AgreedFxRate, FX_RATE);
            assertEquals(test.Index, GBP_USD_WM);
            assertEquals(test.NonDeliverableCurrency, USD);
            assertEquals(test.PaymentDate, PAYMENT_DATE);
            assertEquals(test.SettlementCurrency, GBP);
            assertEquals(test.SettlementCurrencyNotional, CURRENCY_NOTIONAL);
            assertEquals(test.SettlementNotional, NOTIONAL);
        }
        public virtual void test_builder_inverse()
        {
            CurrencyAmount currencyNotional = CurrencyAmount.of(USD, NOTIONAL);
            ResolvedFxNdf  test             = ResolvedFxNdf.builder().agreedFxRate(FX_RATE).observation(FxIndexObservation.of(GBP_USD_WM, FIXING_DATE, REF_DATA)).paymentDate(PAYMENT_DATE).settlementCurrencyNotional(currencyNotional).build();

            assertEquals(test.AgreedFxRate, FX_RATE);
            assertEquals(test.Index, GBP_USD_WM);
            assertEquals(test.NonDeliverableCurrency, GBP);
            assertEquals(test.PaymentDate, PAYMENT_DATE);
            assertEquals(test.SettlementCurrency, USD);
            assertEquals(test.SettlementCurrencyNotional, currencyNotional);
            assertEquals(test.SettlementNotional, NOTIONAL);
        }
Пример #4
0
        //-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            FxNdf         @base    = sut();
            ResolvedFxNdf resolved = @base.resolve(REF_DATA);

            assertEquals(resolved.AgreedFxRate, FX_RATE);
            assertEquals(resolved.Index, GBP_USD_WM);
            assertEquals(resolved.NonDeliverableCurrency, USD);
            assertEquals(resolved.PaymentDate, PAYMENT_DATE);
            assertEquals(resolved.SettlementCurrency, GBP);
            assertEquals(resolved.SettlementCurrencyNotional, CURRENCY_NOTIONAL);
            assertEquals(resolved.SettlementNotional, NOTIONAL);
        }
Пример #5
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ResolvedFxNdf other = (ResolvedFxNdf)obj;
         return(JodaBeanUtils.equal(settlementCurrencyNotional, other.settlementCurrencyNotional) && JodaBeanUtils.equal(agreedFxRate, other.agreedFxRate) && JodaBeanUtils.equal(observation, other.observation) && JodaBeanUtils.equal(paymentDate, other.paymentDate));
     }
     return(false);
 }
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 3237038:         // info
                    this.info_Renamed = (TradeInfo)newValue;
                    break;

                case -309474065:         // product
                    this.product_Renamed = (ResolvedFxNdf)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
        public virtual void test_builder_wrongRate()
        {
            FxRate fxRate = FxRate.of(GBP, EUR, 1.1d);

            assertThrowsIllegalArg(() => ResolvedFxNdf.builder().agreedFxRate(fxRate).observation(FxIndexObservation.of(GBP_USD_WM, FIXING_DATE, REF_DATA)).paymentDate(PAYMENT_DATE).settlementCurrencyNotional(CURRENCY_NOTIONAL).build());
        }
        public virtual void test_builder_wrongCurrency()
        {
            CurrencyAmount currencyNotional = CurrencyAmount.of(EUR, NOTIONAL);

            assertThrowsIllegalArg(() => ResolvedFxNdf.builder().agreedFxRate(FX_RATE).observation(FxIndexObservation.of(GBP_USD_WM, FIXING_DATE, REF_DATA)).paymentDate(PAYMENT_DATE).settlementCurrencyNotional(currencyNotional).build());
        }
        internal static ResolvedFxNdf sut2()
        {
            FxRate fxRate = FxRate.of(GBP, EUR, 1.1d);

            return(ResolvedFxNdf.builder().agreedFxRate(fxRate).observation(FxIndexObservation.of(EUR_GBP_ECB, FIXING_DATE, REF_DATA)).paymentDate(PAYMENT_DATE).settlementCurrencyNotional(CURRENCY_NOTIONAL).build());
        }
 //-------------------------------------------------------------------------
 internal static ResolvedFxNdf sut()
 {
     return(ResolvedFxNdf.builder().agreedFxRate(FX_RATE).observation(FxIndexObservation.of(GBP_USD_WM, FIXING_DATE, REF_DATA)).paymentDate(PAYMENT_DATE).settlementCurrencyNotional(CURRENCY_NOTIONAL).build());
 }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance of a resolved Non-Deliverable Forward (NDF) trade.
 /// </summary>
 /// <param name="info">  the trade info </param>
 /// <param name="product">  the product </param>
 /// <returns> the resolved trade </returns>
 public static ResolvedFxNdfTrade of(TradeInfo info, ResolvedFxNdf product)
 {
     return(new ResolvedFxNdfTrade(info, product));
 }
 /// <summary>
 /// Sets the resolved Non-Deliverable Forward (NDF) product.
 /// <para>
 /// The product captures the contracted financial details of the trade.
 /// </para>
 /// </summary>
 /// <param name="product">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder product(ResolvedFxNdf product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.product_Renamed = product;
     return(this);
 }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(ResolvedFxNdfTrade beanToCopy)
 {
     this.info_Renamed    = beanToCopy.Info;
     this.product_Renamed = beanToCopy.Product;
 }