//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(IborIborSwapConvention convention, String name)
        public virtual void test_extendedEnum(IborIborSwapConvention convention, string name)
        {
            IborIborSwapConvention.of(name);     // ensures map is populated
            ImmutableMap <string, IborIborSwapConvention> map = IborIborSwapConvention.extendedEnum().lookupAll();

            assertEquals(map.get(name), convention);
        }
 private IborIborSwapTemplate(Period periodToStart, Tenor tenor, IborIborSwapConvention convention)
 {
     JodaBeanUtils.notNull(periodToStart, "periodToStart");
     JodaBeanUtils.notNull(tenor, "tenor");
     JodaBeanUtils.notNull(convention, "convention");
     this.periodToStart = periodToStart;
     this.tenor         = tenor;
     this.convention    = convention;
     validate();
 }
//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(IborIborSwapConvention convention, com.opengamma.strata.basics.date.Tenor tenor)
        public virtual void test_stub_ibor(IborIborSwapConvention 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)));
        }
        //-------------------------------------------------------------------------
        public virtual void test_toTrade_tenor()
        {
            IborIborSwapConvention @base = ImmutableIborIborSwapConvention.of(NAME, IBOR3M, IBOR6M);
            LocalDate tradeDate          = LocalDate.of(2015, 5, 5);
            LocalDate startDate          = date(2015, 5, 7);
            LocalDate endDate            = date(2025, 5, 7);
            SwapTrade test     = @base.createTrade(tradeDate, TENOR_10Y, BUY, NOTIONAL_2M, 0.25d, REF_DATA);
            Swap      expected = Swap.of(IBOR3M.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), IBOR6M.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M));

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product, expected);
        }
Esempio n. 5
0
        private static CurveNode curveIborIborCurveNode(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 Ibor-Ibor swap: {}", timeStr));
            }
            Period periodToEnd = Period.parse("P" + matcher.group(1));
            IborIborSwapConvention convention = IborIborSwapConvention.of(conventionStr);
            IborIborSwapTemplate   template   = IborIborSwapTemplate.of(Tenor.of(periodToEnd), convention);

            return(IborIborSwapCurveNode.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 = (IborIborSwapConvention)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
//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(IborIborSwapConvention convention, String name)
        public virtual void test_toString(IborIborSwapConvention 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 = "dayConvention") public void test_day_convention(IborIborSwapConvention convention, com.opengamma.strata.basics.date.BusinessDayConvention dayConvention)
        public virtual void test_day_convention(IborIborSwapConvention 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 = "flatLeg") public void test_flat_leg(IborIborSwapConvention convention, com.opengamma.strata.basics.index.IborIndex index)
        public virtual void test_flat_leg(IborIborSwapConvention convention, IborIndex index)
        {
            assertEquals(convention.FlatLeg.Index, index);
        }
//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(IborIborSwapConvention convention, com.opengamma.strata.product.swap.CompoundingMethod comp)
        public virtual void test_composition(IborIborSwapConvention convention, CompoundingMethod comp)
        {
            assertEquals(convention.SpreadLeg.CompoundingMethod, comp);
        }
 public virtual void test_of_lookup_null()
 {
     assertThrowsIllegalArg(() => IborIborSwapConvention.of((string)null));
 }
 public virtual void test_of_lookup_notFound()
 {
     assertThrowsIllegalArg(() => IborIborSwapConvention.of("Rubbish"));
 }
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(IborIborSwapTemplate beanToCopy)
 {
     this.periodToStart_Renamed = beanToCopy.PeriodToStart;
     this.tenor_Renamed         = beanToCopy.Tenor;
     this.convention_Renamed    = beanToCopy.Convention;
 }
//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(IborIborSwapConvention convention, com.opengamma.strata.basics.schedule.Frequency frequency)
        public virtual void test_period(IborIborSwapConvention convention, Frequency frequency)
        {
            assertEquals(convention.SpreadLeg.PaymentFrequency, frequency);
        }
//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(IborIborSwapConvention convention, String name)
        public virtual void test_name(IborIborSwapConvention convention, string name)
        {
            assertEquals(convention.Name, name);
        }
 /// <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(IborIborSwapConvention convention)
 {
     JodaBeanUtils.notNull(convention, "convention");
     this.convention_Renamed = convention;
     return(this);
 }
        public virtual void test_serialization()
        {
            IborIborSwapConvention test = ImmutableIborIborSwapConvention.of(NAME, IBOR3M, IBOR6M);

            assertSerialization(test);
        }
 //-------------------------------------------------------------------------
 /// <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 IborIborSwapTemplate of(Tenor tenor, IborIborSwapConvention 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 = "name") public void test_of_lookup(IborIborSwapConvention convention, String name)
        public virtual void test_of_lookup(IborIborSwapConvention convention, string name)
        {
            assertEquals(IborIborSwapConvention.of(name), convention);
        }
 /// <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 IborIborSwapTemplate of(Period periodToStart, Tenor tenor, IborIborSwapConvention convention)
 {
     return(IborIborSwapTemplate.builder().periodToStart(periodToStart).tenor(tenor).convention(convention).build());
 }