- FRTB regulations specify that non-modellable risk factors are subject to stressed capital add-ons
- For a risk factor to be modellable it must pass a specific test for continuously available real prices
- The Clarus API provides functions for the risk factor modellability test for OTC Derivatives
- These functions are very easy to call from many popular languages, including Python, R, Julia, C++, and Java.
- Many related functions are available, see our API documentation.
FRTB Modellable test
The specific test for continuously available real prices is defined as follows.
- a risk factor must have at least 24 observable real prices per year
- with a maximum period of one month between two consecutive observations
- the above criteria must be assessed on a monthly basis
- and measured over the current ES period (e.g. past 12 months)
For further details, see FRTB – Modellable Risk Factors and Non-Modellable.
[UPDATE: January 2019, this criteria has been revised, see FRTB RFET.]
Calling directly in the browser
To appreciate the ease with which the function may be called, our first example does not even involve writing code, as the function can be called directly in the browser!
This URL is enough to call the function and see its results.
https://api.clarusft.com/rest/v1/frtb/modellablerf.html?riskfactors=USSW2,USSW3,USSW4,USSW5
To ease the exposition, we set the riskfactors
parameter to a list of Bloomberg tickers for USD Swaps. To be able to click the URL and run yourself, you will need to enter a username/password the first time (obtained by registering here). The output is below and shows that all of these risk factors pass the modellable test.
RiskFactor Ticker Modellable Count Gap Comment USSW2 USSW2 TRUE 6029 USSW3 USSW3 TRUE 5764 USSW4 USSW4 TRUE 2177
USSW5 USSW5 TRUE 12264
Calling from Python
To do the same test from Python for all the risk factors that we may want on a USD Libor 3M curve, we can load a list of riskfactor names from a file and perform the modellability test using the code below.
import clarus
clarus.ApiConfig.api_key = '' clarus.ApiConfig.api_secret = '' mylist = open('riskfactors.txt').read() print (clarus.frtb.modellablerf(riskfactors=mylist))
This code is just a few lines and relies on the Clarus python module (which relies on the popular Requests library) and the key/secret can be obtained by registering here. The results produced are as follows.
RiskFactor Ticker Modellable Count Gap Comment
USSW1 USSW1 TRUE 1112
USSW2 USSW2 TRUE 6029
USSW3 USSW3 TRUE 5764
USSW4 USSW4 TRUE 2177
USSW5 USSW5 TRUE 12264
USSW6 USSW6 TRUE 1410
USSW7 USSW7 TRUE 3132
USSW8 USSW8 TRUE 1142
USSW9 USSW9 TRUE 1273
USSW10 USSW10 TRUE 19281
USSW11 USSW11 TRUE 76
USSW12 USSW12 TRUE 1029
USSW13 USSW13 FALSE 25 81 First trade not within a month of start
USSW14 USSW14 FALSE 30 61 Gap of greater than a month found
USSW15 USSW15 TRUE 1877
USSW20 USSW20 TRUE 2098
USSW25 USSW25 TRUE 817
USSW30 USSW30 TRUE 8887
USSW40 USSW40 TRUE 97
Showing that almost all these risk factors pass the test (modellable column equal true) and giving the count of trades in the past year for that risk factor. Two risk factors 13Y and 14Y fail the test, not because we do not have at least 24 trades in the year, but because the largest gap between consecutive trades is greater than one month at 81 calendar days and 61 calendar days respectively.
Evidencing the Modellable test
There is also a function to evidence the modellable test by returning the list of trades used, which can be called using the code snippet below for one risk factor.
response = clarus.frtb.modellablerftrades(riskfactor='USSW11'))
print (response)
The first few rows of results produced by this code are:
TICKER TIMESTAMP STATUS VENUE PRICE NOTIONAL SDR
USSW11 2016-03-31 11:24:09.0 C On 1.74 5000000.0 BBG
USSW11 2016-04-07 08:27:25.0 C On 1.664 1.0E7 BBG
USSW11 2016-04-08 02:13:58.0 C On 1.648 1.0E7 BBG
USSW11 2016-04-11 15:28:58.0 C On 1.675 5000000.0 BBG
USSW11 2016-04-12 15:56:32.0 C On 1.7012 7000000.0 BBG
USSW11 2016-04-27 19:36:57.0 C On 1.822 2.5E7 BBG
USSW11 2016-04-29 12:20:28.0 C On 1.807 3.9E7 BBG
USSW11 2016-05-02 13:20:14.0 C On 1.7971 3.9E7 BBG
USSW11 2016-05-06 14:24:31.0 C On 1.685 1.2E8 DTCC
USSW11 2016-05-23 13:32:10.0 C On 1.7625 3000000.0 DTCC
....
Showing each trades execution time stamp, whether it is cleared (c) or uncleared, the execution venue type (On or Off SEF), the price, notional and the SDR it was reported to.
More Risk Factors
Next lets try USD Libor 1M v 3M Basis Swap factors by running the function with the appropriate ticker list.
RiskFactor Ticker Modellable Count Gap Comment
USBA1 USBA1 TRUE 251
USBA2 USBA2 TRUE 304
USBA3 USBA3 TRUE 466
USBA5 USBA5 TRUE 965
USBA10 USBA10 TRUE 710
USBA15 USBA15 TRUE 150
USBA20 USBA20 TRUE 102
USBA30 USBA30 TRUE 133
Showing the tenors (1Y to 30Y) that we can use for this curve.
There are also other USD Basis curves to try e.g. Libor 3M vs 6M and USD FedFunds.
Followed by other currencies and cross currency basis.
Followed by Swaption volatilities.
That should cover the majority of risk factors needed for an IRD Trading Desk.
A lot of data to look at and establish the set of risk factors useable in an Internal Model.
And importantly ensure these are not subject to expensive Stressed Capital Addons.
If you are interested in such an exercise, please contact us.
This is great! R or Julia plus encrypted https microservice.