Пример #1
0
 /// <summary>
 /// Obtains an instance from {@code ZeroRateSensitivity} and {@code StandardId}.
 /// </summary>
 /// <param name="legalEntityId">  the legal entity identifier </param>
 /// <param name="zeroRateSensitivity">  the zero rate sensitivity </param>
 /// <returns> the point sensitivity object </returns>
 public static CreditCurveZeroRateSensitivity of(StandardId legalEntityId, ZeroRateSensitivity zeroRateSensitivity)
 {
     return(new CreditCurveZeroRateSensitivity(legalEntityId, zeroRateSensitivity));
 }
        // Create an overnight averaged vs libor 3m swap with spread
        private static Trade createOvernightAveragedWithSpreadVsLibor3mSwap()
        {
            NotionalSchedule notional = NotionalSchedule.of(Currency.USD, 100_000_000);

            SwapLeg payLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.PAY).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2020, 9, 12)).frequency(Frequency.P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(IborRateCalculation.of(IborIndices.USD_LIBOR_3M)).build();

            SwapLeg receiveLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2020, 9, 12)).frequency(Frequency.P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(OvernightRateCalculation.builder().dayCount(DayCounts.ACT_360).index(OvernightIndices.USD_FED_FUND).accrualMethod(OvernightAccrualMethod.AVERAGED).spread(ValueSchedule.of(0.0025)).build()).build();

            return(SwapTrade.builder().product(Swap.of(payLeg, receiveLeg)).info(TradeInfo.builder().id(StandardId.of("example", "3")).addAttribute(AttributeType.DESCRIPTION, "Fed Funds averaged + spread vs Libor 3m").counterparty(StandardId.of("example", "A")).settlementDate(LocalDate.of(2014, 9, 12)).build()).build());
        }
        // Create a fixed vs overnight swap with fixing
        private static Trade createFixedVsOvernightWithFixingSwap()
        {
            TradeInfo tradeInfo = TradeInfo.builder().id(StandardId.of("example", "5")).addAttribute(AttributeType.DESCRIPTION, "Fixed vs ON (with fixing)").counterparty(StandardId.of("example", "A")).settlementDate(LocalDate.of(2014, 1, 17)).build();

            return(FixedOvernightSwapConventions.USD_FIXED_TERM_FED_FUND_OIS.toTrade(tradeInfo, LocalDate.of(2014, 1, 17), LocalDate.of(2014, 3, 17), BuySell.BUY, 100_000_000, 0.00123));    // the fixed interest rate
        }
 /// <summary>
 /// Creates an instance for a legal entity which has not defaulted.
 /// </summary>
 /// <param name="legalEntityId">  the legal entity </param>
 /// <returns> the instance </returns>
 public static LegalEntityInformation isNotDefaulted(StandardId legalEntityId)
 {
     return(new LegalEntityInformation(legalEntityId, false));
 }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            FraCurveNode test = FraCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);

            coverImmutableBean(test);
            FraCurveNode test2 = FraCurveNode.of(FraTemplate.of(Period.ofMonths(1), GBP_LIBOR_6M), QuoteId.of(StandardId.of("OG-Ticker", "Deposit2")));

            coverBeanEquals(test, test2);
        }
 //-----------------------------------------------------------------------
 /// <summary>
 /// Sets the identifier of the item, optional. </summary>
 /// <param name="id">  the new value </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder id(StandardId id)
 {
     this.id_Renamed = id;
     return(this);
 }
