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

# FRTB-specific configuration

export const productName = "Atoti FRTB";

## Scopes

The scope describes which data is loaded and unloaded.

Each request to the Data Load Controller contains a scope. In the FRTB reference implementation, the as-of date scope is turned into a directory and all the
files in that directory are loaded. When unloading data, the scope is turned into a RemoveWhere clause to be run on the datastore.

The following table shows you the three different scopes in the FRTB reference implementation. You can add your own scope definition if required, such as
'book', 'portfolio', and so on.

| Scope               | Description                                                                                                                                                                                                                                                                                                                                        |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Configuration Scope | This scope is used for configuration files, including the parameters which are fetched the parameters API. Data in this scope typically has a “start date” rather than an as-of date.<br /><br />The files in this scope are found in the “configuration” directory.<br /><br />This scope has no parameters.                                      |
| Historical Scope    | This scope is used for historical summary data. This data is not at the trade level and does not include recent dates. Instead it is at the aggregate level (for example, book and legal entity) and contains a long history.<br /><br />The files in this scope are found in the “historical” directory.<br /><br />This scope has no parameters. |
| As-Of Date Scope    | This scope is for the daily trade-level files.<br /><br />The files in this scope are found in directories whose names match the requested date. This scope is parameterized by as-of date.<br /><br />For example:<br /><br />`"scope":{ "AsOfDate": "2018-09-27" }`                                                                              |

## Topic Aliases

Each input file is loaded with a topic (see [Input file formats](../../../input-files/index)). Topic aliases are used to group those topics. {productName} contains the following topic aliases:

