Exemplo n.º 1
0
//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(OvernightIborSwapConvention convention, String name)
        public virtual void test_extendedEnum(OvernightIborSwapConvention convention, string name)
        {
            OvernightIborSwapConvention.of(name);     // ensures map is populated
            ImmutableMap <string, OvernightIborSwapConvention> map = OvernightIborSwapConvention.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 = "stubOn") public void test_stub_overnight(OvernightIborSwapConvention convention, com.opengamma.strata.basics.date.Tenor tenor)
        public virtual void test_stub_overnight(OvernightIborSwapConvention 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).minusDays(7)));
            assertTrue(endDate.isBefore(tradeDate.plus(tenor).plusDays(7)));
        }
Exemplo n.º 3
0
 private OvernightIborSwapTemplate(Period periodToStart, Tenor tenor, OvernightIborSwapConvention convention)
 {
     JodaBeanUtils.notNull(periodToStart, "periodToStart");
     JodaBeanUtils.notNull(tenor, "tenor");
     JodaBeanUtils.notNull(convention, "convention");
     this.periodToStart = periodToStart;
     this.tenor         = tenor;
     this.convention    = convention;
     validate();
 }
Exemplo n.º 4
0
        //-------------------------------------------------------------------------
        public virtual void test_toTrade_tenor()
        {
            OvernightIborSwapConvention @base = ImmutableOvernightIborSwapConvention.of(NAME, FFUND_LEG, USD_LIBOR_3M_LEG, PLUS_TWO_DAYS);
            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(FFUND_LEG.toLeg(startDate, endDate, PAY, NOTIONAL_2M, 0.25d), USD_LIBOR_3M_LEG.toLeg(startDate, endDate, RECEIVE, NOTIONAL_2M));

            assertEquals(test.Info.TradeDate, tradeDate);
            assertEquals(test.Product, expected);
        }
Exemplo n.º 5
0
        private static CurveNode curveOvernightIborCurveNode(string conventionStr, string timeStr, string label, QuoteId quoteId, double spread, CurveNodeDate date, CurveNodeDateOrder order)
        {
            Matcher matcher = SIMPLE_YMD_TIME_REGEX.matcher(timeStr.ToUpper(Locale.ENGLISH));

            if (!matcher.matches())
            {
                throw new System.ArgumentException(Messages.format("Invalid time format for Overnight-Ibor swap: {}", timeStr));
            }
            Period periodToEnd = Period.parse("P" + matcher.group(1));
            OvernightIborSwapConvention convention = OvernightIborSwapConvention.of(conventionStr);
            OvernightIborSwapTemplate   template   = OvernightIborSwapTemplate.of(Tenor.of(periodToEnd), convention);

            return(OvernightIborSwapCurveNode.builder().template(template).rateId(quoteId).additionalSpread(spread).label(label).date(date).dateOrder(order).build());
        }
Exemplo n.º 6
0
            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 = (OvernightIborSwapConvention)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
Exemplo n.º 7
0
 /// <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.
 ///
 /// </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 OvernightIborSwapTemplate of(Period periodToStart, Tenor tenor, OvernightIborSwapConvention convention)
 {
     return(OvernightIborSwapTemplate.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 = "dayCount") public void test_day_count(OvernightIborSwapConvention convention, com.opengamma.strata.basics.date.DayCount dayCount)
        public virtual void test_day_count(OvernightIborSwapConvention convention, DayCount dayCount)
        {
            assertEquals(convention.OvernightLeg.DayCount, dayCount);
            assertEquals(convention.IborLeg.DayCount, dayCount);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "periodOn") public void test_accrualPeriod_on(OvernightIborSwapConvention convention, com.opengamma.strata.basics.schedule.Frequency frequency)
        public virtual void test_accrualPeriod_on(OvernightIborSwapConvention convention, Frequency frequency)
        {
            assertEquals(convention.OvernightLeg.AccrualFrequency, frequency);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "periodOn") public void test_paymentPeriod_on(OvernightIborSwapConvention convention, com.opengamma.strata.basics.schedule.Frequency frequency)
        public virtual void test_paymentPeriod_on(OvernightIborSwapConvention convention, Frequency frequency)
        {
            assertEquals(convention.OvernightLeg.PaymentFrequency, frequency);
        }
//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(OvernightIborSwapConvention convention, com.opengamma.strata.basics.date.BusinessDayConvention dayConvention)
        public virtual void test_day_convention(OvernightIborSwapConvention convention, BusinessDayConvention dayConvention)
        {
            assertEquals(convention.OvernightLeg.AccrualBusinessDayAdjustment.Convention, dayConvention);
        }
Exemplo n.º 12
0
//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(OvernightIborSwapConvention convention, String name)
        public virtual void test_of_lookup(OvernightIborSwapConvention convention, string name)
        {
            assertEquals(OvernightIborSwapConvention.of(name), convention);
        }
Exemplo n.º 13
0
//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(OvernightIborSwapConvention convention, String name)
        public virtual void test_toString(OvernightIborSwapConvention convention, string name)
        {
            assertEquals(convention.ToString(), name);
        }
Exemplo n.º 14
0
 /// <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(OvernightIborSwapConvention convention)
 {
     JodaBeanUtils.notNull(convention, "convention");
     this.convention_Renamed = convention;
     return(this);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(OvernightIborSwapTemplate beanToCopy)
 {
     this.periodToStart_Renamed = beanToCopy.PeriodToStart;
     this.tenor_Renamed         = beanToCopy.Tenor;
     this.convention_Renamed    = beanToCopy.Convention;
 }
Exemplo n.º 16
0
 public virtual void test_of_lookup_notFound()
 {
     assertThrowsIllegalArg(() => OvernightIborSwapConvention.of("Rubbish"));
 }
Exemplo n.º 17
0
 public virtual void test_of_lookup_null()
 {
     assertThrowsIllegalArg(() => OvernightIborSwapConvention.of((string)null));
 }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "onLeg") public void test_float_leg(OvernightIborSwapConvention convention, com.opengamma.strata.basics.index.OvernightIndex floatLeg)
        public virtual void test_float_leg(OvernightIborSwapConvention convention, OvernightIndex floatLeg)
        {
            assertEquals(convention.OvernightLeg.Index, floatLeg);
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "iborLeg") public void test_ibor_leg(OvernightIborSwapConvention convention, com.opengamma.strata.basics.index.IborIndex iborLeg)
        public virtual void test_ibor_leg(OvernightIborSwapConvention convention, IborIndex iborLeg)
        {
            assertEquals(convention.IborLeg.Index, iborLeg);
        }
Exemplo n.º 20
0
 //-------------------------------------------------------------------------
 /// <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 OvernightIborSwapTemplate of(Tenor tenor, OvernightIborSwapConvention convention)
 {
     return(of(Period.ZERO, tenor, convention));
 }
Exemplo n.º 21
0
//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(OvernightIborSwapConvention convention, String name)
        public virtual void test_name(OvernightIborSwapConvention convention, string name)
        {
            assertEquals(convention.Name, name);
        }