/SystemicRisk

A framework for systemic risk valuation and analysis.

Primary LanguageMATLABApache License 2.0Apache-2.0

Systemic Risk

This framework calculates and analyses the following systemic risk measures:

Some of the aforementioned models have been improved or extended according to the methodologies described in the V-Lab Documentation, which represents a great source of systemic risk measurement.

The project has been published in "MATLAB Digest - Financial Services" of May 2019. If you found it useful to you, please consider making a donation to support its maintenance and development:

PayPal

Requirements

The minimum required Matlab version is R2014b. In addition, the following products and toolboxes must be installed in order to properly execute the script:

  • Computer Vision System Toolbox
  • Curve Fitting Toolbox
  • Econometrics Toolbox
  • Financial Toolbox
  • Image Processing Toolbox
  • Optimization Toolbox
  • Parallel Computing Toolbox
  • Simulink Control Design
  • Statistics and Machine Learning Toolbox
  • System Identification Toolbox

Usage

  1. Create a properly structured database (see the paragraph below).
  2. Edit the run.m script following your needs.
  3. Execute the run.m script.

Dataset

Datasets must be built following the structure of default ones included in every release of the framework (see Datasets folder). Below a list of the supported Excel sheets and their respective content:

  • Shares: prices or returns expressed in logarithmic scale of the benchmark index (the column can be labeled with any desired name and must be placed just after observation dates) and the firms, with daily frequency.

  • Volumes: trading volume of the firms expressed in currency amount, with daily frequency.

  • Capitalizations: market capitalization of the firms, with daily frequency.

  • CDS: the risk-free rate expressed in decimals (the column must be called RF and must be placed just after observation dates) and the credit default swap spreads of the firms expressed in basis points, with daily frequency.

  • Balance Sheet Components: the balance sheet components of the firms expressed in omogeneous observations frequency, currency and scale, structured as below:

    • Assets: the book value of assets.
    • Equity: the book value of equity.
    • Separate Accounts: the separate accounts of insurance firms.
  • State Variables: systemic state variables, with daily frequency.

  • Groups: group definitions, based on key-value pairs where the Name field represents the group names and the Count field represents the number of firms to include in the group. The sum of the Count fields must be equal to the number of firms. For example, the following groups definition:

    Firms in the Shares Sheet: A, B, C, D, E, F, G, H
    Insurance Companies: 2
    Investment Banks: 2
    Commercial Banks: 3
    Government-sponsored Enterprises: 1

    produces the following outcome:

    "Insurance Companies" contains A and B
    "Investment Banks" contains C and D
    "Commercial Banks" contains E, F and G
    "Government-sponsored Enterprises" contains H

The main dataset (Datasets\Example_Large.xlsx), based on the US financial sector, defines the following entities and data over a period of time ranging from 2002 to 2019 (both included):

Benchmark Index: S&P 500

Financial Institutions (20):

  • Group 1: Insurance Companies (5)
    • American International Group Inc. (AIG)
    • The Allstate Corp. (ALL)
    • Berkshire Hathaway Inc. (BRK)
    • MetLife Inc. (MET)
    • Prudential Financial Inc. (PRU)
  • Group 2: Investment Banks (6)
    • Bank of America Corp. (BAC)
    • Citigroup Inc. (C)
    • The Goldman Sachs Group Inc. (GS)
    • J.P. Morgan Chase & Co. (JPM)
    • Lehman Brothers Holdings Inc. (LEH)
    • Morgan Stanley (MS)
  • Group 3: Commercial Banks (7)
    • American Express Co. (AXP)
    • Bank of New York Mellon Corp. (BK)
    • Capital One Financial Corp. (COF)
    • PNC Financial Services Inc. (PNC)
    • State Street Corp. (STT)
    • US Bancorp (USB)
    • Wells Fargo & Co. (WFC)
  • Group 4: Government-sponsored Enterprises (2)
    • Federal Home Loan Mortgage Corp / Freddie Mac (FMCC)
    • Federal National Mortgage Association / Fannie Mae (FNMA)

Risk-Free Rate: 3M Treasury Bill Rate

State Variables (8):

  • FFR: the effective federal funds rate rate.
  • TBILL_DELTA: the percent change in the 3M treasury bill rate.
  • CREDIT_SPREAD: the difference between the BAA corporate bond rate and the 10Y treasury bond rate.
  • LIQUIDITY_SPREAD: the difference between the 3M GC repo rate and the 3M treasury bill rate.
  • TED_SPREAD: the difference between the 3M USD LIBOR rate and the 3M treasury bill rate.
  • YIELD_SPREAD: the difference between the 10Y treasury bond rate and the 3M treasury bond rate.
  • DJ_CA_EXC: the excess returns of the DJ US Composite Average with respect to the S&P 500.
  • DJ_RESI_EXC: the excess returns of the DJ US Select Real Estate Securities Index with respect to the S&P 500.
  • VIX: the implied volatility index.

Notes

  • The minimum allowed dataset must include the Shares sheet with a benchmark index and at least 3 firms. Observations must have a daily frequency and, in order to run consistent calculations, their minimum required amount is 253, which translates into a full business year plus an additional observation at the beginning of the time series. They must have been previously validated and preprocessed by:

    • discarding illiquid series (unless necessary);
    • detecting and removing outliers;
    • removing rows with NaNs or filling the gaps through interpolation.
  • It is not mandatory to include financial time series used by unwanted measures. Optional financial time series used by included measures can be omitted, as long as their contribution isn't necessary. Below a list of required and optional time series for each category of measures:

    • Component Measures:
      • Required: shares (any).
      • Optional: none.
    • Connectedness Measures:
      • Required: shares (any).
      • Optional: groups.
    • Cross-Quantilogram Measures:
      • Required: shares (any).
      • Optional: state variables.
    • Cross-Sectional Measures:
      • Required: shares (any), capitalizations, assets, equity.
      • Optional: separate accounts, state variables.
    • Default Measures:
      • Required: shares (any), capitalizations, cds, assets, equity.
      • Optional: none.
    • Liquidity Measures:
      • Required: shares (prices), volumes, capitalizations.
      • Optional: state variables.
    • Regime-Switching Measures:
      • Required: shares (any).
      • Optional: none.
    • Spillover Measures:
      • Required: shares (any).
      • Optional: none.
  • Firms whose Shares value is constantly null in the tail of the time series, for a span that includes at least 5% of the total observations, are considered to be defaulted. Firms whose Equity value is constantly null in the tail of the time series, for a span that includes at least 5% of the total observations, are considered to be insolvent. This allows the scripts to exclude them from computations starting from a certain time point onward; defaulted firms are excluded by all the measures, while insolvent firms are excluded only by SCCA default measures.

  • If the dataset parsing process is too slow, the best way to solve the issue is to provide a standard unformatted Excel spreadsheet (.xlsx) or a binary Excel spreadsheet (.xlsb). Once a dataset has been parsed, the script stores its output so that the parsing process happens only at first run.

  • Some scripts may take very long time to finish in presence of huge datasets and/or extreme parametrizations. The performance of calculations may vary depending on the CPU processing speed and the number of CPU cores available for parallel computing.

Screenshots

Screenshots