Пример #7
0
        static CalibrationInflationUsdTest()
        {
            DSC_NAMES[DSCON_CURVE_NAME] = USD;
            ISet <Index> usdFedFundSet = new HashSet <Index>();

            usdFedFundSet.Add(USD_FED_FUND);
            IDX_NAMES[DSCON_CURVE_NAME] = usdFedFundSet;
            ISet <Index> usdLibor3Set = new HashSet <Index>();

            usdLibor3Set.Add(USD_LIBOR_3M);
            IDX_NAMES[CPI_CURVE_NAME] = usdLibor3Set;
            for (int i = 0; i < DSC_NB_DEPO_NODES; i++)
            {
                BusinessDayAdjustment bda        = BusinessDayAdjustment.of(FOLLOWING, USNY);
                TermDepositConvention convention = ImmutableTermDepositConvention.of("USD-Dep", USD, bda, ACT_360, DaysAdjustment.ofBusinessDays(DSC_DEPO_OFFSET[i], USNY));
                DSC_NODES[i] = TermDepositCurveNode.of(TermDepositTemplate.of(Period.ofDays(1), convention), QuoteId.of(StandardId.of(SCHEME, DSC_ID_VALUE[i])));
            }
            for (int i = 0; i < DSC_NB_OIS_NODES; i++)
            {
                DSC_NODES[DSC_NB_DEPO_NODES + i] = FixedOvernightSwapCurveNode.of(FixedOvernightSwapTemplate.of(Period.ZERO, Tenor.of(DSC_OIS_TENORS[i]), USD_FIXED_1Y_FED_FUND_OIS), QuoteId.of(StandardId.of(SCHEME, DSC_ID_VALUE[DSC_NB_DEPO_NODES + i])));
            }
            for (int i = 0; i < CPI_NB_NODES; i++)
            {
                CPI_NODES[i] = FixedInflationSwapCurveNode.builder().template(FixedInflationSwapTemplate.of(Tenor.of(CPI_TENORS[i]), FixedInflationSwapConventions.USD_FIXED_ZC_US_CPI)).rateId(QuoteId.of(StandardId.of(SCHEME, CPI_ID_VALUE[i]))).date(CurveNodeDate.LAST_FIXING).build();
            }
            ImmutableMarketDataBuilder builder = ImmutableMarketData.builder(VAL_DATE);

            for (int i = 0; i < DSC_NB_NODES; i++)
            {
                builder.addValue(QuoteId.of(StandardId.of(SCHEME, DSC_ID_VALUE[i])), DSC_MARKET_QUOTES[i]);
            }
            for (int i = 0; i < CPI_NB_NODES; i++)
            {
                builder.addValue(QuoteId.of(StandardId.of(SCHEME, CPI_ID_VALUE[i])), CPI_MARKET_QUOTES[i]);
            }
            builder.addTimeSeries(IndexQuoteId.of(US_CPI_U), TS_USD_CPI);
            ALL_QUOTES = builder.build();
            IList <CurveNode[]> groupDsc = new List <CurveNode[]>();

            groupDsc.Add(DSC_NODES);
            CURVES_NODES.Add(groupDsc);
            IList <CurveNode[]> groupCpi = new List <CurveNode[]>();

            groupCpi.Add(CPI_NODES);
            CURVES_NODES.Add(groupCpi);
        }
 /// <summary>
 /// Sets the CDS index identifier.
 /// <para>
 /// This identifier is used to refer this CDS index product.
 /// </para>
 /// </summary>
 /// <param name="cdsIndexId">  the new value, not null </param>
 /// <returns> this, for chaining, not null </returns>
 public Builder cdsIndexId(StandardId cdsIndexId)
 {
     JodaBeanUtils.notNull(cdsIndexId, "cdsIndexId");
     this.cdsIndexId_Renamed = cdsIndexId;
     return(this);
 }
