> ## 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.

# Market data API data loading

Atoti Market Risk provides two options for loading data into the Atoti Market Data stores.

This section provides information about:

* data loading properties.
* selecting between the new and backwards compatible file formats.
* conditional annotations for Spring configuration.
* configuration classes that need to be imported for:
  * backwards compatibility with the deprecated file format.
  * new data file formats.

## Properties

The following properties are available in the application:

<table><thead><tr><th>Property</th><th>Default</th><th>Details</th></tr></thead><tbody><tr><td><code>mr.common.file-patterns.spot-market-data</code></td><td><code>glob:\*\*Spot\_Market\_Data\*.csv</code></td><td>An <code>SPOT\_MARKET\_DATA\_FILE\_PATTERN</code> constant containing the default value is available in <code>CommonFilePatternProperties</code>.</td></tr><tr><td><code>mr.common.file-patterns.curve-market-data</code></td><td><code>glob:\*\*Curve\_Market\_Data\*.csv</code></td><td>A <code>CURVE\_MARKET\_DATA\_FILE\_PATTERN</code> constant containing the default value is available in <code>CommonFilePatternProperties</code>.</td></tr><tr><td><code>mr.common.file-patterns.fx-rate-market-data</code></td><td><code>glob:\*\*FX\_Rate\_Market\_Data\*.csv</code></td><td>An <code>FX\_RATE\_MARKET\_DATA\_FILE\_PATTERN</code> constant containing the default value is available in <code>CommonFilePatternProperties</code>.</td></tr><tr><td><code>mr.common.file-patterns.surface-market-data</code></td><td><code>glob:\*\*Surface\_Market\_Data\*.csv</code></td><td>A <code>SURFACE\_MARKET\_DATA\_FILE\_PATTERN</code> constant containing the default value is available in <code>CommonFilePatternProperties</code>.</td></tr><tr><td><code>mr.common.file-patterns.cube-market-data</code></td><td><code>glob:\*\*Cube\_Market\_Data\*.csv</code></td><td>A <code>CUBE\_MARKET\_DATA\_FILE\_PATTERN</code> constant containing the default value is available in <code>CommonFilePatternProperties</code>.</td></tr></tbody></table>

## Selecting between new and backwards compatible file formats

If the Atoti Market Data Spring Boot Starter is imported into the application with the default source configuration, each market data table will be loaded from its specific file based on the above patterns.

To enable loading a table from the deprecated file format, set the property for that particular table to the format pattern of the deprecated file. For example, if the `mr.common.file-patterns.spot-market-data` property has been set to `regex:^(?i).*MarketData(?<!MarketDataSets).*.csv.*$` and `mr.common.file-patterns.cube-market-data` has been left empty, the `SpotMarketData` table will load from the old market data file format, whereas the `CubeMarketData` table will be loaded from the current file format.

## Conditional annotations

To allow the correct configuration to be loaded if all source configuration classes are imported, the following annotations are available for both `@Bean` methods and `@Configuration` classes:

| Annotation                                            | Matching                                                                                                                      |
| ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| `@ConditionalOnBCSpotMarketDataFileFormatEnabled`     | Matches if the `mr.common.file-patterns.spot-market-data` property is set to `regex:^(?=.*MarketData)(?:(?!Sets).)+.csv$`.    |
| `@ConditionalOnBCSpotMarketDataFileFormatDisabled`    | Matches if the `mr.common.file-patterns.spot-market-data` property is anything other than the above value.                    |
| `@ConditionalOnBCCurveMarketDataFileFormatEnabled`    | Matches if the `mr.common.file-patterns.curve-market-data` property is set to `regex:^(?=.*MarketData)(?:(?!Sets).)+.csv$`.   |
| `@ConditionalOnBCCurveMarketDataFileFormatDisabled`   | Matches if the `mr.common.file-patterns.curve-market-data` property is anything other than the above value.                   |
| `@ConditionalOnBCSurfaceMarketDataFileFormatEnabled`  | Matches if the `mr.common.file-patterns.surface-market-data` property is set to `regex:^(?=.*MarketData)(?:(?!Sets).)+.csv$`. |
| `@ConditionalOnBCSurfaceMarketDataFileFormatDisabled` | Matches if the `mr.common.file-patterns.surface-market-data` property is anything other than the above value.                 |
| `@ConditionalOnBCCubeMarketDataFileFormatEnabled`     | Matches if the `mr.common.file-patterns.cube-market-data` property is set to `regex:^(?=.*MarketData)(?:(?!Sets).)+.csv$`.    |
| `@ConditionalOnBCCubeMarketDataFileFormatDisabled`    | Matches if the `mr.common.file-patterns.cube-market-data` property is anything other than the above value.                    |
| `@ConditionalOnBCFxRateMarketDataFileFormatEnabled`   | Matches if the `mr.common.file-patterns.fx-rate-market-data` property is set to `glob:**FXRates*.csv`.                        |
| `@ConditionalOnBCFxRateMarketDataFileFormatDisabled`  | Matches if the `mr.common.file-patterns.fx-rate-market-data` property is anything other than the above value.                 |