| Alias                      | Description                                                                   | Scope               | Topics                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| -------------------------- | ----------------------------------------------------------------------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ConfigurationData          | Parameter set data                                                            | Configuration scope | [Configuration](../../../input-files/configuration/index)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| TupleData                  | Tuples inserted directly into the datastore (for QIS double sums hierarchies) | Configuration scope | [IMA\_Trades](../../../input-files/expected-shortfall-pl-trade), [IMA\_Summary](../../../input-files/ima-summary)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| FXData                     | Recent FX rates                                                               | As-of date scope    | [FXRates](../../../input-files/fx-rates), [EsScenarioFxRates](../../../input-files/ima-es-scenario-fx-rates)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| OrganisationData           | Book and Legal Entity hierarchies                                             | As-of date scope    | [Reference and Booking Files](../../../input-files/reference-booking/index): <br />[CombinedBookParentChildDesk](../../../input-files/book-parent-child-v1), [BookParentChild](../../../input-files/book-parent-child-v2), [BookDescription](../../../input-files/book-description), [DeskDescription](../../../input-files/desk-description), [IRTDeskGroups](../../../input-files/irt-desk-groups), and [Categories](../../../input-files/categories). BookHierarchy store tuples are generated from BookParentChild Store tuples, [LegalEntityParentChild](../../../input-files/legal-entity-parent-child), and [LegalEntityAttributes](../../../input-files/legal-entity-attributes)                                                                                                                                                  |
| TradeBookingData           | Trade attributes and mapping                                                  | As-of date scope    | [Trade\_Attributes](../../../input-files/trade-attributes)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| SBMData                    | SBM sensitivities and related bucket stores                                   | As-of date scope    | [Equity Buckets](../../../input-files/equity-buckets), [EquityBucketDescription](../../../input-files/equity-bucket-descriptions), [CommodityBuckets](../../../input-files/commodity-buckets), [DRCSecNonCtpBuckets](../../../input-files/drc-buckets), [CSR\_BUCKET\_DESCRIPTION\_NONSEC](../../../input-files/csr-non-sec-bucket-descriptions), [CSR\_BUCKET\_DESCRIPTION\_SECNONCTP](../../../input-files/csr-sec-non-ctp-bucket-descriptions), [CSR\_BUCKET\_DESCRIPTION\_SECCTP](../../../input-files/csr-sec-ctp-bucket-descriptions), [SeniorityDescription](../../../configuration/drc-seniority-description), [SBM\_Curvature\_Sensi](../../../input-files/curvature-trade), [SBM\_Delta\_Sensi](../../../input-files/delta-trade), [SBM\_Vega\_Sensi](../../../input-files/vega-trade), [RRAO](../../../input-files/rrao-trade) |
| CrifData                   |                                                                               |                     | [CRIF](../../../input-files/crif/index)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| SADRCData                  | SA DRC data                                                                   | As-of date scope    | [DRC](../../../input-files/sa-drc-trade), [PublicSectorObligorRiskWeights](../../../input-files/sa-drc-public-sector-obligor-risk-weights)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| SAOverrides                |                                                                               |                     | [UnderlyingDescriptionOverrides](../../../input-files/underlying-description-overrides), [ObligorOverrides](../../../input-files/obligor-overrides), [TrancheOverrides](../../../input-files/tranche-overrides), [RRAOOverrides](../../../input-files/rrao-overrides)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| CATradeData                | IMA and SES trade level data                                                  | As-of date scope    | [Scenarios](../../../input-files/ima-pl-scenarios), [IMARiskFactors](../../../input-files/risk-factors), [IMA\_Trades](../../../input-files/expected-shortfall-pl-trade)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| IMADRCScenariosData        | Descriptions of IMA DRC scenarios                                             | As-of date scope    | [DRC\_SCENARIO\_COUNT](../../../input-files/drc-scenario-count), [DRCScenarios](../../../input-files/drc-scenarios)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| IMADRCTradeData            | Recent IMA DRC trade data                                                     | As-of date scope    | [DRC](../../../input-files/drc-trade-level-ima), [DRC\_NONLINEAR\_RECOVERY](../../../input-files/drc-non-linear-recovery-trade)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| PLTradeData                | Recent PLAT and backtesting trade-level data                                  | As-of date scope    | [PLSummary](../../../input-files/pl-summary), [PLScenarios](../../../input-files/pl-var-scenario)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ALLSA                      | FXData + OrganisationData + TradeBookingData + SBMData + SADRCData            | As-of date scope    | FXRates, Organisation, TradeBooking, SBM, SADRC, Crif, SAOverrides (loads all of these Aliases and their associated topics, as listed in this table (above))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ALLIMADaily                | FXData + OrganisationData + TradeBookingData + CATradeData + IMADRCTradeData  | As-of date scope    | FXRates, Organisation, TradeBooking, CATrade, IMADRCTrade (loads all of these Aliases and their associated topics, as listed in this table (above))                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| StressCalibrationData      | Trades & Scenarios data for Stress Calibration Cube                           | As-of date scope    | [StressCalibrationPLTrades](../../../input-files/stress-calibration-pl-trades), [StressCalibrationScenarios](../../../input-files/stress-calibration-scenarios), [StressCalibrationScenarioFxRates](../../../input-files/stress-calibration-scenario-fx-rates)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| HistoricalOrganisationData | BookDescriptionHistorical + BookParentChildHistorical                         | Historical scope    | [Book Parent Child](../../../input-files/book-parent-child-v2), [Desk Description](../../../input-files/desk-description), [IRT Desk Groups](../../../input-files/irt-desk-groups), and [Reference and Booking Files](../../../input-files/reference-booking/index)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| IMADRCSummaryData          | Historical IMA DRC data                                                       | Historical scope    | [IMA\_DRC\_Summary](../../../input-files/drc-summary-ima), [FXHistorical](../../../input-files/fx-rates)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| PLSummaryData              | Historical/summary PLAT and backtesting Trades & Scenario data                | Historical scope    | [PLSummary](../../../input-files/pl-summary), [PLSummaryScenarios](../../../input-files/pl-summary-scenarios), [FXHistorical](../../../input-files/fx-rates)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| IMASummary                 | IMA and SES historical/summary data                                           | Historical scope    | [IMA\_Summary](../../../input-files/ima-summary), [IMARiskFactorsHistorical](../../../input-files/risk-factors), [FXHistorical](../../../input-files/fx-rates), [EsScenarioFxHistorical](../../../input-files/ima-es-scenario-fx-rates)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| SASummary                  | CASummaryData                                                                 | Historical scope    | [SBM\_Delta\_Sensi\_Summary](../../../input-files/delta-summary), [SBM\_Vega\_Sensi\_Summary](../../../input-files/vega-summary), [SBM\_Curvature\_Sensi\_Summary](../../../input-files/curvature-summary), [DRC\_Summary](../../../input-files/sa-drc-summary), [RRAO\_Summary](../../../input-files/rrao-summary)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

## Unload Topic Aliases

Unload topic aliases allow you to selectively unload data for a specific as-of date, cube by cube. Each alias maps to the set of datastore tables that feed a specific cube. This allows you to unload one cube's data without affecting others.