Пример #9
0
 /// <summary>
 /// Obtains an instance used to obtain an observable value,
 /// specifying the source of observable market data.
 /// </summary>
 /// <param name="standardId">  the standard identifier of the data in the underlying data provider </param>
 /// <param name="fieldName">  the name of the field in the market data record holding the data </param>
 /// <param name="obsSource">  the source of observable market data </param>
 /// <returns> the identifier </returns>
 public static QuoteId of(StandardId standardId, FieldName fieldName, ObservableSource obsSource)
 {
     return(new QuoteId(standardId, fieldName, obsSource));
 }
 /// <summary>
 /// Returns a curve node with quoted spread convention.
 /// </summary>
 /// <param name="template">  the template </param>
 /// <param name="observableId">  the observable ID </param>
 /// <param name="cdsIndexId">  the CDS index ID </param>
 /// <param name="legalEntityIds">  the legal entity IDs </param>
 /// <param name="fixedRate">  the fixed rate </param>
 /// <returns> the curve node </returns>
 public static CdsIndexIsdaCreditCurveNode ofQuotedSpread(CdsTemplate template, ObservableId observableId, StandardId cdsIndexId, IList <StandardId> legalEntityIds, double?fixedRate)
 {
     return(builder().template(template).observableId(observableId).cdsIndexId(cdsIndexId).legalEntityIds(legalEntityIds).quoteConvention(CdsQuoteConvention.QUOTED_SPREAD).fixedRate(fixedRate).build());
 }
 private CdsIndexIsdaCreditCurveNode(CdsTemplate template, string label, ObservableId observableId, StandardId cdsIndexId, IList <StandardId> legalEntityIds, CdsQuoteConvention quoteConvention, double?fixedRate)
 {
     JodaBeanUtils.notNull(template, "template");
     JodaBeanUtils.notEmpty(label, "label");
     JodaBeanUtils.notNull(observableId, "observableId");
     JodaBeanUtils.notNull(cdsIndexId, "cdsIndexId");
     JodaBeanUtils.notNull(legalEntityIds, "legalEntityIds");
     JodaBeanUtils.notNull(quoteConvention, "quoteConvention");
     this.template        = template;
     this.label           = label;
     this.observableId    = observableId;
     this.cdsIndexId      = cdsIndexId;
     this.legalEntityIds  = ImmutableList.copyOf(legalEntityIds);
     this.quoteConvention = quoteConvention;
     this.fixedRate       = fixedRate;
     validate();
 }
 /// <summary>
 /// Returns a curve node with points upfront convention.
 /// </summary>
 /// <param name="template">  the template </param>
 /// <param name="observableId">  the observable ID </param>
 /// <param name="cdsIndexId">  the CDS index ID </param>
 /// <param name="legalEntityIds">  the legal entity IDs </param>
 /// <param name="fixedRate">  the fixed rate </param>
 /// <returns> the curve node </returns>
 public static CdsIndexIsdaCreditCurveNode ofPointsUpfront(CdsTemplate template, ObservableId observableId, StandardId cdsIndexId, IList <StandardId> legalEntityIds, double?fixedRate)
 {
     return(builder().template(template).observableId(observableId).cdsIndexId(cdsIndexId).legalEntityIds(legalEntityIds).quoteConvention(CdsQuoteConvention.POINTS_UPFRONT).fixedRate(fixedRate).build());
 }
        //-----------------------------------------------------------------------
        // create a trade
        private static Trade createTrade1(ReferenceData refData)
        {
            Swap swap = FixedIborSwapConventions.USD_FIXED_6M_LIBOR_3M.createTrade(LocalDate.of(2015, 3, 18), Tenor.TENOR_5Y, BuySell.SELL, 1, 0.02, refData).Product;

            Dsf product = Dsf.builder().securityId(SecurityId.of("OG-Future", "CME-F1U-Mar15")).lastTradeDate(LocalDate.of(2015, 3, 16)).deliveryDate(LocalDate.of(2015, 3, 18)).notional(100_000).underlyingSwap(swap).build();

            return(DsfTrade.builder().info(TradeInfo.builder().id(StandardId.of("example", "1")).addAttribute(AttributeType.DESCRIPTION, "CME-5Y-DSF Mar15").counterparty(StandardId.of("mn", "Dealer G")).tradeDate(LocalDate.of(2015, 3, 18)).settlementDate(LocalDate.of(2015, 3, 18)).build()).product(product).quantity(20).price(1.0075).build());
        }
        private static Trade createTrade1()
        {
            NotionalSchedule notional = NotionalSchedule.of(Currency.USD, 12_000_000);

            PeriodicSchedule accrual = PeriodicSchedule.builder().startDate(LocalDate.of(2006, 2, 24)).endDate(LocalDate.of(2011, 2, 24)).frequency(Frequency.P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build();

            PaymentSchedule payment = PaymentSchedule.builder().paymentFrequency(Frequency.P3M).paymentDateOffset(DaysAdjustment.ofBusinessDays(2, HolidayCalendarIds.USNY)).build();

            SwapLeg payLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.PAY).accrualSchedule(accrual).paymentSchedule(payment).notionalSchedule(notional).calculation(FixedRateCalculation.of(0.05004, DayCounts.ACT_360)).build();

            SwapLeg receiveLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.RECEIVE).accrualSchedule(accrual).paymentSchedule(payment).notionalSchedule(notional).calculation(IborRateCalculation.of(IborIndices.USD_LIBOR_3M)).build();

            return(SwapTrade.builder().product(Swap.builder().legs(payLeg, receiveLeg).build()).info(TradeInfo.builder().id(StandardId.of("mn", "14248")).counterparty(StandardId.of("mn", "Dealer A")).settlementDate(LocalDate.of(2006, 2, 24)).build()).build());
        }
 private LegalEntityInformationId(StandardId legalEntityId)
 {
     JodaBeanUtils.notNull(legalEntityId, "legalEntityId");
     this.legalEntityId = legalEntityId;
 }
