@Override
 public DatedCurveParameterMetadata metadata(LocalDate valuationDate) {
   Tenor endTenor = Tenor.of(template.getDepositPeriod());
   ExpandedIborFixingDeposit deposit =
       template.toTrade(valuationDate, BuySell.BUY, 0d, 0d).getProduct().expand();
   return TenorCurveNodeMetadata.of(deposit.getEndDate(), endTenor);
 }
Exemplo n.º 2
0
 public static CurveGroupDefinition 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),
             QuoteKey.of(StandardId.of(SCHEME, dscIdValues[i])));
   }
   CurveNode[] fwd3Nodes = new CurveNode[fwd3IdValues.length];
   fwd3Nodes[0] =
       IborFixingDepositCurveNode.of(
           IborFixingDepositTemplate.of(EUR_EURIBOR_3M),
           QuoteKey.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),
             QuoteKey.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),
             QuoteKey.of(StandardId.of(SCHEME, fwd3IdValues[i + 1])));
   }
   CurveNode[] fwd6Nodes = new CurveNode[fwd6IdValues.length];
   fwd6Nodes[0] =
       IborFixingDepositCurveNode.of(
           IborFixingDepositTemplate.of(EUR_EURIBOR_6M),
           QuoteKey.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),
             QuoteKey.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),
             QuoteKey.of(StandardId.of(SCHEME, fwd6IdValues[i + 1])));
   }
   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 CurveGroupDefinition.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();
 }
 @Override
 public IborFixingDepositTrade trade(LocalDate valuationDate, ObservableValues marketData) {
   double fixedRate = marketData.getValue(rateKey) + spread;
   return template.toTrade(valuationDate, BuySell.BUY, 1d, fixedRate);
 }