Exemple #1
0
 private static void populateVolatilitySurfaceDefinitions(
     final ConfigMaster configMaster, final UniqueIdentifiable target) {
   final Tenor[] expiryTenors =
       new Tenor[] {
         Tenor.ofDays(7),
         Tenor.ofDays(14),
         Tenor.ofDays(21),
         Tenor.ofMonths(1),
         Tenor.ofMonths(3),
         Tenor.ofMonths(6),
         Tenor.ofMonths(9),
         Tenor.ofYears(1),
         Tenor.ofYears(5),
         Tenor.ofYears(10)
       };
   @SuppressWarnings("unchecked")
   final Pair<Number, FXVolQuoteType>[] deltaAndTypes =
       new Pair[] {
         Pair.of(25, FXVolQuoteType.BUTTERFLY),
         Pair.of(25, FXVolQuoteType.RISK_REVERSAL),
         Pair.of(15, FXVolQuoteType.BUTTERFLY),
         Pair.of(15, FXVolQuoteType.RISK_REVERSAL),
         Pair.of(0, FXVolQuoteType.ATM)
       };
   final VolatilitySurfaceDefinition<Tenor, Pair<Number, FXVolQuoteType>> volSurfaceDefinition =
       new VolatilitySurfaceDefinition<Tenor, Pair<Number, FXVolQuoteType>>(
           "SECONDARY_EURUSD_" + InstrumentTypeProperties.FOREX,
           target,
           expiryTenors,
           deltaAndTypes);
   ConfigMasterUtils.storeByName(configMaster, makeConfigDocument(volSurfaceDefinition));
 }
 @Test
 public void testFXOptionVolatilitySurfaceInstrumentProvider() {
   final ICAPFXOptionVolatilitySurfaceInstrumentProvider provider =
       new ICAPFXOptionVolatilitySurfaceInstrumentProvider("I", "EURUSD", "Market_Value");
   assertEquals(
       provider, cycleObject(ICAPFXOptionVolatilitySurfaceInstrumentProvider.class, provider));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSD_1WK"),
       provider.getInstrument(Tenor.ofDays(7), Pairs.of((Number) 0, FXVolQuoteType.ATM)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSD_1M"),
       provider.getInstrument(Tenor.ofMonths(1), Pairs.of((Number) 0, FXVolQuoteType.ATM)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSD_1YR"),
       provider.getInstrument(Tenor.ofYears(1), Pairs.of((Number) 0, FXVolQuoteType.ATM)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSD_1WK"),
       provider.getInstrument(Tenor.ofDays(7), Pairs.of((Number) 0, FXVolQuoteType.ATM)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSD_1M"),
       provider.getInstrument(Tenor.ofMonths(1), Pairs.of((Number) 0, FXVolQuoteType.ATM)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSD_1YR"),
       provider.getInstrument(Tenor.ofYears(1), Pairs.of((Number) 0, FXVolQuoteType.ATM)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDBF25_1WK"),
       provider.getInstrument(Tenor.ofDays(7), Pairs.of((Number) 25, FXVolQuoteType.BUTTERFLY)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDBF25_1M"),
       provider.getInstrument(Tenor.ofMonths(1), Pairs.of((Number) 25, FXVolQuoteType.BUTTERFLY)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDBF25_1YR"),
       provider.getInstrument(Tenor.ofYears(1), Pairs.of((Number) 25, FXVolQuoteType.BUTTERFLY)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDBF10_1WK"),
       provider.getInstrument(Tenor.ofDays(7), Pairs.of((Number) 10, FXVolQuoteType.BUTTERFLY)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDBF10_1M"),
       provider.getInstrument(Tenor.ofMonths(1), Pairs.of((Number) 10, FXVolQuoteType.BUTTERFLY)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDBF10_1YR"),
       provider.getInstrument(Tenor.ofYears(1), Pairs.of((Number) 10, FXVolQuoteType.BUTTERFLY)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDRR25_1WK"),
       provider.getInstrument(
           Tenor.ofDays(7), Pairs.of((Number) 25, FXVolQuoteType.RISK_REVERSAL)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDRR25_1M"),
       provider.getInstrument(
           Tenor.ofMonths(1), Pairs.of((Number) 25, FXVolQuoteType.RISK_REVERSAL)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDRR25_1YR"),
       provider.getInstrument(
           Tenor.ofYears(1), Pairs.of((Number) 25, FXVolQuoteType.RISK_REVERSAL)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDRR10_1WK"),
       provider.getInstrument(
           Tenor.ofDays(7), Pairs.of((Number) 10, FXVolQuoteType.RISK_REVERSAL)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDRR10_1M"),
       provider.getInstrument(
           Tenor.ofMonths(1), Pairs.of((Number) 10, FXVolQuoteType.RISK_REVERSAL)));
   assertEquals(
       ExternalId.of(ExternalSchemes.ICAP, "IEURUSDRR10_1YR"),
       provider.getInstrument(
           Tenor.ofYears(1), Pairs.of((Number) 10, FXVolQuoteType.RISK_REVERSAL)));
 }