コード例 #1
0
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 3373707:         // name
                    this.name = (CurveName)newValue;
                    break;

                case 1107332838:         // parameterCount
                    this.parameterCount = (int?)newValue.Value;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
コード例 #2
0
        public virtual void test_builder_seasonality()
        {
            RatesCurveGroupDefinition test = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("Test")).addCurve(CURVE_DEFN1, GBP, GBP_LIBOR_1M, GBP_LIBOR_3M).addSeasonality(CURVE_NAME_I, SEASONALITY_ADDITIVE_DEF).build();

            assertEquals(test.Name, CurveGroupName.of("Test"));
            assertEquals(test.Entries, ImmutableList.of(ENTRY3));
            assertEquals(test.findEntry(CurveName.of("Test")), ENTRY3);
            assertEquals(test.findEntry(CurveName.of("Test2")), null);
            assertEquals(test.findEntry(CurveName.of("Rubbish")), null);
            assertEquals(test.findCurveDefinition(CurveName.of("Test")), CURVE_DEFN1);
            assertEquals(test.findCurveDefinition(CurveName.of("Test2")), null);
            assertEquals(test.findCurveDefinition(CurveName.of("Rubbish")), null);
            ImmutableMap <CurveName, SeasonalityDefinition> seasonMap = test.SeasonalityDefinitions;

            assertTrue(seasonMap.size() == 1);
            assertEquals(seasonMap.get(CURVE_NAME_I), SEASONALITY_ADDITIVE_DEF);
        }
コード例 #3
0
        public virtual void test_builder1()
        {
            RatesCurveGroupDefinition test = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("Test")).addDiscountCurve(CURVE_DEFN1, GBP).addForwardCurve(CURVE_DEFN1, GBP_SONIA).addForwardCurve(CURVE_DEFN1, GBP_LIBOR_1W).addForwardCurve(CURVE_DEFN2, GBP_LIBOR_1M, GBP_LIBOR_3M).build();

            assertEquals(test.Name, CurveGroupName.of("Test"));
            assertEquals(test.Entries, ImmutableList.of(ENTRY1, ENTRY2));
            assertEquals(test.findDiscountCurveName(GBP), CURVE_NAME1);
            assertEquals(test.findDiscountCurveName(USD), null);
            assertEquals(test.findForwardCurveName(GBP_LIBOR_1W), CURVE_NAME1);
            assertEquals(test.findForwardCurveName(GBP_LIBOR_1M), CURVE_NAME2);
            assertEquals(test.findForwardCurveName(GBP_LIBOR_6M), null);
            assertEquals(test.findForwardCurveNames(GBP_LIBOR), ImmutableSet.of(CURVE_NAME1, CURVE_NAME2));
            assertEquals(test.findEntry(CurveName.of("Test")), ENTRY1);
            assertEquals(test.findEntry(CurveName.of("Test2")), ENTRY2);
            assertEquals(test.findEntry(CurveName.of("Rubbish")), null);
            assertEquals(test.findCurveDefinition(CurveName.of("Test")), CURVE_DEFN1);
            assertEquals(test.findCurveDefinition(CurveName.of("Test2")), CURVE_DEFN2);
            assertEquals(test.findCurveDefinition(CurveName.of("Rubbish")), null);
        }
コード例 #4
0
        public virtual void test_of()
        {
            LegalEntityCurveGroup test = LegalEntityCurveGroup.of(NAME1, REPO_CURVES, ISSUER_CURVES);

            assertEquals(test.Name, NAME1);
            assertEquals(test.RepoCurves, REPO_CURVES);
            assertEquals(test.IssuerCurves, ISSUER_CURVES);
            assertEquals(test.findCurve(REPO_NAME).get(), REPO_CURVE);
            assertEquals(test.findCurve(ISSUER_NAME1).get(), ISSUER_CURVE1);
            assertEquals(test.findCurve(ISSUER_NAME2).get(), ISSUER_CURVE2);
            assertEquals(test.findCurve(ISSUER_NAME3).get(), ISSUER_CURVE3);
            assertFalse(test.findCurve(CurveName.of("foo")).Present);
            assertEquals(test.findRepoCurve(REPO_GROUP, GBP).get(), REPO_CURVE);
            assertEquals(test.findRepoCurve(REPO_GROUP, USD).get(), REPO_CURVE);
            assertFalse(test.findRepoCurve(REPO_GROUP, JPY).Present);
            assertEquals(test.findIssuerCurve(LEGAL_ENTITY_GROUP1, GBP).get(), ISSUER_CURVE1);
            assertEquals(test.findIssuerCurve(LEGAL_ENTITY_GROUP1, USD).get(), ISSUER_CURVE2);
            assertEquals(test.findIssuerCurve(LEGAL_ENTITY_GROUP2, GBP).get(), ISSUER_CURVE3);
            assertFalse(test.findIssuerCurve(LEGAL_ENTITY_GROUP2, USD).Present);
        }