Пример #16
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an instance used to obtain an observable value.
 /// <para>
 /// The field name containing the data is <seealso cref="FieldName#MARKET_VALUE"/> and the market
 /// data source is <seealso cref="ObservableSource#NONE"/>.
 ///
 /// </para>
 /// </summary>
 /// <param name="standardId">  the standard identifier of the data in the underlying data provider </param>
 /// <returns> the identifier </returns>
 public static QuoteId of(StandardId standardId)
 {
     return(new QuoteId(standardId, FieldName.MARKET_VALUE, ObservableSource.NONE));
 }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            IborFixingDepositCurveNode test = IborFixingDepositCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);

            coverImmutableBean(test);
            IborFixingDepositCurveNode test2 = IborFixingDepositCurveNode.of(IborFixingDepositTemplate.of(GBP_LIBOR_6M), QuoteId.of(StandardId.of("OG-Ticker", "Deposit2")));

            coverBeanEquals(test, test2);
        }
Пример #18
0
        private static Position trade()
        {
            PositionInfo info = PositionInfo.of(StandardId.of("OG-Position", "1"));

            return(GenericSecurityPosition.ofNet(info, SECURITY, 6));
        }
 /// <summary>
 /// Obtains an instance. </summary>
 /// <param name="id">  the value of the property </param>
 /// <param name="portfolioItemType">  the value of the property, not null </param>
 /// <param name="productType">  the value of the property, not null </param>
 /// <param name="currencies">  the value of the property, not null </param>
 /// <param name="description">  the value of the property, not blank </param>
 /// <returns> the instance </returns>
 public static PortfolioItemSummary of(StandardId id, PortfolioItemType portfolioItemType, ProductType productType, ISet <Currency> currencies, string description)
 {
     return(new PortfolioItemSummary(id, portfolioItemType, productType, currencies, description));
 }
Пример #20
0
        static CalibrationDiscountingSimpleEurStdTenorsTest()
        {
            for (int i = 0; i < DSC_NB_OIS_NODES; i++)
            {
                DSC_NODES[i] = FixedOvernightSwapCurveNode.of(FixedOvernightSwapTemplate.of(Period.ZERO, Tenor.of(DSC_OIS_TENORS[i]), EUR_FIXED_1Y_EONIA_OIS), QuoteId.of(StandardId.of(SCHEME, DSC_ID_VALUE[i])));
            }
            for (int i = 0; i < FWD3_NB_IRS_NODES; i++)
            {
                FWD3_NODES[i] = FixedIborSwapCurveNode.of(FixedIborSwapTemplate.of(Period.ZERO, Tenor.of(FWD3_IRS_TENORS[i]), EUR_FIXED_1Y_EURIBOR_3M), QuoteId.of(StandardId.of(SCHEME, FWD3_ID_VALUE[i])));
            }
            for (int i = 0; i < FWD6_NB_IRS_NODES; i++)
            {
                FWD6_NODES[i] = FixedIborSwapCurveNode.of(FixedIborSwapTemplate.of(Period.ZERO, Tenor.of(FWD6_IRS_TENORS[i]), EUR_FIXED_1Y_EURIBOR_6M), QuoteId.of(StandardId.of(SCHEME, FWD6_ID_VALUE[i])));
            }
            ImmutableMarketDataBuilder builder = ImmutableMarketData.builder(VAL_DATE);

            for (int i = 0; i < DSC_NB_NODES; i++)
            {
                builder.addValue(QuoteId.of(StandardId.of(SCHEME, DSC_ID_VALUE[i])), DSC_MARKET_QUOTES[i]);
            }
            for (int i = 0; i < FWD3_NB_NODES; i++)
            {
                builder.addValue(QuoteId.of(StandardId.of(SCHEME, FWD3_ID_VALUE[i])), FWD3_MARKET_QUOTES[i]);
            }
            for (int i = 0; i < FWD6_NB_NODES; i++)
            {
                builder.addValue(QuoteId.of(StandardId.of(SCHEME, FWD6_ID_VALUE[i])), FWD6_MARKET_QUOTES[i]);
            }
            ALL_QUOTES = builder.build();
        }
