예제 #1
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));
        }
예제 #2
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));
        }
예제 #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());
 }
예제 #4
0
        // merges the specified entry with those already stored
        private RatesCurveGroupDefinitionBuilder mergeEntry(RatesCurveGroupEntry newEntry)
        {
            CurveName            curveName     = newEntry.CurveName;
            RatesCurveGroupEntry existingEntry = entries[curveName];
            RatesCurveGroupEntry entry         = existingEntry == null ? newEntry : existingEntry.merge(newEntry);

            entries[curveName] = entry;
            return(this);
        }
예제 #5
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);
        }
예제 #6
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));
        }
예제 #7
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());
        }
예제 #8
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         RatesCurveGroupEntry other = (RatesCurveGroupEntry)obj;
         return(JodaBeanUtils.equal(curveName, other.curveName) && JodaBeanUtils.equal(discountCurrencies, other.discountCurrencies) && JodaBeanUtils.equal(indices, other.indices));
     }
     return(false);
 }
예제 #9
0
 //-------------------------------------------------------------------------
 // merges the definition and entry
 private RatesCurveGroupDefinitionBuilder merge(RatesCurveGroupEntry newEntry, CurveDefinition curveDefinition)
 {
     curveDefinitions[curveDefinition.Name] = curveDefinition;
     return(mergeEntry(newEntry));
 }
예제 #10
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));
        }
예제 #11
0
        public virtual void test_serialization()
        {
            RatesCurveGroupEntry test = RatesCurveGroupEntry.builder().curveName(CURVE_NAME1).discountCurrencies(GBP).build();

            assertSerialization(test);
        }