Duration volatility #

This category contains basic generic estimates of annualized standard deviations of IRS positions and related leverage measures. The main purpose of these indicators in JPMaQS is to facilitate the adjustment of other quantamental indicators, factors and returns for volatility.

For most markets and periods, return volatility has been calculated based on interest rate swaps. However, non-deliverable swaps have been used for some of the history of emerging markets.

Duration volatility #

Ticker : DU02YXRxEASD_NSA / DU05YXRxEASD_NSA / DU10YXRxEASD_NSA

Label : Duration volatility, in % of notional: 2-year maturity / 5-year maturity / 10-year maturity.

Definition : Annualized return standard deviation of fixed receiver position in main interest rate swaps contract traded in the currency area, % of notional of the contract: 2-year maturity / 5-year maturity / 10-year maturity.

Notes :

  • The standard deviation has been calculated based on an exponential moving average of daily returns with a half-life of 11 active trading days.

  • The interest rate derivative for most currency areas is an interest rate swap. For some emerging market countries (China, India, Korea, Thailand, Taiwan), non-deliverable swaps have been used.

Leverage ratio of vol-targeted duration position #

Ticker : DU02YXRxLEV10_NSA / DU05YXRxLEV10_NSA / DU10YXRxLEV10_NSA

Label : Leverage ratio of duration position for 10% annualized vol target: 2-year maturity / 5-year maturity / 10-year maturity.

Definition : IRS leverage ratio for a 10% annualized vol target, as ratio of contract notional relative to risk capital on which the return is calculated (and subject to maximum leverage of 20): 2-year maturity / 5-year maturity / 10-year maturity

Notes :

  • This serves as the leverage ratio for a 10% annualized vol target and is inversely proportional to the estimated annualized standard deviation of the return on a USD1 notional position.

  • An intuitive leverage ratio of 20 (for notional to risk capital) has been applied to simulate capital and risk management limits to leverage.

  • See further the notes above on “Duration volatility” ( DU02YXRxEASD_NSA / DU05YXRxEASD_NSA / DU10YXRxEASD_NSA ).

Imports #

Only the standard Python data science packages and the specialized macrosynergy package are needed.

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import math
import os

import macrosynergy.management as msm
import macrosynergy.panel as msp
import macrosynergy.signal as mss
import macrosynergy.pnl as msn


from macrosynergy.download import JPMaQSDownload

from timeit import default_timer as timer
from datetime import timedelta, date, datetime

import warnings

warnings.simplefilter("ignore")

The JPMaQS indicators we consider are downloaded using the J.P. Morgan Dataquery API interface within the macrosynergy package. This is done by specifying ticker strings , formed by appending an indicator category code <category> to a currency area code <cross_section> . These constitute the main part of a full quantamental indicator ticker, taking the form DB(JPMAQS,<cross_section>_<category>,<info>) , where <info> denotes the time series of information for the given cross-section and category. The following types of information are available:

  • value giving the latest available values for the indicator

  • eop_lag referring to days elapsed since the end of the observation period

  • mop_lag referring to the number of days elapsed since the mean observation period

  • grade denoting a grade of the observation, giving a metric of real time information quality.

After instantiating the JPMaQSDownload class within the macrosynergy.download module, one can use the download(tickers,start_date,metrics) method to easily download the necessary data, where tickers is an array of ticker strings, start_date is the first collection date to be considered and metrics is an array comprising the times series information to be downloaded.

# Cross-sections of interest

cids_dmca = [
    "AUD",
    "CAD",
    "CHF",
    "EUR",
    "GBP",
    "JPY",
    "NOK",
    "NZD",
    "SEK",
    "USD",
]  # DM currency areas
cids_dmec = ["DEM", "ESP", "FRF", "ITL", "NLG"]  # DM euro area countries
cids_latm = ["BRL", "COP", "CLP", "MXN", "PEN"]  # Latam countries
cids_emea = ["CZK", "HUF", "ILS", "PLN", "RON", "RUB", "TRY", "ZAR"]  # EMEA countries
cids_emas = [
    "CNY",
    "HKD",
    "IDR",
    "INR",
    "KRW",
    "MYR",
    "PHP",
    "SGD",
    "THB",
    "TWD",
]  # EM Asia countries
cids_dm = cids_dmca + cids_dmec
cids_em = cids_latm + cids_emea + cids_emas

