//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "name") public void test_extendedEnum(ThreeLegBasisSwapConvention convention, String name) public virtual void test_extendedEnum(ThreeLegBasisSwapConvention convention, string name) { ThreeLegBasisSwapConvention.of(name); // ensures map is populated ImmutableMap <string, ThreeLegBasisSwapConvention> map = ThreeLegBasisSwapConvention.extendedEnum().lookupAll(); assertEquals(map.get(name), convention); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "stubIbor") public void test_stub_ibor(ThreeLegBasisSwapConvention convention, com.opengamma.strata.basics.date.Tenor tenor) public virtual void test_stub_ibor(ThreeLegBasisSwapConvention convention, Tenor tenor) { LocalDate tradeDate = LocalDate.of(2015, 10, 20); SwapTrade swap = convention.createTrade(tradeDate, tenor, BuySell.BUY, 1, 0.01, REF_DATA); ResolvedSwap swapResolved = swap.Product.resolve(REF_DATA); LocalDate endDate = swapResolved.getLeg(PayReceive.PAY).get().EndDate; assertTrue(endDate.isAfter(tradeDate.plus(tenor).minusMonths(1))); assertTrue(endDate.isBefore(tradeDate.plus(tenor).plusMonths(1))); }
private ThreeLegBasisSwapTemplate(Period periodToStart, Tenor tenor, ThreeLegBasisSwapConvention convention) { JodaBeanUtils.notNull(periodToStart, "periodToStart"); JodaBeanUtils.notNull(tenor, "tenor"); JodaBeanUtils.notNull(convention, "convention"); this.periodToStart = periodToStart; this.tenor = tenor; this.convention = convention; validate(); }
public virtual void test_toTrade_dates() { ThreeLegBasisSwapConvention @base = ImmutableThreeLegBasisSwapConvention.of(NAME, FIXED, IBOR6M, IBOR12M); LocalDate tradeDate = LocalDate.of(2015, 5, 5); LocalDate startDate = date(2015, 8, 5); LocalDate endDate = date(2015, 11, 5); SwapTrade test = @base.toTrade(tradeDate, startDate, endDate, BUY, NOTIONAL_2M, 0.25d); Swap expected = Swap.of(FIXED.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), IBOR6M.toLeg(startDate, endDate, PAY, NOTIONAL_2M), IBOR12M.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M)); assertEquals(test.Info.TradeDate, tradeDate); assertEquals(test.Product, expected); }
public virtual void test_toTrade_periodTenor() { ThreeLegBasisSwapConvention @base = ImmutableThreeLegBasisSwapConvention.of(NAME, FIXED, IBOR6M, IBOR12M); LocalDate tradeDate = LocalDate.of(2015, 5, 5); LocalDate startDate = date(2015, 8, 7); LocalDate endDate = date(2025, 8, 7); SwapTrade test = @base.createTrade(tradeDate, Period.ofMonths(3), TENOR_10Y, BUY, NOTIONAL_2M, 0.25d, REF_DATA); Swap expected = Swap.of(FIXED.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), IBOR6M.toLeg(startDate, endDate, PAY, NOTIONAL_2M), IBOR12M.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M)); assertEquals(test.Info.TradeDate, tradeDate); assertEquals(test.Product, expected); }
private static CurveNode curveThreeLegBasisCurveNode(string conventionStr, string timeStr, string label, QuoteId quoteId, double spread, CurveNodeDate date, CurveNodeDateOrder order) { Matcher matcher = SIMPLE_YM_TIME_REGEX.matcher(timeStr.ToUpper(Locale.ENGLISH)); if (!matcher.matches()) { throw new System.ArgumentException(Messages.format("Invalid time format for Three legs basis swap: {}", timeStr)); } Period periodToEnd = Period.parse("P" + matcher.group(1)); ThreeLegBasisSwapConvention convention = ThreeLegBasisSwapConvention.of(conventionStr); ThreeLegBasisSwapTemplate template = ThreeLegBasisSwapTemplate.of(Tenor.of(periodToEnd), convention); return(ThreeLegBasisSwapCurveNode.builder().template(template).rateId(quoteId).additionalSpread(spread).label(label).date(date).dateOrder(order).build()); }
public override Builder set(string propertyName, object newValue) { switch (propertyName.GetHashCode()) { case -574688858: // periodToStart this.periodToStart_Renamed = (Period)newValue; break; case 110246592: // tenor this.tenor_Renamed = (Tenor)newValue; break; case 2039569265: // convention this.convention_Renamed = (ThreeLegBasisSwapConvention)newValue; break; default: throw new NoSuchElementException("Unknown property: " + propertyName); } return(this); }
/// <summary> /// Restricted copy constructor. </summary> /// <param name="beanToCopy"> the bean to copy from, not null </param> internal Builder(ThreeLegBasisSwapTemplate beanToCopy) { this.periodToStart_Renamed = beanToCopy.PeriodToStart; this.tenor_Renamed = beanToCopy.Tenor; this.convention_Renamed = beanToCopy.Convention; }
/// <summary> /// Creates a template based on the specified period, tenor and convention. /// <para> /// The period from the spot date to the start date is 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 ThreeLegBasisSwapTemplate of(Period periodToStart, Tenor tenor, ThreeLegBasisSwapConvention convention) { return(ThreeLegBasisSwapTemplate.builder().periodToStart(periodToStart).tenor(tenor).convention(convention).build()); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "name") public void test_name(ThreeLegBasisSwapConvention convention, String name) public virtual void test_name(ThreeLegBasisSwapConvention convention, string name) { assertEquals(convention.Name, name); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "period") public void test_period(ThreeLegBasisSwapConvention convention, com.opengamma.strata.basics.schedule.Frequency frequency) public virtual void test_period(ThreeLegBasisSwapConvention convention, Frequency frequency) { assertEquals(convention.SpreadFloatingLeg.PaymentFrequency, frequency); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "dayCount") public void test_composition(ThreeLegBasisSwapConvention convention, com.opengamma.strata.product.swap.CompoundingMethod comp) public virtual void test_composition(ThreeLegBasisSwapConvention convention, CompoundingMethod comp) { assertEquals(convention.SpreadLeg.CompoundingMethod, comp); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "dayConvention") public void test_day_convention(ThreeLegBasisSwapConvention convention, com.opengamma.strata.basics.date.BusinessDayConvention dayConvention) public virtual void test_day_convention(ThreeLegBasisSwapConvention convention, BusinessDayConvention dayConvention) { assertEquals(convention.SpreadLeg.AccrualBusinessDayAdjustment.Convention, dayConvention); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "name") public void test_toString(ThreeLegBasisSwapConvention convention, String name) public virtual void test_toString(ThreeLegBasisSwapConvention convention, string name) { assertEquals(convention.ToString(), name); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "name") public void test_of_lookup(ThreeLegBasisSwapConvention convention, String name) public virtual void test_of_lookup(ThreeLegBasisSwapConvention convention, string name) { assertEquals(ThreeLegBasisSwapConvention.of(name), convention); }
/// <summary> /// Sets the market convention of the swap. </summary> /// <param name="convention"> the new value, not null </param> /// <returns> this, for chaining, not null </returns> public Builder convention(ThreeLegBasisSwapConvention convention) { JodaBeanUtils.notNull(convention, "convention"); this.convention_Renamed = convention; return(this); }
public virtual void test_serialization() { ThreeLegBasisSwapConvention test = ImmutableThreeLegBasisSwapConvention.of(NAME, FIXED, IBOR6M, IBOR12M); assertSerialization(test); }
public virtual void test_of_lookup_null() { assertThrowsIllegalArg(() => ThreeLegBasisSwapConvention.of((string)null)); }
public virtual void test_of_lookup_notFound() { assertThrowsIllegalArg(() => ThreeLegBasisSwapConvention.of("Rubbish")); }
//------------------------------------------------------------------------- /// <summary> /// Obtains a template based on the specified tenor and convention. /// <para> /// The swap will start on the spot date. /// /// </para> /// </summary> /// <param name="tenor"> the tenor of the swap </param> /// <param name="convention"> the market convention </param> /// <returns> the template </returns> public static ThreeLegBasisSwapTemplate of(Tenor tenor, ThreeLegBasisSwapConvention convention) { return(of(Period.ZERO, tenor, convention)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test(dataProvider = "flatFloatingLeg") public void test_flat_floating_leg(ThreeLegBasisSwapConvention convention, com.opengamma.strata.basics.index.IborIndex index) public virtual void test_flat_floating_leg(ThreeLegBasisSwapConvention convention, IborIndex index) { assertEquals(convention.FlatFloatingLeg.Index, index); }