Пример #21
0
        public static RatesCurveGroupDefinition config(Period[] dscOisTenors, string[] dscIdValues, Period[] fwd3FraTenors, Period[] fwd3IrsTenors, string[] fwd3IdValues, Period[] fwd6FraTenors, Period[] fwd6IrsTenors, string[] fwd6IdValues)
        {
            CurveNode[] dscNodes = new CurveNode[dscOisTenors.Length];
            for (int i = 0; i < dscOisTenors.Length; i++)
            {
                dscNodes[i] = FixedOvernightSwapCurveNode.of(FixedOvernightSwapTemplate.of(Period.ZERO, Tenor.of(dscOisTenors[i]), EUR_FIXED_1Y_EONIA_OIS), QuoteId.of(StandardId.of(SCHEME, dscIdValues[i])));
            }
            CurveNode[] fwd3Nodes = new CurveNode[fwd3IdValues.Length];
            fwd3Nodes[0] = IborFixingDepositCurveNode.of(IborFixingDepositTemplate.of(EUR_EURIBOR_3M), QuoteId.of(StandardId.of(SCHEME, fwd3IdValues[0])));
            for (int i = 0; i < fwd3FraTenors.Length; i++)
            {
                fwd3Nodes[i + 1] = FraCurveNode.of(FraTemplate.of(fwd3FraTenors[i], EUR_EURIBOR_3M), QuoteId.of(StandardId.of(SCHEME, fwd3IdValues[i + 1])));
            }
            for (int i = 0; i < fwd3IrsTenors.Length; i++)
            {
                fwd3Nodes[i + 1 + fwd3FraTenors.Length] = FixedIborSwapCurveNode.of(FixedIborSwapTemplate.of(Period.ZERO, Tenor.of(fwd3IrsTenors[i]), EUR_FIXED_1Y_EURIBOR_3M), QuoteId.of(StandardId.of(SCHEME, fwd3IdValues[i + 1 + fwd3FraTenors.Length])));
            }
            CurveNode[] fwd6Nodes = new CurveNode[fwd6IdValues.Length];
            fwd6Nodes[0] = IborFixingDepositCurveNode.of(IborFixingDepositTemplate.of(EUR_EURIBOR_6M), QuoteId.of(StandardId.of(SCHEME, fwd6IdValues[0])));
            for (int i = 0; i < fwd6FraTenors.Length; i++)
            {
                fwd6Nodes[i + 1] = FraCurveNode.of(FraTemplate.of(fwd6FraTenors[i], EUR_EURIBOR_6M), QuoteId.of(StandardId.of(SCHEME, fwd6IdValues[i + 1])));
            }
            for (int i = 0; i < fwd6IrsTenors.Length; i++)
            {
                fwd6Nodes[i + 1 + fwd6FraTenors.Length] = FixedIborSwapCurveNode.of(FixedIborSwapTemplate.of(Period.ZERO, Tenor.of(fwd6IrsTenors[i]), EUR_FIXED_1Y_EURIBOR_6M), QuoteId.of(StandardId.of(SCHEME, fwd6IdValues[i + 1 + fwd6FraTenors.Length])));
            }
            InterpolatedNodalCurveDefinition DSC_CURVE_DEFN  = InterpolatedNodalCurveDefinition.builder().name(DSCON_CURVE_NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(CURVE_DC).interpolator(INTERPOLATOR_LINEAR).extrapolatorLeft(EXTRAPOLATOR_FLAT).extrapolatorRight(EXTRAPOLATOR_FLAT).nodes(dscNodes).build();
            InterpolatedNodalCurveDefinition FWD3_CURVE_DEFN = InterpolatedNodalCurveDefinition.builder().name(FWD3_CURVE_NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(CURVE_DC).interpolator(INTERPOLATOR_LINEAR).extrapolatorLeft(EXTRAPOLATOR_FLAT).extrapolatorRight(EXTRAPOLATOR_FLAT).nodes(fwd3Nodes).build();
            InterpolatedNodalCurveDefinition FWD6_CURVE_DEFN = InterpolatedNodalCurveDefinition.builder().name(FWD6_CURVE_NAME).xValueType(ValueType.YEAR_FRACTION).yValueType(ValueType.ZERO_RATE).dayCount(CURVE_DC).interpolator(INTERPOLATOR_LINEAR).extrapolatorLeft(EXTRAPOLATOR_FLAT).extrapolatorRight(EXTRAPOLATOR_FLAT).nodes(fwd6Nodes).build();

            return(RatesCurveGroupDefinition.builder().name(CURVE_GROUP_NAME).addCurve(DSC_CURVE_DEFN, EUR, EUR_EONIA).addForwardCurve(FWD3_CURVE_DEFN, EUR_EURIBOR_3M).addForwardCurve(FWD6_CURVE_DEFN, EUR_EURIBOR_6M).build());
        }
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            coverImmutableBean(PRODUCT);
            CdsIndex other = CdsIndex.builder().buySell(SELL).cdsIndexId(StandardId.of("OG", "AA-INDEX")).legalEntityIds(ImmutableList.of(StandardId.of("OG", "ABC1"), StandardId.of("OG", "ABC2"))).currency(JPY).notional(1d).paymentSchedule(PeriodicSchedule.of(LocalDate.of(2014, 1, 4), LocalDate.of(2020, 11, 20), P6M, BusinessDayAdjustment.of(BusinessDayConventions.FOLLOWING, JPTO), StubConvention.SHORT_FINAL, RollConventions.NONE)).fixedRate(0.01).dayCount(ACT_365F).paymentOnDefault(PaymentOnDefault.NONE).protectionStart(ProtectionStartOfDay.NONE).settlementDateOffset(DaysAdjustment.NONE).stepinDateOffset(DaysAdjustment.NONE).build();

            coverBeanEquals(PRODUCT, other);
        }
Пример #23
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            FixedOvernightSwapCurveNode test = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);

            coverImmutableBean(test);
            FixedOvernightSwapCurveNode test2 = FixedOvernightSwapCurveNode.of(FixedOvernightSwapTemplate.of(TENOR_6M, FixedOvernightSwapConventions.USD_FIXED_TERM_FED_FUND_OIS), QuoteId.of(StandardId.of("OG-Ticker", "Deposit2")));

            coverBeanEquals(test, test2);
        }
