> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Exchange rate and market data API

> The IRiskFactorFXPairTranslator interface converts a risk factor into a currency pair and back.

## Relation between RiskFactor and currency pair

The `IRiskFactorFXPairTranslator` interface converts a risk factor into a currency pair and back.

It provides the following functions:

* `riskFactorToFxPair`: Conversion of a risk factor into a currency pair.
* `fxPairToRiskFactor`: Conversion of a currency pair into a risk factor.
* `isFxRiskFactor`: Specifies whether a risk factor is an FX risk factor and can be converted into a currency pair.

This interface has two implementations:

* `RiskFactorFXPairTranslator`: This translator assumes that **RiskFactor=ccy1/ccy2**.
* `LegacyRiskFactorFXPairTranslator`: This translator makes the same transformation as `RiskFactorFXPairTranslator` and also makes **\[ccy]\_FX Equivalent=EUR/ccy** according to the sample dataset.

This service can be injected into any plugin with the interface `IRiskFactorFXPairTranslatorAware`.
It is used by the Delta FX market data post-processor, the RiskFactor hierarchy, and the FX Shift service.

The `LegacyRiskFactorFXPairTranslator` bean is created on the configuration class `RiskFactorFXPairTranslatorConfig`.

## The RiskFactor hierarchy plugin

The `HierarchyWithFxRiskFactors` hierarchy plugin adds the FX Risk Factors in the `Risk Factors` hierarchy.
This hierarchy plugin is a fact one level hierarchy based on the cube retrieval, which adds all possible FX Risk Factors to the members based on the available currencies and the currency-pair-to-risk-factor translator.

## The FX Market Data post-processor

Atoti Market Risk uses a specific post-processor to compute the FX Delta market data: `FxSpotMarketDataPostProcessor`. It will try to use the risk factor as a currency pair.

<table><thead><tr><th>Risk Factor</th><th>Risk CCy</th><th>Base Ccy</th><th>Counter Ccy</th></tr></thead><tbody><tr><td>USD/CAD</td><td>\*</td><td>USD</td><td>CAD</td></tr><tr><td>CAD\_FX Equivalent</td><td>\*</td><td>EUR</td><td>CAD</td></tr></tbody></table>
