示例#1
0
        //-------------------------------------------------------------------------
        public virtual void test_trade()
        {
            CdsIndexIsdaCreditCurveNode node = CdsIndexIsdaCreditCurveNode.ofQuotedSpread(TEMPLATE, QUOTE_ID, INDEX_ID, LEGAL_ENTITIES, 0.01);
            double     rate                = 0.0125;
            double     quantity            = -1234.56;
            MarketData marketData          = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, rate).build();
            CdsIndexCalibrationTrade trade = node.trade(quantity, marketData, REF_DATA);
            CdsTrade      cdsTrade         = TEMPLATE.createTrade(INDEX_ID, VAL_DATE, SELL, -quantity, 0.01, REF_DATA);
            CdsIndex      cdsIndex         = CdsIndex.of(SELL, INDEX_ID, LEGAL_ENTITIES, TEMPLATE.Convention.Currency, -quantity, date(2015, 6, 20), date(2025, 6, 20), Frequency.P3M, TEMPLATE.Convention.SettlementDateOffset.Calendar, 0.01);
            CdsIndex      cdsIndexMod      = cdsIndex.toBuilder().paymentSchedule(cdsIndex.PaymentSchedule.toBuilder().rollConvention(RollConventions.DAY_20).startDateBusinessDayAdjustment(cdsIndex.PaymentSchedule.BusinessDayAdjustment).build()).build();
            CdsIndexTrade expected         = CdsIndexTrade.builder().product(cdsIndexMod).info(cdsTrade.Info).build();

            assertEquals(trade.UnderlyingTrade, expected);
            assertEquals(trade.Quote, CdsQuote.of(CdsQuoteConvention.QUOTED_SPREAD, rate));

            CdsIndexIsdaCreditCurveNode node1 = CdsIndexIsdaCreditCurveNode.ofParSpread(TEMPLATE, QUOTE_ID, INDEX_ID, LEGAL_ENTITIES);
            CdsTrade cdsTrade1 = TEMPLATE.createTrade(INDEX_ID, VAL_DATE, SELL, -quantity, rate, REF_DATA);
            CdsIndexCalibrationTrade trade1 = node1.trade(quantity, marketData, REF_DATA);
            CdsIndex      cdsIndex1         = CdsIndex.of(SELL, INDEX_ID, LEGAL_ENTITIES, TEMPLATE.Convention.Currency, -quantity, date(2015, 6, 20), date(2025, 6, 20), Frequency.P3M, TEMPLATE.Convention.SettlementDateOffset.Calendar, rate);
            CdsIndex      cdsIndexMod1      = cdsIndex1.toBuilder().paymentSchedule(cdsIndex.PaymentSchedule.toBuilder().rollConvention(RollConventions.DAY_20).startDateBusinessDayAdjustment(cdsIndex1.PaymentSchedule.BusinessDayAdjustment).build()).build();
            CdsIndexTrade expected1         = CdsIndexTrade.builder().product(cdsIndexMod1).info(cdsTrade1.Info).build();

            assertEquals(trade1.UnderlyingTrade, expected1);
            assertEquals(trade1.Quote, CdsQuote.of(CdsQuoteConvention.PAR_SPREAD, rate));
        }
示例#2
0
        //-------------------------------------------------------------------------
        public virtual void test_metadata_tenor()
        {
            CdsIndexIsdaCreditCurveNode node = CdsIndexIsdaCreditCurveNode.ofQuotedSpread(TEMPLATE, QUOTE_ID, INDEX_ID, LEGAL_ENTITIES, 0.01);
            LocalDate         nodeDate       = LocalDate.of(2015, 1, 22);
            ParameterMetadata metadata       = node.metadata(nodeDate);

            assertEquals(((TenorDateParameterMetadata)metadata).Date, nodeDate);
            assertEquals(((TenorDateParameterMetadata)metadata).Tenor, Tenor.TENOR_10Y);
        }
示例#3
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            CdsIndexIsdaCreditCurveNode test1 = CdsIndexIsdaCreditCurveNode.ofQuotedSpread(TEMPLATE, QUOTE_ID, INDEX_ID, LEGAL_ENTITIES, 0.01);

            coverImmutableBean(test1);
            CdsIndexIsdaCreditCurveNode test2 = CdsIndexIsdaCreditCurveNode.ofPointsUpfront(TenorCdsTemplate.of(TENOR_10Y, CdsConventions.EUR_GB_STANDARD), QuoteId.of(StandardId.of("OG-Ticker", "Cdx2")), StandardId.of("OG", "DEF"), ImmutableList.of(StandardId.of("OG", "DEF1"), StandardId.of("OG", "DEF2")), 0.01);

            QuoteId.of(StandardId.of("OG-Ticker", "Deposit2"));
            coverBeanEquals(test1, test2);
        }
示例#4
0
        public virtual void test_of_quotedSpread()
        {
            CdsIndexIsdaCreditCurveNode test = CdsIndexIsdaCreditCurveNode.ofQuotedSpread(TEMPLATE, QUOTE_ID, INDEX_ID, LEGAL_ENTITIES, 0.01);

            assertEquals(test.Label, LABEL_AUTO);
            assertEquals(test.CdsIndexId, INDEX_ID);
            assertEquals(test.LegalEntityIds, LEGAL_ENTITIES);
            assertEquals(test.ObservableId, QUOTE_ID);
            assertEquals(test.Template, TEMPLATE);
            assertEquals(test.date(VAL_DATE, REF_DATA), date(2025, 6, 20));
        }
示例#5
0
        public virtual void test_serialization()
        {
            CdsIndexIsdaCreditCurveNode test = CdsIndexIsdaCreditCurveNode.ofQuotedSpread(TEMPLATE, QUOTE_ID, INDEX_ID, LEGAL_ENTITIES, 0.01);

            assertSerialization(test);
        }