public virtual void test_of() { XCcyIborIborSwapTemplate test = XCcyIborIborSwapTemplate.of(Period.ofMonths(3), TENOR_10Y, CONV); assertEquals(test.PeriodToStart, Period.ofMonths(3)); assertEquals(test.Tenor, TENOR_10Y); assertEquals(test.Convention, CONV); assertEquals(test.CurrencyPair, EUR_USD); }
//------------------------------------------------------------------------- public virtual void coverage() { XCcyIborIborSwapTemplate test = XCcyIborIborSwapTemplate.of(Period.ofMonths(3), TENOR_10Y, CONV); coverImmutableBean(test); DaysAdjustment bda2 = DaysAdjustment.ofBusinessDays(1, EUTA); XCcyIborIborSwapConvention conv2 = ImmutableXCcyIborIborSwapConvention.of("XXX", USD3M, EUR3M, bda2); XCcyIborIborSwapTemplate test2 = XCcyIborIborSwapTemplate.of(Period.ofMonths(2), TENOR_2Y, conv2); coverBeanEquals(test, test2); }
//------------------------------------------------------------------------- public virtual void test_createTrade() { XCcyIborIborSwapTemplate @base = XCcyIborIborSwapTemplate.of(Period.ofMonths(3), TENOR_10Y, CONV); LocalDate tradeDate = LocalDate.of(2015, 5, 5); LocalDate startDate = date(2015, 8, 7); LocalDate endDate = date(2025, 8, 7); SwapTrade test = @base.createTrade(tradeDate, BUY, NOTIONAL_2M, NOTIONAL_2M * FX_EUR_USD, 0.25d, REF_DATA); Swap expected = Swap.of(EUR3M.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), USD3M.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M * FX_EUR_USD)); assertEquals(test.Info.TradeDate, tradeDate); assertEquals(test.Product, expected); }
public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { XCcyIborIborSwapTemplate other = (XCcyIborIborSwapTemplate)obj; return(JodaBeanUtils.equal(periodToStart, other.periodToStart) && JodaBeanUtils.equal(tenor, other.tenor) && JodaBeanUtils.equal(convention, other.convention)); } return(false); }
//------------------------------------------------------------------------- public virtual void test_builder_notEnoughData() { assertThrowsIllegalArg(() => XCcyIborIborSwapTemplate.builder().tenor(TENOR_2Y).build()); }
public virtual void test_serialization() { XCcyIborIborSwapTemplate test = XCcyIborIborSwapTemplate.of(Period.ofMonths(3), TENOR_10Y, CONV); assertSerialization(test); }
/// <summary> /// Obtains a template based on the specified period, tenor and convention. /// <para> /// The period from the spot date to the start date is specified. /// The tenor from the start date to the end date is also specified. /// /// </para> /// </summary> /// <param name="periodToStart"> the period between the spot date and the start date </param> /// <param name="tenor"> the tenor of the swap </param> /// <param name="convention"> the market convention </param> /// <returns> the template </returns> public static XCcyIborIborSwapTemplate of(Period periodToStart, Tenor tenor, XCcyIborIborSwapConvention convention) { return(XCcyIborIborSwapTemplate.builder().periodToStart(periodToStart).tenor(tenor).convention(convention).build()); }