Prepare Data Structure

You will build an application that gives you information about the sensitivity on interest rates, the value of the interest rates in the market, and the P&L generated by the combination of these elements. This information will be stored in a cube.

The first step of this tutorial is to prepare the cube schema that you will use to store the values.

Create the Cube

To set the schema in the destination cube
  1. On the home page, click in the top-right corner to open the Tools hub.
  2. Click . The Data source editor opens, allowing you to import your data.
  3. Click CSV DATA IMPORT.
  4. Click Open CSV editor.
  5. Copy the following lines and paste them in the CSV Editor
ID:PK;Maturity;PreviousRate;Rate;Sensi
string;string;double;double;double
  1. Enter the Cube Name: CurvesRates, and then click Import. You have just created an empty cube that is waiting to be populated with data.
Fig. 78: The CSV DATA IMPORT page displaying the confirmation message of a successfully imported CSV data structure. The structure served only at defining the cube schema.

Fig. 78: The CSV DATA IMPORT page displaying the confirmation message of a successfully imported CSV data structure. The structure served only at defining the cube schema.

  1. Click Generate the report. The Report Name field was automatically filled with the name of the cube. You can change it, but take a note of it as you will use it to select the data source in all the subsequent data visualization.
  2. (Optional) Click to go back to the r paste(dse) home page.

Compute the Pnl in the Report

To extend the report with a computed attribute
  1. In the Data source editor click Reports. Alternatively, click on the sidebar in the other pages of the Data manipulation tool.
  2. Search and select the CurvesRates report.
  3. Click Add attribute to add a new attribute.
  4. Select TRANSFORM as the attribute type, and then the following options:
    • Result type: double
    • Operator: Sum
  5. Copy the following code and paste it in the text area:
var result = _report_sensi_*(_report_rate_ - _report_previousRate_);
result;

The code computes the P&L for each record, based on the corresponding values of sensitivity - _report_sensi, rate - _report_rate, and previous rate - _report_previousRate_.

  1. Enter the Attribute name: Pnl, and then click Add transform attribute. You created a new attribute that will be filled with data as soon as the other attributes are.
Fig. 79: Adding a new report attribute of type Transform.

Fig. 79: Adding a new report attribute of type Transform.