cids = sorted(cids_dm + cids_em)
main = [
    "DU02YXRxEASD_NSA",
    "DU02YXRxLEV10_NSA",
    "DU05YXRxEASD_NSA",
    "DU05YXRxLEV10_NSA",
    "DU10YXRxEASD_NSA",
    "DU10YXRxLEV10_NSA",
]

econ = [
    "RYLDIRS05Y_NSA",
    "BXBGDPRATIO_NSA_12MMA",
    "PCREDITGDP_SJA_D1M1ML12",
]  # economic context
mark = [
    "DU02YCRY_NSA",
    "DU02YCRY_VT10",
    "DU05YCRY_NSA",
    "DU05YCRY_VT10",
    "DU10YCRY_NSA",
    "DU10YCRY_VT10",
]  # market links

xcats = main + econ + mark
# Download series from J.P. Morgan DataQuery by tickers

start_date = "2000-01-01"
tickers = [cid + "_" + xcat for cid in cids for xcat in xcats]
print(f"Maximum number of tickers is {len(tickers)}")

# Retrieve credentials

client_id: str = os.getenv("DQ_CLIENT_ID")
client_secret: str = os.getenv("DQ_CLIENT_SECRET")

# Download from DataQuery

with JPMaQSDownload(client_id=client_id, client_secret=client_secret) as downloader:
    start = timer()
    assert downloader.check_connection()
    df = downloader.download(
        tickers=tickers,
        start_date=start_date,
        metrics=["value", "eop_lag", "mop_lag", "grading"],
        suppress_warning=True,
    )
    end = timer()

dfd = df

print("Download time from DQ: " + str(timedelta(seconds=end - start)))
Maximum number of tickers is 570
Downloading data from JPMaQS.
Timestamp UTC:  2023-03-29 15:02:40
Heartbeat successful!
Number of expressions requested: 2280
Requesting data: 100%|███████████████████████████████████████████████████████████████| 114/114 [00:36<00:00,  3.16it/s]
Downloading data: 100%|██████████████████████████████████████████████████████████████| 114/114 [01:36<00:00,  1.19it/s]
Time taken to download data: 	136.74 seconds.
Time taken to convert to dataframe: 	24.16 seconds.
Download time from DQ: 0:02:43.348469

Availability #

cids_exp = sorted(
    list(set(cids) - set(cids_dmec + ["ARS", "PEN", "PHP"]))
)  # cids expected in category panels
msm.missing_in_df(dfd, xcats=main, cids=cids_exp)
Missing xcats across df:  set()
Missing cids for DU02YXRxEASD_NSA:  {'BRL', 'RON'}
Missing cids for DU02YXRxLEV10_NSA:  {'BRL', 'RON'}
Missing cids for DU05YXRxEASD_NSA:  {'BRL', 'RON'}
Missing cids for DU05YXRxLEV10_NSA:  {'BRL', 'RON'}
Missing cids for DU10YXRxEASD_NSA:  {'BRL', 'RON'}
Missing cids for DU10YXRxLEV10_NSA:  {'BRL', 'RON'}

Quantamental indicators of duration volatility are available from the early 2000s for most developed market currencies and some emerging markets. Typically, most emerging market duration volatility series’ are available from the mid-2000s.

For the explanation of currency symbols, which are related to currency areas or countries for which categories are available, please view Appendix 1 .

xcatx = main
cidx = cids_exp

dfx = msm.reduce_df(dfd, xcats=xcatx, cids=cidx)
dfs = msm.check_startyears(
    dfx,
)
msm.visual_paneldates(dfs, size=(18, 4))

print("Last updated:", date.today())
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/db33a629796a69c7a921e722b617c21ee2080e4bd4081fdebcdec47f7c3fc097.png
Last updated: 2023-03-29
xcatx = main
cidx = cids_exp

plot = msm.check_availability(
    dfd, xcats=xcatx, cids=cidx, start_size=(18, 4), start_years=False
)
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/67b5e9bad6db4405f2de356413866814845c7037e585973a6f61d4b7492cf31f.png
xcatx = main
cidx = cids_exp

plot = msp.heatmap_grades(
    dfd,
    xcats=xcatx,
    cids=cidx,
    size=(18, 4),
    title=f"Average vintage grades from {start_date} onwards",
)
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/d9b6ca0e02c97fcf18c6d61ad66482447e7ffea7e9d17d0a1d9a83e98dede611.png
xcatx = main
cidx = cids_exp

