FXSingle present value formula

Where can I find the formula that Strata uses to calculate the fair value (present value?) of a single FX trade? I tried to look (deep) into the source code, but couldn’t come up with anything. I’d be happy if someone can help me here or point me into the right direction.

Oh and is there a function to split the present value into an “interest component” and “spot component”?

Thanks!

The pricer is DiscountingFxSingleTradePricer. All the functions we have are there.

Oh okay, thanks. I’ll take a look there.

I am currently calculating a set of FX Forwards with different Base- and CounterCurrencies and calculate the Present Value as follows:

// the columns, specifying the measures to be calculated
List columns = ImmutableList.of(
	Column.of(Measures.PRESENT_VALUE));

// the complete set of rules for calculating measures
CalculationFunctions functions = StandardComponents.calculationFunctions();
RatesMarketDataLookup ratesLookup = RatesMarketDataLookup.of(curveGroup);
CalculationRules rules = CalculationRules.of(functions, ratesLookup);

// the reference data, such as holidays and securities
ReferenceData refData = ReferenceData.standard();

// calculate the results
Results results = runner.calculate(rules, trades, columns, marketData, refData);
Pair resultPairs = Pair.of(trades, results);

I noticed that the resulting calculated Present Value is given in different currencies and it’s not always the BaseCurrency of the trade. Can you tell me if this is a bug or am I doing something wrong? For instance, I have a FX Forward with BaseCurrency = ZAD and CounterCurrency = USD. The Present Value is shown as having the currency USD.

The trades are a list of FxSingleTrades built with FxSingleTrade.builder().

Is there a way to just say I want the Measures (e.g. Present Value) always calculated in EUR?

Thank you very much.

CalculationRules has a reportingCurrency property. If that is set, and the FX rates are correctly set in the market data, then the result should be converted.

Awesome. That worked. Thank you.