示例#1
0
        // create a list of SimpleCurveParameterMetadata
        private static IList <ParameterMetadata> createParameterMetadata(DoubleArray time)
        {
            int n = time.size();
            IList <ParameterMetadata> list = new List <ParameterMetadata>();

            for (int i = 0; i < n; ++i)
            {
                list.Add(SimpleCurveParameterMetadata.of(ValueType.YEAR_FRACTION, time.get(i)));
            }
            return(list);
        }
示例#2
0
        public virtual void test_of_constant_interface()
        {
            IsdaCreditDiscountFactors test = (IsdaCreditDiscountFactors)CreditDiscountFactors.of(USD, VALUATION, CONST_CURVE);

            assertEquals(test.Currency, USD);
            assertEquals(test.Curve, CONST_CURVE);
            assertEquals(test.DayCount, ACT_365L);
            assertEquals(test.ParameterCount, 1);
            assertEquals(test.getParameter(0), RATE_SINGLE);
            assertEquals(test.ParameterKeys, DoubleArray.of(TIME_SINGLE));
            assertEquals(test.getParameterMetadata(0), SimpleCurveParameterMetadata.of(METADATA.XValueType, TIME_SINGLE));
            assertEquals(test.ValuationDate, VALUATION);
            assertEquals(test.findData(CONST_CURVE.Name), CONST_CURVE);
            assertEquals(test.findData(CurveName.of("Rubbish")), null);
            assertEquals(test.toDiscountFactors(), ZeroRateDiscountFactors.of(USD, VALUATION, CONST_CURVE));
            assertEquals(test.IsdaCompliant, true);
        }
示例#3
0
        public virtual void test_of()
        {
            IsdaCreditDiscountFactors test = IsdaCreditDiscountFactors.of(USD, VALUATION, CURVE);

            assertEquals(test.Currency, USD);
            assertEquals(test.Curve, CURVE);
            assertEquals(test.DayCount, ACT_365F);
            assertEquals(test.ParameterCount, RATE.size());
            assertEquals(test.getParameter(3), RATE.get(3));
            assertEquals(test.getParameter(1), RATE.get(1));
            assertEquals(test.ParameterKeys, TIME);
            assertEquals(test.getParameterMetadata(4), SimpleCurveParameterMetadata.of(METADATA.XValueType, TIME.get(4)));
            assertEquals(test.getParameterMetadata(6), SimpleCurveParameterMetadata.of(METADATA.XValueType, TIME.get(6)));
            assertEquals(test.ValuationDate, VALUATION);
            assertEquals(test.findData(CURVE.Name), CURVE);
            assertEquals(test.findData(CurveName.of("Rubbish")), null);
            assertEquals(test.toDiscountFactors(), ZeroRateDiscountFactors.of(USD, VALUATION, CURVE));
            assertEquals(test.IsdaCompliant, true);
        }