//------------------------------------------------------------------------- public virtual void test_requirementsAndCurrency() { SecurityTradeCalculationFunction function = new SecurityTradeCalculationFunction(); ISet <Measure> measures = function.supportedMeasures(); FunctionRequirements reqs = function.requirements(TRADE, measures, PARAMS, REF_DATA); assertThat(reqs.OutputCurrencies).containsOnly(CURRENCY); assertThat(reqs.ValueRequirements).isEqualTo(ImmutableSet.of(QuoteId.of(SEC_ID.StandardId))); assertThat(reqs.TimeSeriesRequirements).Empty; assertThat(function.naturalCurrency(TRADE, REF_DATA)).isEqualTo(CURRENCY); }
public virtual void test_presentValue() { SecurityTradeCalculationFunction function = new SecurityTradeCalculationFunction(); ScenarioMarketData md = marketData(); double unitPv = (MARKET_PRICE / TICK_SIZE) * TICK_VALUE; CurrencyAmount expectedPv = CurrencyAmount.of(CURRENCY, unitPv * QUANTITY); ISet <Measure> measures = ImmutableSet.of(Measures.PRESENT_VALUE); assertThat(function.calculate(TRADE, measures, PARAMS, md, REF_DATA)).containsEntry(Measures.PRESENT_VALUE, Result.success(CurrencyScenarioArray.of(ImmutableList.of(expectedPv)))); }