Esempio n. 1
0
        //-------------------------------------------------------------------------
        public virtual void test_of_single()
        {
            IborFutureOptionMarketDataLookup test = IborFutureOptionMarketDataLookup.of(USD_LIBOR_3M, VOL_ID1);

            assertEquals(test.queryType(), typeof(IborFutureOptionMarketDataLookup));
            assertEquals(test.VolatilityIndices, ImmutableSet.of(USD_LIBOR_3M));
            assertEquals(test.getVolatilityIds(USD_LIBOR_3M), ImmutableSet.of(VOL_ID1));
            assertThrowsIllegalArg(() => test.getVolatilityIds(GBP_LIBOR_3M));

            assertEquals(test.requirements(USD_LIBOR_3M), FunctionRequirements.builder().valueRequirements(VOL_ID1).build());
            assertEquals(test.requirements(ImmutableSet.of(USD_LIBOR_3M)), FunctionRequirements.builder().valueRequirements(VOL_ID1).build());
            assertThrowsIllegalArg(() => test.requirements(ImmutableSet.of(GBP_LIBOR_3M)));
        }
Esempio n. 2
0
        //-------------------------------------------------------------------------
        public virtual void test_marketDataView()
        {
            IborFutureOptionMarketDataLookup test = IborFutureOptionMarketDataLookup.of(USD_LIBOR_3M, VOL_ID1);
            LocalDate          valDate            = date(2015, 6, 30);
            ScenarioMarketData md = new TestMarketDataMap(valDate, ImmutableMap.of(), ImmutableMap.of());
            IborFutureOptionScenarioMarketData multiScenario = test.marketDataView(md);

            assertEquals(multiScenario.Lookup, test);
            assertEquals(multiScenario.MarketData, md);
            assertEquals(multiScenario.ScenarioCount, 1);
            IborFutureOptionMarketData scenario = multiScenario.scenario(0);

            assertEquals(scenario.Lookup, test);
            assertEquals(scenario.MarketData, md.scenario(0));
            assertEquals(scenario.ValuationDate, valDate);
        }
Esempio n. 3
0
        public virtual void test_of_map()
        {
            ImmutableMap <IborIndex, IborFutureOptionVolatilitiesId> ids = ImmutableMap.of(USD_LIBOR_3M, VOL_ID1, USD_LIBOR_6M, VOL_ID1);
            IborFutureOptionMarketDataLookup test = IborFutureOptionMarketDataLookup.of(ids);

            assertEquals(test.queryType(), typeof(IborFutureOptionMarketDataLookup));
            assertEquals(test.VolatilityIndices, ImmutableSet.of(USD_LIBOR_3M, USD_LIBOR_6M));
            assertEquals(test.getVolatilityIds(USD_LIBOR_3M), ImmutableSet.of(VOL_ID1));
            assertThrowsIllegalArg(() => test.getVolatilityIds(GBP_LIBOR_3M));

            assertEquals(test.requirements(USD_LIBOR_3M), FunctionRequirements.builder().valueRequirements(VOL_ID1).build());
            assertEquals(test.requirements(ImmutableSet.of(USD_LIBOR_3M)), FunctionRequirements.builder().valueRequirements(VOL_ID1).build());
            assertThrowsIllegalArg(() => test.requirements(ImmutableSet.of(GBP_LIBOR_3M)));

            assertEquals(test.volatilities(USD_LIBOR_3M, MOCK_MARKET_DATA), MOCK_VOLS);
            assertThrowsIllegalArg(() => test.volatilities(GBP_LIBOR_3M, MOCK_MARKET_DATA));
        }