## Backwards compatibility

The market data can be loaded from the deprecated market data input file format, while the FX store can be loaded from the deprecated FX rates file.
The sources are included in the application through the `AllBackwardsCompatibleMarketDataSources` configuration class but these are disabled by default.

### Spot market data loading

Defined in the `BCSpotMarketDataCsvSourceParametersProviderConfig` class. Each row will be checked for validity as follows:

<table><thead><tr><th>Axis field</th><th>Empty</th><th>Filled in</th></tr></thead><tbody><tr><td>TenorLabels</td><td>Y</td><td>N</td></tr><tr><td>TenorDates</td><td>Y</td><td>N</td></tr><tr><td>MaturityLabels</td><td>Y</td><td>N</td></tr><tr><td>MaturityDates</td><td>Y</td><td>N</td></tr><tr><td>MoneynessLabels</td><td>Y</td><td>N</td></tr><tr><td>Nominal</td><td>Y</td><td>N</td></tr></tbody></table>

### Curve market data loading

Defined in the `BCCurveMarketDataCsvSourceParametersProviderConfig` class. Each row will be checked for validity as follows:

<table><thead><tr><th>Axis field</th><th>Empty</th><th>Filled in</th></tr></thead><tbody><tr><td>TenorLabels</td><td>N</td><td>Y</td></tr><tr><td>TenorDates</td><td>Y</td><td>N</td></tr><tr><td>MaturityLabels</td><td>Y</td><td>N</td></tr><tr><td>MaturityDates</td><td>Y</td><td>N</td></tr><tr><td>MoneynessLabels</td><td>Y</td><td>N</td></tr><tr><td>Nominal</td><td>Y</td><td>N</td></tr></tbody></table>

### Surface market data loading

Defined in the `BCSurfaceMarketDataCsvSourceParametersProviderConfig` class. Each row will be checked for validity as follows:

<table><thead><tr><th>Axis field</th><th>Empty</th><th>Filled in</th></tr></thead><tbody><tr><td>TenorLabels</td><td>N</td><td>Y</td></tr><tr><td>TenorDates</td><td>Y</td><td>N</td></tr><tr><td>MaturityLabels</td><td>Y</td><td>N</td></tr><tr><td>MaturityDates</td><td>Y</td><td>N</td></tr><tr><td>MoneynessLabels</td><td>N</td><td>Y</td></tr><tr><td>Nominal</td><td>Y</td><td>N</td></tr></tbody></table>

### Cube market data loading

Defined in the `BCCubeMarketDataCsvSourceParametersProviderConfig` class. Each row will be checked for validity as follows:

<table><thead><tr><th>Axis field</th><th>Empty</th><th>Filled in</th></tr></thead><tbody><tr><td>TenorLabels</td><td>N</td><td>Y</td></tr><tr><td>TenorDates</td><td>Y</td><td>N</td></tr><tr><td>MaturityLabels</td><td>N</td><td>Y</td></tr><tr><td>MaturityDates</td><td>Y</td><td>N</td></tr><tr><td>MoneynessLabels</td><td>N</td><td>Y</td></tr><tr><td>Nominal</td><td>Y</td><td>N</td></tr></tbody></table>

### FX rate

Defined in the `BCFxRateMarketDataCsvSourceParametersProviderConfig` class. From the old file format, the `Term` and `RiskFactorId` fields will be ignored.

## New data file formats

If backwards compatibility isn’t required, sources matching the data model stores are available. The file formats in this section refer to this data loading mode.

### Cube market data loading

Defined in the `CubeMarketDataCsvSourceParametersProviderConfig` class.

Input file: [Cube market data](../../../../input-files/cube-market-data)

### Curve market data loading

Defined in the `CurveMarketDataCsvSourceParametersProviderConfig` class.

Input file: [Curve market data](../../../../input-files/curve-market-data)

### FX rate

Defined in the `FxRateMarketDataCsvSourceParametersProviderConfig` class.

Input file: [FX rate market data](../../../../input-files/fx-rate-market-data)

### Spot market data loading

Defined in the `SpotMarketDataCsvSourceParametersProviderConfig` class.

Input file: [Spot market data](../../../../input-files/spot-market-data)

### Surface market data loading

Defined in the `SurfaceMarketDataCsvSourceParametersProviderConfig` class.

Input file: [Surface market data](../../../../input-files/surface-market-data)