msp.view_ranges(
    dfd,
    xcats=xcatx,
    cids=cidx,
    val="eop_lag",
    title="End of observation period lags (ranges of time elapsed since end of observation period in days)",
    start=start_date,
    kind="box",
    size=(16, 4),
)
msp.view_ranges(
    dfd,
    xcats=xcatx,
    cids=cidx,
    val="mop_lag",
    title="Median of observation period lags (ranges of time elapsed since middle of observation period in days)",
    start=start_date,
    kind="box",
    size=(16, 4),
)
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/f1dd45b8ec8405acede0166ea0ecd1bff453ba0e2a5403923df019b6f870cafd.png https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/7a8d68dddcc53398dc60046d36903deece9a478d64a0c9c1f4597fcc9d787486.png

History #

2-year duration volatility #

Average return standard deviations per contract notional have been vastly different across currency areas. Variation in return volatility has been largely proportional to the volatility itself.

xcatx = ["DU02YXRxEASD_NSA"]
cidx = cids_exp

msp.view_ranges(
    dfd,
    xcats=xcatx,
    cids=cidx,
    sort_cids_by="mean",
    start="2000-01-01",
    kind="bar",
    title="Means and standard deviations of 2-year duration volatilities, since 2000",
    size=(16, 8),
)
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/1d376226ab13c5b9a86930762f50589e420cf69dab979d4bd3b827d0708571b8.png
xcatx = ["DU02YXRxEASD_NSA"]
cidx = cids_exp

msp.view_timelines(
    dfd,
    xcats=xcatx,
    cids=cidx,
    start="2000-01-01",
    title="Duration volatility for receivers with 2-year fixed legs",
    cumsum=False,
    ncol=4,
    same_y=False,
    size=(12, 7),
    aspect=1.7,
    all_xticks=True,
)
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/7fc1362dd4ae08eb9e3c54286f8c1271b85fab95a5787f98d501aa577070a4e4.png

Duration volatility has been positively correlated across all country pairs except for (mainly) Turkey and Russia. Turkey’s rates volatility has been the most idiosyncratic across liquid markets.

xcatx = "DU02YXRxEASD_NSA"
cidx = cids_exp

msp.correl_matrix(
    dfd,
    xcats="DU02YXRxEASD_NSA",
    title="Cross-sectional correlations for 2-year duration volatility, since 2000",
    cids=cidx,
    cluster=True,
    size=(20, 14),
)
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/417544d3e34161b91e5d946758c54942308217d654942824fb2a5ff38d4507f6.png

5 and 10-year duration volatility #

Average volatility per unit notional for longer tenors’ returns has been higher, averaging between 300 and above 1500 basis points for the 10-year contracts.

xcatx = ["DU05YXRxEASD_NSA", "DU10YXRxEASD_NSA"]
cidx = cids_exp

msp.view_ranges(
    dfd,
    xcats=xcatx,
    cids=cidx,
    sort_cids_by="mean",
    start="2000-01-01",
    kind="bar",
    title="Means and standard deviations of long-term duration volatilities, since 2000",
    xcat_labels=["5-year", "10-year"],
    size=(16, 8),
)
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/e395fc051da2e8ce652ca53787159143906403f1a81e2f203fbc322b8efba492.png
xcatx = ["DU05YXRxEASD_NSA", "DU10YXRxEASD_NSA"]
cidx = cids_exp

msp.view_timelines(
    dfd,
    xcats=xcatx,
    cids=cidx,
    start="2000-01-01",
    title="Duration volatility for receivers with 5-year and 10-year fixed legs",
    xcat_labels=["5-year", "10-year"],
    cumsum=False,
    ncol=4,
    same_y=False,
    size=(12, 7),
    aspect=1.7,
    all_xticks=True,
)
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/ede24e85d43740e51853d90a5c5d28aa9b8175fcaf7356a8cd678ff24136f36a.png

Leverage ratio #

Required leverage ratios (contract notional to risk capital) for 10% volatility targets averaged between 3 and 19 across currency areas. The cap of 20 has been binding for a range of countries since the 2010s.

xcatx = ["DU02YXRxLEV10_NSA"]
cidx = cids_exp

