Beispiel #1
0
 private ResolvedFraTrade(TradeInfo info, ResolvedFra product)
 {
     JodaBeanUtils.notNull(info, "info");
     JodaBeanUtils.notNull(product, "product");
     this.info    = info;
     this.product = product;
 }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ResolvedFra other = (ResolvedFra)obj;
         return(JodaBeanUtils.equal(currency, other.currency) && JodaBeanUtils.equal(notional, other.notional) && JodaBeanUtils.equal(paymentDate, other.paymentDate) && JodaBeanUtils.equal(startDate, other.startDate) && JodaBeanUtils.equal(endDate, other.endDate) && JodaBeanUtils.equal(yearFraction, other.yearFraction) && JodaBeanUtils.equal(fixedRate, other.fixedRate) && JodaBeanUtils.equal(floatingRate, other.floatingRate) && JodaBeanUtils.equal(discounting, other.discounting));
     }
     return(false);
 }
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            ResolvedFra test = sut();

            assertEquals(test.PaymentDate, date(2015, 6, 16));
            assertEquals(test.StartDate, date(2015, 6, 15));
            assertEquals(test.EndDate, date(2015, 9, 15));
            assertEquals(test.YearFraction, 0.25d, 0d);
            assertEquals(test.FixedRate, 0.25d, 0d);
            assertEquals(test.FloatingRate, IborRateComputation.of(GBP_LIBOR_3M, date(2015, 6, 12), REF_DATA));
            assertEquals(test.Currency, GBP);
            assertEquals(test.Notional, NOTIONAL_1M, 0d);
            assertEquals(test.Discounting, ISDA);
            assertEquals(test.allIndices(), ImmutableSet.of(GBP_LIBOR_3M));
        }
        public virtual void test_resolve_IborInterpolated()
        {
            Fra         fra  = Fra.builder().buySell(SELL).notional(NOTIONAL_1M).startDate(date(2015, 6, 12)).endDate(date(2015, 9, 5)).businessDayAdjustment(BDA_MOD_FOLLOW).fixedRate(FIXED_RATE).index(GBP_LIBOR_3M).indexInterpolated(GBP_LIBOR_2M).fixingDateOffset(MINUS_TWO_DAYS).build();
            ResolvedFra test = fra.resolve(REF_DATA);

            assertEquals(test.Currency, GBP);
            assertEquals(test.Notional, -NOTIONAL_1M, 0d);     // sell
            assertEquals(test.StartDate, date(2015, 6, 12));
            assertEquals(test.EndDate, date(2015, 9, 7));
            assertEquals(test.PaymentDate, date(2015, 6, 12));
            assertEquals(test.FixedRate, FIXED_RATE, 0d);
            assertEquals(test.FloatingRate, IborInterpolatedRateComputation.of(GBP_LIBOR_2M, GBP_LIBOR_3M, date(2015, 6, 10), REF_DATA));
            assertEquals(test.YearFraction, ACT_365F.yearFraction(date(2015, 6, 12), date(2015, 9, 7)), 0d);
            assertEquals(test.Discounting, ISDA);
        }
        //-------------------------------------------------------------------------
        public virtual void test_resolve_Ibor()
        {
            Fra         fra  = Fra.builder().buySell(BUY).notional(NOTIONAL_1M).startDate(date(2015, 6, 15)).endDate(date(2015, 9, 15)).paymentDate(AdjustableDate.of(date(2015, 6, 20), BDA_MOD_FOLLOW)).fixedRate(FIXED_RATE).index(GBP_LIBOR_3M).fixingDateOffset(MINUS_TWO_DAYS).build();
            ResolvedFra test = fra.resolve(REF_DATA);

            assertEquals(test.Currency, GBP);
            assertEquals(test.Notional, NOTIONAL_1M, 0d);
            assertEquals(test.StartDate, date(2015, 6, 15));
            assertEquals(test.EndDate, date(2015, 9, 15));
            assertEquals(test.PaymentDate, date(2015, 6, 22));
            assertEquals(test.FixedRate, FIXED_RATE, 0d);
            assertEquals(test.FloatingRate, IborRateComputation.of(GBP_LIBOR_3M, date(2015, 6, 11), REF_DATA));
            assertEquals(test.YearFraction, ACT_365F.yearFraction(date(2015, 6, 15), date(2015, 9, 15)), 0d);
            assertEquals(test.Discounting, ISDA);
        }
Beispiel #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 = (ResolvedFra)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
 internal static ResolvedFra sut2()
 {
     return(ResolvedFra.builder().paymentDate(date(2015, 6, 17)).startDate(date(2015, 6, 16)).endDate(date(2015, 9, 16)).yearFraction(0.26d).fixedRate(0.27d).floatingRate(IborRateComputation.of(GBP_LIBOR_2M, date(2015, 6, 12), REF_DATA)).currency(USD).notional(NOTIONAL_2M).discounting(FraDiscountingMethod.NONE).build());
 }
 //-------------------------------------------------------------------------
 internal static ResolvedFra sut()
 {
     return(ResolvedFra.builder().paymentDate(date(2015, 6, 16)).startDate(date(2015, 6, 15)).endDate(date(2015, 9, 15)).yearFraction(0.25d).fixedRate(0.25d).floatingRate(IborRateComputation.of(GBP_LIBOR_3M, date(2015, 6, 12), REF_DATA)).currency(GBP).notional(NOTIONAL_1M).discounting(ISDA).build());
 }
        public virtual void test_serialization()
        {
            ResolvedFra test = sut();

            assertSerialization(test);
        }
 public virtual void test_builder_datesInOrder()
 {
     assertThrowsIllegalArg(() => ResolvedFra.builder().notional(NOTIONAL_1M).paymentDate(date(2015, 6, 15)).startDate(date(2015, 6, 15)).endDate(date(2015, 6, 14)).fixedRate(0.25d).floatingRate(IborRateComputation.of(GBP_LIBOR_3M, date(2015, 6, 12), REF_DATA)).build());
 }
Beispiel #11
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance of a resolved FRA trade.
 /// </summary>
 /// <param name="info">  the trade info </param>
 /// <param name="product">  the product </param>
 /// <returns> the resolved trade </returns>
 public static ResolvedFraTrade of(TradeInfo info, ResolvedFra product)
 {
     return(new ResolvedFraTrade(info, product));
 }
Beispiel #12
0
 /// <summary>
 /// Sets the resolved FRA 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(ResolvedFra product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.product_Renamed = product;
     return(this);
 }
Beispiel #13
0
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(ResolvedFraTrade beanToCopy)
 {
     this.info_Renamed    = beanToCopy.Info;
     this.product_Renamed = beanToCopy.Product;
 }