예제 #1
0
 //-------------------------------------------------------------------------
 public virtual void test_getLegs_SwapLegType()
 {
     assertEquals(ResolvedSwap.of(LEG1, LEG2).getLegs(FIXED), ImmutableList.of(LEG1));
     assertEquals(ResolvedSwap.of(LEG1, LEG2).getLegs(IBOR), ImmutableList.of(LEG2));
     assertEquals(ResolvedSwap.of(LEG1, LEG2).getLegs(OVERNIGHT), ImmutableList.of());
     assertEquals(ResolvedSwap.of(LEG1, LEG2).getLegs(OTHER), ImmutableList.of());
 }
예제 #2
0
        public virtual void test_builder()
        {
            ResolvedSwap test = ResolvedSwap.builder().legs(LEG1).build();

            assertEquals(test.Legs, ImmutableSet.of(LEG1));
            assertEquals(test.CrossCurrency, false);
            assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(GBP));
            assertEquals(test.allIndices(), ImmutableSet.of(GBP_LIBOR_3M));
        }
예제 #3
0
        public virtual void test_of_singleCurrency()
        {
            ResolvedSwap test = ResolvedSwap.of(LEG1);

            assertEquals(test.Legs, ImmutableSet.of(LEG1));
            assertEquals(test.CrossCurrency, false);
            assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(GBP));
            assertEquals(test.allIndices(), ImmutableSet.of(GBP_LIBOR_3M));
        }
예제 #4
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            ResolvedSwap test = ResolvedSwap.builder().legs(LEG1).build();

            coverImmutableBean(test);
            ResolvedSwap test2 = ResolvedSwap.builder().legs(LEG2).build();

            coverBeanEquals(test, test2);
        }
예제 #5
0
 public virtual void test_getLeg_PayReceive()
 {
     assertEquals(ResolvedSwap.of(LEG1, LEG2).getLeg(PAY), LEG1);
     assertEquals(ResolvedSwap.of(LEG1, LEG2).getLeg(RECEIVE), LEG2);
     assertEquals(ResolvedSwap.of(LEG1).getLeg(PAY), LEG1);
     assertEquals(ResolvedSwap.of(LEG2).getLeg(PAY), null);
     assertEquals(ResolvedSwap.of(LEG1).getLeg(RECEIVE), null);
     assertEquals(ResolvedSwap.of(LEG2).getLeg(RECEIVE), LEG2);
 }
예제 #6
0
        public virtual void test_resolve_unadjustedAccrualAdjustedPayment()
        {
            Swap test                  = Swap.builder().legs(RateCalculationSwapLeg.builder().payReceive(RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(date(2016, 1, 3)).endDate(date(2016, 5, 3)).frequency(Frequency.P1M).businessDayAdjustment(BusinessDayAdjustment.NONE).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P1M).businessDayAdjustment(BusinessDayAdjustment.of(FOLLOWING, SAT_SUN)).paymentDateOffset(DaysAdjustment.ofBusinessDays(2, SAT_SUN)).build()).notionalSchedule(NotionalSchedule.of(GBP, NOTIONAL)).calculation(FixedRateCalculation.of(RATE, ACT_360)).build()).build();
            RatePaymentPeriod pp1      = RatePaymentPeriod.builder().paymentDate(date(2016, 2, 5)).accrualPeriods(RateAccrualPeriod.builder().startDate(date(2016, 1, 3)).unadjustedStartDate(date(2016, 1, 3)).endDate(date(2016, 2, 3)).unadjustedEndDate(date(2016, 2, 3)).yearFraction(ACT_360.yearFraction(date(2016, 1, 3), date(2016, 2, 3))).rateComputation(FixedRateComputation.of(RATE)).build()).dayCount(ACT_360).currency(GBP).notional(NOTIONAL).build();
            RatePaymentPeriod pp2      = RatePaymentPeriod.builder().paymentDate(date(2016, 3, 7)).accrualPeriods(RateAccrualPeriod.builder().startDate(date(2016, 2, 3)).unadjustedStartDate(date(2016, 2, 3)).endDate(date(2016, 3, 3)).unadjustedEndDate(date(2016, 3, 3)).yearFraction(ACT_360.yearFraction(date(2016, 2, 3), date(2016, 3, 3))).rateComputation(FixedRateComputation.of(RATE)).build()).dayCount(ACT_360).currency(GBP).notional(NOTIONAL).build();
            RatePaymentPeriod pp3      = RatePaymentPeriod.builder().paymentDate(date(2016, 4, 6)).accrualPeriods(RateAccrualPeriod.builder().startDate(date(2016, 3, 3)).unadjustedStartDate(date(2016, 3, 3)).endDate(date(2016, 4, 3)).unadjustedEndDate(date(2016, 4, 3)).yearFraction(ACT_360.yearFraction(date(2016, 3, 3), date(2016, 4, 3))).rateComputation(FixedRateComputation.of(RATE)).build()).dayCount(ACT_360).currency(GBP).notional(NOTIONAL).build();
            RatePaymentPeriod pp4      = RatePaymentPeriod.builder().paymentDate(date(2016, 5, 5)).accrualPeriods(RateAccrualPeriod.builder().startDate(date(2016, 4, 3)).unadjustedStartDate(date(2016, 4, 3)).endDate(date(2016, 5, 3)).unadjustedEndDate(date(2016, 5, 3)).yearFraction(ACT_360.yearFraction(date(2016, 4, 3), date(2016, 5, 3))).rateComputation(FixedRateComputation.of(RATE)).build()).dayCount(ACT_360).currency(GBP).notional(NOTIONAL).build();
            ResolvedSwap      expected = ResolvedSwap.builder().legs(ResolvedSwapLeg.builder().paymentPeriods(pp1, pp2, pp3, pp4).payReceive(RECEIVE).type(FIXED).build()).build();

            assertEqualsBean(test.resolve(REF_DATA), expected);
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         ResolvedSwap other = (ResolvedSwap)obj;
         return(JodaBeanUtils.equal(legs, other.legs));
     }
     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 = (ResolvedSwap)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
