Exemplo n.º 1
0
 private FxNdfTrade(TradeInfo info, FxNdf product)
 {
     JodaBeanUtils.notNull(info, "info");
     JodaBeanUtils.notNull(product, "product");
     this.info    = info;
     this.product = product;
 }
Exemplo n.º 2
0
        public virtual void test_builder_inverse()
        {
            FxRate fxRate = FxRate.of(USD, GBP, 0.7d);
            FxNdf  test   = FxNdf.builder().agreedFxRate(fxRate).settlementCurrencyNotional(CURRENCY_NOTIONAL).index(GBP_USD_WM).paymentDate(PAYMENT_DATE).build();

            assertEquals(test.AgreedFxRate, fxRate);
            assertEquals(test.Index, GBP_USD_WM);
            assertEquals(test.NonDeliverableCurrency, USD);
            assertEquals(test.SettlementCurrencyNotional, CURRENCY_NOTIONAL);
            assertEquals(test.PaymentDate, PAYMENT_DATE);
            assertEquals(test.SettlementCurrency, GBP);
        }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         FxNdf other = (FxNdf)obj;
         return(JodaBeanUtils.equal(settlementCurrencyNotional, other.settlementCurrencyNotional) && JodaBeanUtils.equal(agreedFxRate, other.agreedFxRate) && JodaBeanUtils.equal(index, other.index) && JodaBeanUtils.equal(paymentDate, other.paymentDate));
     }
     return(false);
 }
Exemplo n.º 5
0
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            FxNdf test = FxNdf.builder().agreedFxRate(FX_RATE).index(GBP_USD_WM).settlementCurrencyNotional(CURRENCY_NOTIONAL).paymentDate(PAYMENT_DATE).build();

            assertEquals(test.AgreedFxRate, FX_RATE);
            assertEquals(test.Index, GBP_USD_WM);
            assertEquals(test.NonDeliverableCurrency, USD);
            assertEquals(test.SettlementCurrencyNotional, CURRENCY_NOTIONAL);
            assertEquals(test.PaymentDate, PAYMENT_DATE);
            assertEquals(test.SettlementCurrency, GBP);
            assertEquals(test.CrossCurrency, true);
            assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(GBP));
            assertEquals(test.allCurrencies(), ImmutableSet.of(GBP, USD));
        }
Exemplo n.º 6
0
            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 = (FxNdf)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
Exemplo n.º 7
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance of a Non-Deliverable Forward (NDF) trade.
 /// </summary>
 /// <param name="info">  the trade info </param>
 /// <param name="product">  the product </param>
 /// <returns> the trade </returns>
 public static FxNdfTrade of(TradeInfo info, FxNdf product)
 {
     return(new FxNdfTrade(info, product));
 }
Exemplo n.º 8
0
 /// <summary>
 /// Sets the product that was agreed when the trade occurred.
 /// <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(FxNdf product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.product_Renamed = product;
     return(this);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(FxNdfTrade beanToCopy)
 {
     this.info_Renamed    = beanToCopy.Info;
     this.product_Renamed = beanToCopy.Product;
 }
Exemplo n.º 10
0
 public virtual void test_builder_wrongCurrency()
 {
     assertThrowsIllegalArg(() => FxNdf.builder().agreedFxRate(FX_RATE).settlementCurrencyNotional(CurrencyAmount.of(EUR, NOTIONAL)).index(GBP_USD_WM).paymentDate(PAYMENT_DATE).build());
 }
Exemplo n.º 11
0
        public virtual void test_builder_wrongRate()
        {
            FxRate fxRate = FxRate.of(GBP, EUR, 1.1d);

            assertThrowsIllegalArg(() => FxNdf.builder().agreedFxRate(fxRate).settlementCurrencyNotional(CURRENCY_NOTIONAL).index(GBP_USD_WM).paymentDate(PAYMENT_DATE).build());
        }
Exemplo n.º 12
0
 internal static FxNdf sut2()
 {
     return(FxNdf.builder().agreedFxRate(FX_RATE).settlementCurrencyNotional(CurrencyAmount.of(USD, -NOTIONAL)).index(GBP_USD_WM).paymentDate(PAYMENT_DATE).build());
 }