Example #1
0
 public virtual void test_map()
 {
     assertEquals(LOOKUP.queryType(), typeof(CreditRatesMarketDataLookup));
     assertEquals(LOOKUP_WITH_SOURCE.requirements(ISSUER_A, USD), FunctionRequirements.builder().observableSource(OBS_SOURCE).valueRequirements(CC_A_USD, DC_USD, RC_A).outputCurrencies(USD).build());
     assertEquals(LOOKUP_WITH_SOURCE.requirements(ISSUER_A, GBP), FunctionRequirements.builder().observableSource(OBS_SOURCE).valueRequirements(CC_A_GBP, DC_GBP, RC_A).outputCurrencies(GBP).build());
     assertEquals(LOOKUP_WITH_SOURCE.requirements(ISSUER_B, GBP), FunctionRequirements.builder().observableSource(OBS_SOURCE).valueRequirements(CC_B_GBP, DC_GBP, RC_B).outputCurrencies(GBP).build());
     assertEquals(LOOKUP.requirements(ISSUER_A, USD), FunctionRequirements.builder().valueRequirements(CC_A_USD, DC_USD, RC_A).outputCurrencies(USD).build());
     assertEquals(LOOKUP.requirements(ISSUER_A, GBP), FunctionRequirements.builder().valueRequirements(CC_A_GBP, DC_GBP, RC_A).outputCurrencies(GBP).build());
     assertEquals(LOOKUP.requirements(ISSUER_B, GBP), FunctionRequirements.builder().valueRequirements(CC_B_GBP, DC_GBP, RC_B).outputCurrencies(GBP).build());
     assertThrowsIllegalArg(() => LOOKUP.requirements(ISSUER_A, EUR));
     assertThrowsIllegalArg(() => LOOKUP.requirements(ISSUER_C, USD));
     assertEquals(LOOKUP.creditRatesProvider(MOCK_MARKET_DATA), DefaultLookupCreditRatesProvider.of((DefaultCreditRatesMarketDataLookup)LOOKUP, MOCK_MARKET_DATA));
 }
        //-------------------------------------------------------------------------
        public virtual FunctionRequirements requirements(CdsIndexTrade trade, ISet <Measure> measures, CalculationParameters parameters, ReferenceData refData)
        {
            // extract data from product
            CdsIndex   product       = trade.Product;
            StandardId legalEntityId = product.CdsIndexId;
            Currency   currency      = product.Currency;

            // use lookup to build requirements
            CreditRatesMarketDataLookup lookup = parameters.getParameter(typeof(CreditRatesMarketDataLookup));

            return(lookup.requirements(legalEntityId, currency));
        }