예제 #9
0
        public virtual void test_of()
        {
            ResolvedSwap test = ResolvedSwap.of(LEG1, LEG2);

            assertEquals(test.Legs, ImmutableSet.of(LEG1, LEG2));
            assertEquals(test.getLegs(SwapLegType.FIXED), ImmutableList.of(LEG1));
            assertEquals(test.getLegs(SwapLegType.IBOR), ImmutableList.of(LEG2));
            assertEquals(test.getLeg(PayReceive.PAY), LEG1);
            assertEquals(test.getLeg(PayReceive.RECEIVE), LEG2);
            assertEquals(test.PayLeg, LEG1);
            assertEquals(test.ReceiveLeg, LEG2);
            assertEquals(test.StartDate, LEG1.StartDate);
            assertEquals(test.EndDate, LEG1.EndDate);
            assertEquals(test.CrossCurrency, true);
            assertEquals(test.allPaymentCurrencies(), ImmutableSet.of(GBP, USD));
            assertEquals(test.allIndices(), ImmutableSet.of(GBP_LIBOR_3M));
        }
예제 #10
0
        //-------------------------------------------------------------------------
        public virtual void test_resolve()
        {
            Swap test = Swap.builder().legs(ImmutableList.of(MOCK_GBP1, MOCK_USD1)).build();

            assertEquals(test.resolve(REF_DATA), ResolvedSwap.of(MOCK_EXPANDED_GBP1, MOCK_EXPANDED_USD1));
        }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance of a resolved Swap trade.
 /// </summary>
 /// <param name="info">  the trade info </param>
 /// <param name="product">  the product </param>
 /// <returns> the resolved trade </returns>
 public static ResolvedSwapTrade of(TradeInfo info, ResolvedSwap product)
 {
     return(new ResolvedSwapTrade(info, product));
 }
 /// <summary>
 /// Sets the resolved Swap 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(ResolvedSwap 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(ResolvedSwapTrade beanToCopy)
 {
     this.info_Renamed    = beanToCopy.Info;
     this.product_Renamed = beanToCopy.Product;
 }
 /// <summary>
 /// Creates an instance. </summary>
 /// <param name="info">  the value of the property </param>
 /// <param name="product">  the value of the property, not null </param>
 internal ResolvedSwapTrade(TradeInfo info, ResolvedSwap product)
 {
     JodaBeanUtils.notNull(product, "product");
     this.info    = info;
     this.product = product;
 }
예제 #15
0
        public virtual void test_serialization()
        {
            ResolvedSwap test = ResolvedSwap.builder().legs(LEG1).build();

            assertSerialization(test);
        }