private static void populateVolatilitySurfaceDefinitions( final ConfigMaster configMaster, final Currency target, final String name) { final Tenor[] swaptionExpiries = new Tenor[] { Tenor.THREE_MONTHS, Tenor.SIX_MONTHS, Tenor.ONE_YEAR, Tenor.TWO_YEARS, Tenor.THREE_YEARS, Tenor.FIVE_YEARS, Tenor.TEN_YEARS }; final Tenor[] swapMaturities = new Tenor[] { Tenor.ONE_YEAR, Tenor.TWO_YEARS, Tenor.THREE_YEARS, Tenor.FIVE_YEARS, Tenor.SEVEN_YEARS, Tenor.TEN_YEARS, Tenor.ofYears(12), Tenor.ofYears(15), Tenor.ofYears(20), Tenor.ofYears(30) }; final String fullName = name + SEPARATOR + target.toString() + SEPARATOR + InstrumentTypeProperties.SWAPTION_ATM; final VolatilitySurfaceDefinition<Tenor, Tenor> definition = new VolatilitySurfaceDefinition<>(fullName, target, swapMaturities, swaptionExpiries); ConfigMasterUtils.storeByName(configMaster, makeConfigDocument(definition)); }
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))); }