コード例 #5
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") @Override public Builder set(String propertyName, Object newValue)
            public override Builder set(string propertyName, object newValue)
            {
                switch (propertyName.GetHashCode())
                {
                case 771153946:         // curveName
                    this.curveName_Renamed = (CurveName)newValue;
                    break;

                case -538086256:         // discountCurrencies
                    this.discountCurrencies_Renamed = (ISet <Currency>)newValue;
                    break;

                case 1943391143:         // indices
                    this.indices_Renamed = (ISet <Index>)newValue;
                    break;

                default:
                    throw new NoSuchElementException("Unknown property: " + propertyName);
                }
                return(this);
            }
コード例 #6
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates a constant curve with a specific value.
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="yValue">  the constant y-value </param>
 /// <returns> the curve </returns>
 public static ConstantCurve of(string name, double yValue)
 {
     return(of(CurveName.of(name), yValue));
 }
コード例 #7
0
 /// <summary>
 /// Creates curve metadata for a curve providing zero rates.
 /// <para>
 /// The x-values represent year fractions relative to an unspecified base date
 /// as defined by the specified day count.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="dayCount">  the day count </param>
 /// <param name="parameterMetadata">  the parameter metadata </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata zeroRates <T1>(CurveName name, DayCount dayCount, IList <T1> parameterMetadata) where T1 : com.opengamma.strata.market.param.ParameterMetadata
 {
     ArgChecker.notNull(name, "name");
     ArgChecker.notNull(dayCount, "dayCount");
     return(DefaultCurveMetadata.builder().curveName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(dayCount).parameterMetadata(parameterMetadata).build());
 }
コード例 #8
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates metadata for a curve providing a SABR parameter.
 /// <para>
 /// The x-values represent time to expiry year fractions as defined by the specified day count.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="dayCount">  the day count </param>
 /// <param name="yType">  the y-value type, which must be one of the four SABR values </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata sabrParameterByExpiry(string name, DayCount dayCount, ValueType yType)
 {
     return(sabrParameterByExpiry(CurveName.of(name), dayCount, yType));
 }
コード例 #9
0
 /// <summary>
 /// Creates curve metadata for a curve providing Black volatility by expiry.
 /// <para>
 /// The x-values represent year fractions relative to an unspecified base date
 /// as defined by the specified day count.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="dayCount">  the day count </param>
 /// <param name="parameterMetadata">  the parameter metadata </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata blackVolatilityByExpiry <T1>(CurveName name, DayCount dayCount, IList <T1> parameterMetadata) where T1 : com.opengamma.strata.market.param.ParameterMetadata
 {
     ArgChecker.notNull(name, "name");
     ArgChecker.notNull(dayCount, "dayCount");
     return(DefaultCurveMetadata.builder().curveName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.BLACK_VOLATILITY).dayCount(dayCount).parameterMetadata(parameterMetadata).build());
 }
コード例 #10
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates curve metadata for a curve providing Black volatility by expiry.
 /// <para>
 /// The x-values represent year fractions relative to an unspecified base date
 /// as defined by the specified day count.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata blackVolatilityByExpiry(string name, DayCount dayCount)
 {
     return(blackVolatilityByExpiry(CurveName.of(name), dayCount));
 }
コード例 #11
0
 /// <summary>
 /// Creates curve metadata for a curve providing monthly prices, typically used in inflation.
 /// <para>
 /// The x-values represent months relative to an unspecified base month.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata prices(CurveName name)
 {
     ArgChecker.notNull(name, "name");
     return(DefaultCurveMetadata.builder().curveName(name).xValueType(ValueType.MONTHS).yValueType(ValueType.PRICE_INDEX).build());
 }
コード例 #12
0
 /// <summary>
 /// Adds a seasonality to the curve group definition.
 /// </summary>
 /// <param name="curveName">  the name of the curve </param>
 /// <param name="seasonalityDefinition">  the seasonality associated to the curve </param>
 /// <returns> this builder </returns>
 public RatesCurveGroupDefinitionBuilder addSeasonality(CurveName curveName, SeasonalityDefinition seasonalityDefinition)
 {
     seasonalityDefinitions[curveName] = seasonalityDefinition;
     return(this);
 }
