Ejemplo n.º 1
0
 private FixedInflationSwapTemplate(Tenor tenor, FixedInflationSwapConvention convention)
 {
     JodaBeanUtils.notNull(tenor, "tenor");
     JodaBeanUtils.notNull(convention, "convention");
     this.tenor      = tenor;
     this.convention = 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_extendedEnum(FixedInflationSwapConvention convention, String name)
        public virtual void test_extendedEnum(FixedInflationSwapConvention convention, string name)
        {
            FixedInflationSwapConvention.of(name);     // ensures map is populated
            ImmutableMap <string, FixedInflationSwapConvention> map = FixedInflationSwapConvention.extendedEnum().lookupAll();

            assertEquals(map.get(name), convention);
        }
Ejemplo n.º 3
0
        private static CurveNode curveFixedInflationCurveNode(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 Fixed-Inflation swap: {}", timeStr));
            }
            Period periodToEnd = Period.parse("P" + matcher.group(1));
            FixedInflationSwapConvention convention = FixedInflationSwapConvention.of(conventionStr);
            FixedInflationSwapTemplate   template   = FixedInflationSwapTemplate.of(Tenor.of(periodToEnd), convention);

            return(FixedInflationSwapCurveNode.builder().template(template).rateId(quoteId).additionalSpread(spread).label(label).date(date).dateOrder(order).build());
        }
Ejemplo n.º 4
0
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 110246592:         // tenor
                    this.tenor_Renamed = (Tenor)newValue;
                    break;

                case 2039569265:         // convention
                    this.convention_Renamed = (FixedInflationSwapConvention)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
        public virtual void test_serialization()
        {
            FixedInflationSwapConvention test = ImmutableFixedInflationSwapConvention.of(NAME, FIXED, INFL, PLUS_ONE_DAY);

            assertSerialization(test);
        }
 public virtual void test_of_lookup_null()
 {
     assertThrowsIllegalArg(() => FixedInflationSwapConvention.of((string)null));
 }
 public virtual void test_of_lookup_notFound()
 {
     assertThrowsIllegalArg(() => FixedInflationSwapConvention.of("Rubbish"));
 }
//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(FixedInflationSwapConvention convention, String name)
        public virtual void test_of_lookup(FixedInflationSwapConvention convention, string name)
        {
            assertEquals(FixedInflationSwapConvention.of(name), 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_toString(FixedInflationSwapConvention convention, String name)
        public virtual void test_toString(FixedInflationSwapConvention 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_name(FixedInflationSwapConvention convention, String name)
        public virtual void test_name(FixedInflationSwapConvention convention, string name)
        {
            assertEquals(convention.Name, name);
        }
Ejemplo n.º 11
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test(dataProvider = "floatLeg") public void test_float_leg(FixedInflationSwapConvention convention, com.opengamma.strata.basics.index.PriceIndex floatLeg)
        public virtual void test_float_leg(FixedInflationSwapConvention convention, PriceIndex floatLeg)
        {
            assertEquals(convention.FloatingLeg.Index, floatLeg);
        }
Ejemplo n.º 12
0
        //-------------------------------------------------------------------------

        /// <summary>
        /// Creates a template based on the specified tenor and convention.
        /// </summary>
        /// <param name="tenor">  the tenor of the swap </param>
        /// <param name="convention">  the market convention </param>
        /// <returns> the template </returns>
        public static FixedInflationSwapTemplate of(Tenor tenor, FixedInflationSwapConvention convention)
        {
            return(FixedInflationSwapTemplate.builder().tenor(tenor).convention(convention).build());
        }
Ejemplo n.º 13
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(FixedInflationSwapConvention convention)
 {
     JodaBeanUtils.notNull(convention, "convention");
     this.convention_Renamed = convention;
     return(this);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Restricted copy constructor. </summary>
 /// <param name="beanToCopy">  the bean to copy from, not null </param>
 internal Builder(FixedInflationSwapTemplate beanToCopy)
 {
     this.tenor_Renamed      = beanToCopy.Tenor;
     this.convention_Renamed = beanToCopy.Convention;
 }