Exemplo n.º 1
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Adds the definition of a forward curve to the curve group definition.
        /// </summary>
        /// <param name="curveDefinition">  the definition of the forward curve </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 addForwardCurve(CurveDefinition curveDefinition, Index index, params Index[] otherIndices)
        {
            ArgChecker.notNull(curveDefinition, "curveDefinition");
            ArgChecker.notNull(index, "index");
            RatesCurveGroupEntry entry = RatesCurveGroupEntry.builder().curveName(curveDefinition.Name).indices(indices(index, otherIndices)).build();

            return(merge(entry, curveDefinition));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Adds the definition of a discount curve to the curve group definition.
        /// <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="otherCurrencies">  additional currencies for which the curve can provide discount factors </param>
        /// <param name="currency">  the currency for which the curve provides discount rates </param>
        /// <returns> this builder </returns>
        public RatesCurveGroupDefinitionBuilder addDiscountCurve(CurveName curveName, Currency currency, params Currency[] otherCurrencies)
        {
            ArgChecker.notNull(curveName, "curveName");
            ArgChecker.notNull(currency, "currency");
            RatesCurveGroupEntry entry = RatesCurveGroupEntry.builder().curveName(curveName).discountCurrencies(ImmutableSet.copyOf(Lists.asList(currency, otherCurrencies))).build();

            return(mergeEntry(entry));
        }
Exemplo n.º 3
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Merges the specified entry with this entry, returning a new entry.
 /// <para>
 /// The two entries must have the same curve name.
 ///
 /// </para>
 /// </summary>
 /// <param name="newEntry">  the new entry </param>
 /// <returns> the merged entry </returns>
 internal RatesCurveGroupEntry merge(RatesCurveGroupEntry newEntry)
 {
     if (!curveName.Equals(newEntry.curveName))
     {
         throw new System.ArgumentException(Messages.format("A CurveGroupEntry can only be merged with an entry with the same curve name. name: {}, other name: {}", curveName, newEntry.curveName));
     }
     return(RatesCurveGroupEntry.builder().curveName(curveName).discountCurrencies(Sets.union(discountCurrencies, newEntry.discountCurrencies)).indices(Sets.union(indices, newEntry.indices)).build());
 }
Exemplo n.º 4
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            RatesCurveGroupEntry test = RatesCurveGroupEntry.builder().curveName(CURVE_NAME1).discountCurrencies(GBP).build();

            coverImmutableBean(test);
            RatesCurveGroupEntry test2 = RatesCurveGroupEntry.builder().curveName(CURVE_NAME2).indices(GBP_LIBOR_1M, GBP_SONIA).build();

            coverBeanEquals(test, test2);
        }
Exemplo n.º 5
0
        //-------------------------------------------------------------------------
        /// <summary>
        /// Adds the definition of a curve to the curve group definition which is used to provide
        /// discount rates and forward rates.
        /// </summary>
        /// <param name="curveDefinition">  the definition of the forward 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(CurveDefinition curveDefinition, Currency currency, RateIndex index, params RateIndex[] otherIndices)
        {
            ArgChecker.notNull(curveDefinition, "curveDefinition");
            ArgChecker.notNull(currency, "currency");
            ArgChecker.notNull(index, "index");

            RatesCurveGroupEntry entry = RatesCurveGroupEntry.builder().curveName(curveDefinition.Name).discountCurrencies(ImmutableSet.of(currency)).indices(indices(index, otherIndices)).build();

            return(merge(entry, curveDefinition));
        }
Exemplo n.º 6
0
        public virtual void test_builder()
        {
            RatesCurveGroupEntry test = RatesCurveGroupEntry.builder().curveName(CURVE_NAME1).discountCurrencies(GBP).indices(GBP_LIBOR_1M, GBP_LIBOR_3M, GBP_SONIA).build();

            assertEquals(test.CurveName, CURVE_NAME1);
            assertEquals(test.DiscountCurrencies, ImmutableSet.of(GBP));
            assertEquals(test.Indices, ImmutableSet.of(GBP_LIBOR_1M, GBP_LIBOR_3M, GBP_SONIA));
            assertEquals(test.getIndices(typeof(IborIndex)), ImmutableSet.of(GBP_LIBOR_1M, GBP_LIBOR_3M));
            assertEquals(test.getIndices(typeof(OvernightIndex)), ImmutableSet.of(GBP_SONIA));
            assertEquals(test.getIndices(typeof(PriceIndex)), ImmutableSet.of());
        }
Exemplo n.º 7
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));
        }
Exemplo n.º 8
0
        public virtual void test_serialization()
        {
            RatesCurveGroupEntry test = RatesCurveGroupEntry.builder().curveName(CURVE_NAME1).discountCurrencies(GBP).build();

            assertSerialization(test);
        }