//-------------------------------------------------------------------------
        public virtual void test_of_map()
        {
            ImmutableMap <SecurityId, RepoGroup>               repoSecurityGroups = ImmutableMap.of(SEC_A1, GROUP_REPO_X);
            ImmutableMap <LegalEntityId, RepoGroup>            repoGroups         = ImmutableMap.of(ISSUER_A, GROUP_REPO_Y, ISSUER_B, GROUP_REPO_Y, ISSUER_C, GROUP_REPO_Y, ISSUER_D, GROUP_REPO_Y);
            ImmutableMap <Pair <RepoGroup, Currency>, CurveId> repoCurves         = ImmutableMap.of(Pair.of(GROUP_REPO_X, USD), CURVE_ID_USD1, Pair.of(GROUP_REPO_Y, USD), CURVE_ID_USD2, Pair.of(GROUP_REPO_Y, GBP), CURVE_ID_GBP1);

            ImmutableMap <LegalEntityId, LegalEntityGroup>            issuerGroups = ImmutableMap.of(ISSUER_A, GROUP_ISSUER_M, ISSUER_B, GROUP_ISSUER_N, ISSUER_C, GROUP_ISSUER_M);
            ImmutableMap <Pair <LegalEntityGroup, Currency>, CurveId> issuerCurves = ImmutableMap.of(Pair.of(GROUP_ISSUER_M, USD), CURVE_ID_USD3, Pair.of(GROUP_ISSUER_N, USD), CURVE_ID_USD4, Pair.of(GROUP_ISSUER_N, GBP), CURVE_ID_GBP2);

            LegalEntityDiscountingMarketDataLookup test = LegalEntityDiscountingMarketDataLookup.of(repoSecurityGroups, repoGroups, repoCurves, issuerGroups, issuerCurves);

            assertEquals(test.queryType(), typeof(LegalEntityDiscountingMarketDataLookup));

            assertEquals(test.requirements(SEC_A1, ISSUER_A, USD), FunctionRequirements.builder().valueRequirements(CURVE_ID_USD1, CURVE_ID_USD3).outputCurrencies(USD).build());
            assertEquals(test.requirements(SEC_A2, ISSUER_A, USD), FunctionRequirements.builder().valueRequirements(CURVE_ID_USD2, CURVE_ID_USD3).outputCurrencies(USD).build());
            assertEquals(test.requirements(SEC_B1, ISSUER_B, USD), FunctionRequirements.builder().valueRequirements(CURVE_ID_USD2, CURVE_ID_USD4).outputCurrencies(USD).build());
            assertEquals(test.requirements(SEC_B1, ISSUER_B, GBP), FunctionRequirements.builder().valueRequirements(CURVE_ID_GBP1, CURVE_ID_GBP2).outputCurrencies(GBP).build());
            assertThrowsIllegalArg(() => test.requirements(SEC_B1, LegalEntityId.of("XXX", "XXX"), GBP));
            assertThrowsIllegalArg(() => test.requirements(SecurityId.of("XXX", "XXX"), LegalEntityId.of("XXX", "XXX"), GBP));
            assertThrowsIllegalArg(() => test.requirements(SEC_A1, ISSUER_A, GBP));
            assertThrowsIllegalArg(() => test.requirements(SEC_C1, ISSUER_C, GBP));
            assertThrowsIllegalArg(() => test.requirements(SEC_D1, ISSUER_D, GBP));

            assertEquals(test.discountingProvider(MOCK_MARKET_DATA), DefaultLookupLegalEntityDiscountingProvider.of((DefaultLegalEntityDiscountingMarketDataLookup)test, MOCK_MARKET_DATA));
        }
コード例 #2
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)));
        }
コード例 #3
0
        //-------------------------------------------------------------------------
        public virtual void test_of_single()
        {
            FxOptionMarketDataLookup test = FxOptionMarketDataLookup.of(EUR_USD, VOL_ID1);

            assertEquals(test.queryType(), typeof(FxOptionMarketDataLookup));
            assertEquals(test.VolatilityCurrencyPairs, ImmutableSet.of(EUR_USD));
            assertEquals(test.getVolatilityIds(EUR_USD), ImmutableSet.of(VOL_ID1));
            assertThrowsIllegalArg(() => test.getVolatilityIds(GBP_USD));

            assertEquals(test.requirements(EUR_USD), FunctionRequirements.builder().valueRequirements(VOL_ID1).build());
            assertEquals(test.requirements(ImmutableSet.of(EUR_USD)), FunctionRequirements.builder().valueRequirements(VOL_ID1).build());
            assertThrowsIllegalArg(() => test.requirements(ImmutableSet.of(EUR_GBP)));
        }
        //-------------------------------------------------------------------------
        public virtual void test_of_single()
        {
            BondFutureOptionMarketDataLookup test = BondFutureOptionMarketDataLookup.of(SEC_OG1, VOL_ID1);

            assertEquals(test.queryType(), typeof(BondFutureOptionMarketDataLookup));
            assertEquals(test.VolatilitySecurityIds, ImmutableSet.of(SEC_OG1));
            assertEquals(test.getVolatilityIds(SEC_OG1), ImmutableSet.of(VOL_ID1));
            assertThrowsIllegalArg(() => test.getVolatilityIds(SEC_OG2));

            assertEquals(test.requirements(SEC_OG1), FunctionRequirements.builder().valueRequirements(VOL_ID1).build());
            assertEquals(test.requirements(ImmutableSet.of(SEC_OG1)), FunctionRequirements.builder().valueRequirements(VOL_ID1).build());
            assertThrowsIllegalArg(() => test.requirements(ImmutableSet.of(SEC_OG3)));
        }
コード例 #5
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));
        }
コード例 #6
0
        public virtual void test_of_map()
        {
            ImmutableMap <CurrencyPair, FxOptionVolatilitiesId> ids = ImmutableMap.of(EUR_USD, VOL_ID1, GBP_USD, VOL_ID1);
            FxOptionMarketDataLookup test = FxOptionMarketDataLookup.of(ids);

            assertEquals(test.queryType(), typeof(FxOptionMarketDataLookup));
            assertEquals(test.VolatilityCurrencyPairs, ImmutableSet.of(EUR_USD, GBP_USD));
            assertEquals(test.getVolatilityIds(EUR_USD), ImmutableSet.of(VOL_ID1));
            assertThrowsIllegalArg(() => test.getVolatilityIds(EUR_GBP));

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

            assertEquals(test.volatilities(EUR_USD, MOCK_MARKET_DATA), MOCK_VOLS);
            assertThrowsIllegalArg(() => test.volatilities(EUR_GBP, MOCK_MARKET_DATA));
        }
        public virtual void test_of_map()
        {
            ImmutableMap <SecurityId, BondFutureVolatilitiesId> ids = ImmutableMap.of(SEC_OG1, VOL_ID1, SEC_OG2, VOL_ID1);
            BondFutureOptionMarketDataLookup test = BondFutureOptionMarketDataLookup.of(ids);

            assertEquals(test.queryType(), typeof(BondFutureOptionMarketDataLookup));
            assertEquals(test.VolatilitySecurityIds, ImmutableSet.of(SEC_OG1, SEC_OG2));
            assertEquals(test.getVolatilityIds(SEC_OG1), ImmutableSet.of(VOL_ID1));
            assertThrowsIllegalArg(() => test.getVolatilityIds(SEC_OG3));

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

            assertEquals(test.volatilities(SEC_OG1, MOCK_MARKET_DATA), MOCK_VOLS);
            assertThrowsIllegalArg(() => test.volatilities(SEC_OG3, MOCK_MARKET_DATA));
        }