コード例 #13
0
        /// <summary>
        /// Adds a curve to the curve group definition which is used to provide discount rates and forward rates.
        /// <para>
        /// A curve added with this method cannot be calibrated by the market data system as it does not include
        /// a curve definition. It is intended to be used with curves which are supplied by the user.
        ///
        /// </para>
        /// </summary>
        /// <param name="curveName">  the name of the curve </param>
        /// <param name="currency">  the currency for which the curve provides discount rates </param>
        /// <param name="index">  the index for which the curve provides forward rates </param>
        /// <param name="otherIndices">  the additional indices for which the curve provides forward rates </param>
        /// <returns> this builder </returns>
        public RatesCurveGroupDefinitionBuilder addCurve(CurveName curveName, Currency currency, RateIndex index, params RateIndex[] otherIndices)
        {
            RatesCurveGroupEntry entry = RatesCurveGroupEntry.builder().curveName(curveName).discountCurrencies(ImmutableSet.of(currency)).indices(indices(index, otherIndices)).build();

            return(mergeEntry(entry));
        }
コード例 #14
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance, specifying the name and parameter count.
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="parameterCount">  the parameter count </param>
 /// <returns> the curve data </returns>
 public static CurveParameterSize of(CurveName name, int parameterCount)
 {
     return(new CurveParameterSize(name, parameterCount));
 }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            InterpolatedNodalCurveDefinition test = InterpolatedNodalCurveDefinition.builder().name(CURVE_NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(ACT_365F).nodes(NODES).interpolator(CurveInterpolators.LINEAR).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).build();

            coverImmutableBean(test);
            InterpolatedNodalCurveDefinition test2 = InterpolatedNodalCurveDefinition.builder().name(CurveName.of("Foo")).nodes(NODES2).interpolator(CurveInterpolators.LOG_LINEAR).extrapolatorLeft(CurveExtrapolators.LOG_LINEAR).extrapolatorRight(CurveExtrapolators.LOG_LINEAR).build();

            coverBeanEquals(test, test2);
        }
コード例 #16
0
 /// <summary>
 /// Creates curve metadata for a curve providing discount factors.
 /// <para>
 /// The x-values represent year fractions relative to an unspecified base date
 /// as defined by the specified day count.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata discountFactors(CurveName name, DayCount dayCount)
 {
     ArgChecker.notNull(name, "name");
     ArgChecker.notNull(dayCount, "dayCount");
     return(DefaultCurveMetadata.builder().curveName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.DISCOUNT_FACTOR).dayCount(dayCount).build());
 }
コード例 #17
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates curve metadata for a curve providing monthly prices, typically used in inflation.
 /// <para>
 /// The x-values represent months relative to an unspecified base month.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata prices(string name)
 {
     return(prices(CurveName.of(name)));
 }
	  //-------------------------------------------------------------------------
	  public virtual void coverage()
	  {
		InflationNodalCurveDefinition test = new InflationNodalCurveDefinition(UNDERLYING_DEF, LAST_FIX_MONTH, LAST_FIX_VALUE, SEASONALITY_DEF);
		coverImmutableBean(test);
		InterpolatedNodalCurveDefinition underlyingDef2 = InterpolatedNodalCurveDefinition.builder().name(CurveName.of("foo")).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(ACT_365F).nodes(NODES).interpolator(CurveInterpolators.LINEAR).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).build();
		SeasonalityDefinition seasonalityDef2 = SeasonalityDefinition.of(SEASONALITY_ADDITIVE, ShiftType.SCALED);
		InflationNodalCurveDefinition test2 = new InflationNodalCurveDefinition(underlyingDef2, LAST_FIX_MONTH.plus(Period.ofMonths(1)), LAST_FIX_VALUE + 1.0d, seasonalityDef2);
		coverBeanEquals(test, test2);
	  }
コード例 #19
0
 /// <summary>
 /// Creates curve metadata for a curve providing monthly prices, typically used in inflation.
 /// <para>
 /// The x-values represent months relative to an unspecified base month.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="parameterMetadata">  the parameter metadata </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata prices <T1>(CurveName name, IList <T1> parameterMetadata) where T1 : com.opengamma.strata.market.param.ParameterMetadata
 {
     ArgChecker.notNull(name, "name");
     return(DefaultCurveMetadata.builder().curveName(name).xValueType(ValueType.MONTHS).yValueType(ValueType.PRICE_INDEX).parameterMetadata(parameterMetadata).build());
 }
