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_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));
        }
Esempio n. 3
0
        //-------------------------------------------------------------------------
        public virtual FunctionRequirements requirements(T target, ISet <Measure> measures, CalculationParameters parameters, ReferenceData refData)
        {
            // extract data from product
            IborFutureOption option        = target.Product;
            QuoteId          optionQuoteId = QuoteId.of(option.SecurityId.StandardId, FieldName.SETTLEMENT_PRICE);
            Currency         currency      = option.Currency;
            IborIndex        index         = option.Index;

            // use lookup to build requirements
            RatesMarketDataLookup            ratesLookup  = parameters.getParameter(typeof(RatesMarketDataLookup));
            FunctionRequirements             ratesReqs    = ratesLookup.requirements(currency, index);
            IborFutureOptionMarketDataLookup optionLookup = parameters.getParameter(typeof(IborFutureOptionMarketDataLookup));
            FunctionRequirements             optionReqs   = optionLookup.requirements(index);
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: com.google.common.collect.ImmutableSet<com.opengamma.strata.data.MarketDataId<?>> valueReqs = com.google.common.collect.ImmutableSet.builder<com.opengamma.strata.data.MarketDataId<?>>().add(optionQuoteId).addAll(ratesReqs.getValueRequirements()).addAll(optionReqs.getValueRequirements()).build();
            ImmutableSet <MarketDataId <object> > valueReqs = ImmutableSet.builder <MarketDataId <object> >().add(optionQuoteId).addAll(ratesReqs.ValueRequirements).addAll(optionReqs.ValueRequirements).build();

            return(ratesReqs.toBuilder().valueRequirements(valueReqs).build());
        }