msp.view_ranges(
    dfd,
    xcats=xcatx,
    cids=cidx,
    sort_cids_by="mean",
    start="2000-01-01",
    kind="bar",
    title="Means and standard deviations of leverage ratios, 2-year contract maturity, since 2000",
    size=(16, 8),
)
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/a6165c5d83ac559aa828aac9922939c31dac96f84cae35535046495703b3700f.png
xcatx = ["DU02YXRxLEV10_NSA"]
cidx = cids_exp

msp.view_timelines(
    dfd,
    xcats=xcatx,
    cids=cidx,
    start="2000-01-01",
    title="2-year IRS position leverage required for 10% annualized volatility target",
    cumsum=False,
    ncol=4,
    same_y=True,
    size=(12, 7),
    aspect=1.7,
    all_xticks=True,
)
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/fe6be20dc0dc69f1b5925ad8eeebdde7ae2e2cbffbbebab362595b44311a07dc.png

Importance #

Empirical Clues #

In duration space, carry does not compensate for volatility. Indeed, there has been a mild tendency for markets with high volatility to pay lower duration carry. This relationship is consistent both before and after 2008 (and indeed 2020), when the volatility series’ were subject to spikes caused by the 2008 financial crisis and the aftermath of the COVID-19 pandemic respectively.

xcatx = ["DU02YCRY_VT10", "DU02YXRxEASD_NSA"]
cidx = list(set(cids_exp) - set(["TRY"]))

cr = msp.CategoryRelations(
    dfd,
    xcats=xcatx,
    cids=cidx,
    freq="M",
    lag=1,
    xcat_aggs=["mean", "mean"],
    start="2000-01-01",
    # years=2,
    xcat_trims=[80, 20],
)
cr.reg_scatter(
    title="Duration carry (2-year tenor) and subsequent volatility, global panel without Turkey, since 2000",
    labels=False,
    coef_box="upper left",
    ylab="Volatility of 2-year duration returns",
    xlab="Duration carry",
    separator=2008,
)
DU02YCRY_VT10 misses: ['BRL', 'RON'].
DU02YXRxEASD_NSA misses: ['BRL', 'RON'].
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/e99bc8e86eede0b642539a63f053ff2b60419feb33d3a39014b64fcb49ff40c8.png
xcatx = ["DU02YCRY_VT10", "DU02YXRxEASD_NSA"]
cidx = list(set(cids_exp) - set(["TRY"]))

cr = msp.CategoryRelations(
    dfd,
    xcats=xcatx,
    cids=cidx,
    freq="M",
    lag=1,
    xcat_aggs=["mean", "mean"],
    start="2000-01-01",
    # years=2,
    xcat_trims=[80, 20],
)
cr.reg_scatter(
    title="Duration carry (2-year tenor) and subsequent volatility, global panel without Turkey, since 2000",
    labels=False,
    coef_box="upper left",
    ylab="Volatility of 2-year duration returns",
    xlab="Duration carry",
    separator=2020,
)
DU02YCRY_VT10 misses: ['BRL', 'RON'].
DU02YXRxEASD_NSA misses: ['BRL', 'RON'].
https://macrosynergy.com/notebooks.build/themes/shock-and-risk-measures/_images/9386a1ff618bc5f7241de2c0c5a92a0e6472cf58a8c4ddbc2b2aa01006a270f1.png

Appendices #

Appendix 1: Currency symbols #

The word ‘cross-section’ refers to currencies, currency areas or economic areas. In alphabetical order, these are AUD (Australian dollar), BRL (Brazilian real), CAD (Canadian dollar), CHF (Swiss franc), CLP (Chilean peso), CNY (Chinese yuan renminbi), COP (Colombian peso), CZK (Czech Republic koruna), DEM (German mark), ESP (Spanish peseta), EUR (Euro), FRF (French franc), GBP (British pound), HKD (Hong Kong dollar), HUF (Hungarian forint), IDR (Indonesian rupiah), ITL (Italian lira), JPY (Japanese yen), KRW (Korean won), MXN (Mexican peso), MYR (Malaysian ringgit), NLG (Dutch guilder), NOK (Norwegian krone), NZD (New Zealand dollar), PEN (Peruvian sol), PHP (Phillipine peso), PLN (Polish zloty), RON (Romanian leu), RUB (Russian ruble), SEK (Swedish krona), SGD (Singaporean dollar), THB (Thai baht), TRY (Turkish lira), TWD (Taiwanese dollar), USD (U.S. dollar), ZAR (South African rand).