Пример #24
0
        /// <summary>
        /// Test that the curve node requirements are extracted and returned.
        /// </summary>
        public virtual void requirements()
        {
            FraCurveNode node1x4 = fraNode(1, "a");
            FraCurveNode node2x5 = fraNode(2, "b");
            FraCurveNode node3x6 = fraNode(3, "c");

            InterpolatedNodalCurveDefinition curve = InterpolatedNodalCurveDefinition.builder().name(CurveName.of("curve")).interpolator(CurveInterpolators.DOUBLE_QUADRATIC).extrapolatorLeft(CurveExtrapolators.FLAT).extrapolatorRight(CurveExtrapolators.FLAT).nodes(node1x4, node2x5, node3x6).build();

            RatesCurveGroupDefinition groupDefn = RatesCurveGroupDefinition.builder().name(CurveGroupName.of("curve group")).addDiscountCurve(curve, Currency.USD).build();

            MarketDataConfig marketDataConfig = MarketDataConfig.builder().add(groupDefn.Name, groupDefn).build();

            RatesCurveInputsMarketDataFunction marketDataFunction = new RatesCurveInputsMarketDataFunction();
            RatesCurveInputsId     curveInputsId = RatesCurveInputsId.of(groupDefn.Name, curve.Name, ObservableSource.NONE);
            MarketDataRequirements requirements  = marketDataFunction.requirements(curveInputsId, marketDataConfig);

            assertThat(requirements.Observables).contains(QuoteId.of(StandardId.of("test", "a"))).contains(QuoteId.of(StandardId.of("test", "b"))).contains(QuoteId.of(StandardId.of("test", "c")));
        }
        // create a libor 3m vs libor 6m basis swap with spread
        private static Trade createBasisLibor3mVsLibor6mWithSpreadSwap()
        {
            NotionalSchedule notional = NotionalSchedule.of(Currency.USD, 100_000_000);

            SwapLeg payLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.PAY).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 8, 27)).endDate(LocalDate.of(2024, 8, 27)).frequency(Frequency.P6M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P6M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(IborRateCalculation.of(IborIndices.USD_LIBOR_6M)).build();

            SwapLeg receiveLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 8, 27)).endDate(LocalDate.of(2024, 8, 27)).frequency(Frequency.P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(IborRateCalculation.builder().index(IborIndices.USD_LIBOR_3M).spread(ValueSchedule.of(0.001)).build()).build();

            return(SwapTrade.builder().product(Swap.of(payLeg, receiveLeg)).info(TradeInfo.builder().id(StandardId.of("example", "2")).addAttribute(AttributeType.DESCRIPTION, "Libor 3m + spread vs Libor 6m").counterparty(StandardId.of("example", "A")).settlementDate(LocalDate.of(2014, 9, 12)).build()).build());
        }
 //-------------------------------------------------------------------------
 /// <summary>
 /// Obtains an identifier used to find legal entity information.
 /// </summary>
 /// <param name="legalEntityId">  the name </param>
 /// <returns> an identifier </returns>
 public static LegalEntityInformationId of(string legalEntityId)
 {
     return(new LegalEntityInformationId(StandardId.parse(legalEntityId)));
 }
        // Create a vanilla fixed vs libor 3m swap with fixing
        private static Trade createFixedVsLibor3mWithFixingSwap()
        {
            TradeInfo tradeInfo = TradeInfo.builder().id(StandardId.of("example", "4")).addAttribute(AttributeType.DESCRIPTION, "Fixed vs libor 3m (with fixing)").counterparty(StandardId.of("example", "A")).settlementDate(LocalDate.of(2013, 9, 12)).build();

            return(FixedIborSwapConventions.USD_FIXED_6M_LIBOR_3M.toTrade(tradeInfo, LocalDate.of(2013, 9, 12), LocalDate.of(2020, 9, 12), BuySell.BUY, 100_000_000, 0.015));    // the fixed interest rate
        }
 /// <summary>
 /// Obtains an identifier used to find legal entity information.
 /// </summary>
 /// <param name="legalEntityId">  the name </param>
 /// <returns> the identifier </returns>
 public static LegalEntityInformationId of(StandardId legalEntityId)
 {
     return(new LegalEntityInformationId(legalEntityId));
 }
        // Create a fixed vs libor 3m swap
        private static Trade createStub1mFixedVsLibor3mSwap()
        {
            NotionalSchedule notional = NotionalSchedule.of(Currency.USD, 100_000_000);

            SwapLeg payLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.PAY).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2016, 7, 12)).frequency(Frequency.P3M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).stubConvention(StubConvention.SHORT_INITIAL).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P3M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(IborRateCalculation.of(IborIndices.USD_LIBOR_3M)).build();

            SwapLeg receiveLeg = RateCalculationSwapLeg.builder().payReceive(PayReceive.RECEIVE).accrualSchedule(PeriodicSchedule.builder().startDate(LocalDate.of(2014, 9, 12)).endDate(LocalDate.of(2016, 7, 12)).stubConvention(StubConvention.SHORT_INITIAL).frequency(Frequency.P6M).businessDayAdjustment(BusinessDayAdjustment.of(MODIFIED_FOLLOWING, HolidayCalendarIds.USNY)).build()).paymentSchedule(PaymentSchedule.builder().paymentFrequency(Frequency.P6M).paymentDateOffset(DaysAdjustment.NONE).build()).notionalSchedule(notional).calculation(FixedRateCalculation.of(0.01, DayCounts.THIRTY_U_360)).build();

            return(SwapTrade.builder().product(Swap.of(payLeg, receiveLeg)).info(TradeInfo.builder().id(StandardId.of("example", "7")).addAttribute(AttributeType.DESCRIPTION, "Fixed vs Libor 3m (1m short initial stub)").counterparty(StandardId.of("example", "A")).settlementDate(LocalDate.of(2014, 9, 12)).build()).build());
        }
Пример #30
0
        /// <summary>
        /// Obtains an instance with sensitivity currency specified.
        /// </summary>
        /// <param name="legalEntityId">  the legal entity identifier </param>
        /// <param name="curveCurrency">  the currency of the curve </param>
        /// <param name="yearFraction">  the year fraction that was looked up on the curve </param>
        /// <param name="sensitivityCurrency">  the currency of the sensitivity </param>
        /// <param name="sensitivity">  the value of the sensitivity </param>
        /// <returns> the point sensitivity object </returns>
        public static CreditCurveZeroRateSensitivity of(StandardId legalEntityId, Currency curveCurrency, double yearFraction, Currency sensitivityCurrency, double sensitivity)
        {
            ZeroRateSensitivity zeroRateSensitivity = ZeroRateSensitivity.of(curveCurrency, yearFraction, sensitivityCurrency, sensitivity);

            return(new CreditCurveZeroRateSensitivity(legalEntityId, zeroRateSensitivity));
        }