コード例 #20
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance.
 /// </summary>
 /// <param name="name">  the name </param>
 /// <param name="currency">  the currency </param>
 /// <param name="curveValuationDate">  the curve valuation date </param>
 /// <param name="dayCount">  the day count </param>
 /// <param name="curveNodes">  the curve nodes </param>
 /// <param name="computeJacobian">  the Jacobian flag </param>
 /// <param name="storeNodeTrade">  the node trade flag </param>
 /// <returns> the instance </returns>
 public static IsdaCreditCurveDefinition of <T1>(CurveName name, Currency currency, LocalDate curveValuationDate, DayCount dayCount, IList <T1> curveNodes, bool computeJacobian, bool storeNodeTrade) where T1 : IsdaCreditCurveNode
 {
     return(new IsdaCreditCurveDefinition(name, currency, curveValuationDate, dayCount, curveNodes, computeJacobian, storeNodeTrade));
 }
コード例 #21
0
 /// <summary>
 /// Creates curve metadata for a curve providing Black volatility by expiry.
 /// <para>
 /// The x-values represent year fractions relative to an unspecified base date
 /// as defined by the specified day count.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata blackVolatilityByExpiry(CurveName name, DayCount dayCount)
 {
     ArgChecker.notNull(name, "name");
     ArgChecker.notNull(dayCount, "dayCount");
     return(DefaultCurveMetadata.builder().curveName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.BLACK_VOLATILITY).dayCount(dayCount).build());
 }
コード例 #22
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates the metadata.
 /// <para>
 /// No information will be available for the x-values, y-values or parameters.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <returns> the metadata </returns>
 public static DefaultCurveMetadata of(string name)
 {
     return(of(CurveName.of(name)));
 }
コード例 #23
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates curve metadata for a curve providing recovery rates.
 /// <para>
 /// The x-values represent year fractions relative to an unspecified base date
 /// as defined by the specified day count.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata recoveryRates(string name, DayCount dayCount)
 {
     return(recoveryRates(CurveName.of(name), dayCount));
 }
コード例 #24
0
 /// <summary>
 /// Creates the metadata.
 /// <para>
 /// No information will be available for the x-values, y-values or parameters.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <returns> the metadata </returns>
 public static DefaultCurveMetadata of(CurveName name)
 {
     return(new DefaultCurveMetadata(name, ValueType.UNKNOWN, ValueType.UNKNOWN, ImmutableMap.of(), null));
 }
コード例 #25
0
 /// <summary>
 /// Creates curve metadata for a curve providing zero rates.
 /// <para>
 /// The x-values represent year fractions relative to an unspecified base date
 /// as defined by the specified day count.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata zeroRates(CurveName name, DayCount dayCount)
 {
     ArgChecker.notNull(name, "name");
     ArgChecker.notNull(dayCount, "dayCount");
     return(DefaultCurveMetadata.builder().curveName(name).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(dayCount).build());
 }
コード例 #26
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance used to obtain a curve by name.
 /// </summary>
 /// <param name="groupName">  the curve group name </param>
 /// <param name="curveName">  the curve name </param>
 /// <returns> the identifier </returns>
 public static CurveId of(string groupName, string curveName)
 {
     return(new CurveId(CurveGroupName.of(groupName), CurveName.of(curveName), ObservableSource.NONE));
 }
コード例 #27
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates curve metadata for a curve providing forward rates.
 /// <para>
 /// The x-values represent year fractions relative to an unspecified base date
 /// as defined by the specified day count.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata forwardRates(string name, DayCount dayCount)
 {
     return(forwardRates(CurveName.of(name), dayCount));
 }
コード例 #28
0
 /// <summary>
 /// Obtains an instance used to obtain a curve by name, specifying the source of observable market data.
 /// </summary>
 /// <param name="groupName">  the curve group name </param>
 /// <param name="curveName">  the curve name </param>
 /// <param name="obsSource">  the source of observable market data </param>
 /// <returns> the identifier </returns>
 public static CurveId of(CurveGroupName groupName, CurveName curveName, ObservableSource obsSource)
 {
     return(new CurveId(groupName, curveName, obsSource));
 }
コード例 #29
0
 /// <summary>
 /// Creates a constant curve with a specific value.
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="yValue">  the constant y-value </param>
 /// <returns> the curve </returns>
 public static ConstantCurve of(CurveName name, double yValue)
 {
     return(new ConstantCurve(DefaultCurveMetadata.of(name), yValue));
 }
コード例 #30
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Creates curve metadata for a curve providing discount factors.
 /// <para>
 /// The x-values represent year fractions relative to an unspecified base date
 /// as defined by the specified day count.
 ///
 /// </para>
 /// </summary>
 /// <param name="name">  the curve name </param>
 /// <param name="dayCount">  the day count </param>
 /// <returns> the curve metadata </returns>
 public static CurveMetadata discountFactors(string name, DayCount dayCount)
 {
     return(discountFactors(CurveName.of(name), dayCount));
 }