| Alias                   | Description                                                       | Stores                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ----------------------- | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| UnloadSA                | Standardised Approach cube stores                                 | SASensitivities, RiskFactorDescription, UnderlyingDescription, SATradeDescription, Obligor, Tranche, Security, RRAO, IRTDeskGroups, RiskFactorDescriptionOverrides, UnderlyingDescriptionOverrides, ObligorOverrides, TrancheOverrides, RRAOOverrides, EquityBuckets, CommodityBuckets, DrcSecNonCtpBuckets, EquityBucketDesc, CSRBucketDesc, PublicSectorObligorRiskWeights                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| UnloadIMA               | Internal Model Approach cube stores                               | IMATrades, IMARiskFactors, Scenarios, EsScenarioFxRates                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| UnloadIMADRC            | IMA Default Risk Charge cube stores                               | DRCIMABase, DRCScenarios, DRCScenariosCount                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| UnloadPL                | P\&L Attribution / Backtesting cube stores                        | PLTrades, PLScenarios                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| UnloadStressCalibration | Stress Calibration cube stores                                    | StressCalibrationTrades, StressCalibrationScenarios, StressCalibrationScenarioFxRates                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| UnloadCommon            | Shared organisation and booking stores used across all cubes      | TradeMapping, BookParentChild, BookHierarchy, BookDescription, DeskDescription, LegalEntityParentChild, LegalEntityHierarchy, LegalEntityAttributes, LegalEntityImports, FXRates                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| UnloadParameters        | Global parameter stores (risk weights, correlations, etc.)        | FRTBParameters, ParameterSet, CSRNonSecBucket, CSRSecCTPBucket, CSRSecNonCTPBucket, DRCWeight, ERBARiskWeight, CommodityBucketRiskWeights, EquityBucketsRiskWeight, CSRBucketsRiskWeight, VegaRiskWeights, CommodityIntraBucketCorrelations, CSRBucketCorrelations, EquityGammaCorrelations, EquityRhoCorrelations, CSRNonSecHighRatings, GIRRDeltaWeighting, GIRRMajorCurrency, GIRRCorrelationOverrides, FXDeltaSpecialCrosses, FXRiskWeightOverrides, Vertices, OptionResidualMaturityVertices, LiquidityHorizons, IMAMultiplier, SensitivityScaling, InstrumentToLGD, ObligorToRiskWeight, GIRRDeltaDoubleSums, EquityDeltaDoubleSums, CsrNsDeltaDoubleSums, CsrSecNonCtpDeltaDoubleSums, CsrSecCtpDeltaDoubleSums, CommodityDeltaDoubleSums, FXDeltaDoubleSums, Crypto2aDeltaDoubleSums, GIRRVegaDoubleSums, EquityVegaDoubleSums, CsrNsVegaDoubleSums, CsrSecNonCtpVegaDoubleSums, CsrSecCtpVegaDoubleSums, CommodityVegaDoubleSums, FXVegaDoubleSums, Crypto2aVegaDoubleSums |
| UnloadAllData           | Composite alias that unloads all of the above (except Parameters) | UnloadSA + UnloadIMA + UnloadIMADRC + UnloadPL + UnloadStressCalibration + UnloadCommon                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |

To unload, for example, the SA cube data for a specific date:

```json theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
{
  "operation": "UNLOAD",
  "topic": "UnloadSA",
  "scope": { "AsOfDate": "2018-09-28" }
}
```

To unload all cube data for a date while keeping parameters:

```json theme={"languages":{"custom":["/engine/python-sdk/0.9/languages/pycon.tmLanguage.json"]}}
{
  "operation": "UNLOAD",
  "topic": "UnloadAllData",
  "scope": { "AsOfDate": "2018-09-28" }
}
```

## Configuration Properties

The following properties can be set in `application.properties`:

| Property                           | Default Value                     | Description                                                         |
| ---------------------------------- | --------------------------------- | ------------------------------------------------------------------- |
| `csv-source.dataset`               | sample-data/data                  | Path to the directory containing the files to load.                 |
| `csv-source.dataset-historical`    | \${csv-source.dataset}/historical | Path to the directory containing historical files to load.          |
| `csv-source.dataset-configuration` | sample-data/configuration         | Path to the directory containing the configuration files to load.   |
| `initial-load.business-dates`      |                                   | If set, the (comma-separated) set of as-of-dates to load at startup |
| `initial-load.history `            | true                              | If set to `true`, historical data will be loaded                    |

## Initial Load Order

### Topic Aliases

The following topic aliases are loaded on startup in the specified order.

#### Configuration

If there is a `configuration` directory available, the following topics are loaded:

1. ConfigurationData
2. TupleData

#### As-of-Dates

If the configuration parameter `initial-load.business-dates` is set, the dates listed in the parameter are used. For example, in the `application.properties` file:

```
initial-load.business-dates=2018-09-28,2018-09-27
```

If the `initial-load.business-dates` parameter is not set, the top level of the data directory is scanned for directories with date names. These dates are then used as the as-of-dates for the initial load. This matches the previous startup behavior.

#### Topics loaded with As-Of-Dates

For the set of determined as-of-dates, the following topics are loaded with the "AsOfDate" field set in the scope:

3. IMADRCScenariosData
4. ALLSA + ALLIMADaily + PLTradeData + StressCalibrationData

#### Historical Data (Optional)

If the configuration parameter `initial-load.history` is set to `true` and there is a `historical` directory available, the following additional topics are loaded:

5. HistoricalOrganisationData + IMASummary + PLSummaryData + IMADRCSummaryData
