Directional risk basket returns #
The category group contains daily returns of directional risk asset baskets for three asset classes - credit, equity and FX - as well as a global composite.
The main purpose of generic risk basket returns is to serve as a benchmark for the correlation of various financial contracts with global risk market performance and for the calculation of relative returns of financial contracts versus a global market proxy.
Directional risk basket returns #
Ticker : DRBXR_NSA
Label : Risk basket return, in % of notional.
Definition : Return on global asset class or composite (directional) basket of contracts across asset classes, % of notional.
Notes :
-
The global directional risk basket and its constituent asset class baskets are sets of liquid contracts whose performance metrics are good proxies for key market segments, formed by macro criteria. Rebalancing is monthly-based on either fixed or inverse volatility weights. Inverse volatility weights are based on exponential lookback windows of daily returns with a half-life of 11 days.
-
If a contract or composite is missing or untradable within a basket, the weights are transferred to the available contracts to produce a long, smooth, history. Thus, the assumption is that if a contract is missing, the basket is formed by the remaining available contracts.
-
The global equity index future basket (GEQ) is a fixed-weighted composite of Standard and Poor’s 500 Composite (40%), EURO STOXX 50 (25%), Nikkei 225 Stock Average (10%) FTSE 100 (10%), and Hang Seng China Enterprises (15%).
-
The global credit index (GCR) is an inverse volatility-weighted basket of CDX and iTraxx investment-grade and high-yield indices for the U.S. and the euro area.
-
The global currency basket (GFX) focuses on small, emerging market and commodity currencies (excluding pegs) and is an inverse volatility-weighted composite of 1-month forward shorts in USD or EUR against AUD, INR, KRW, NOK, NZD, PLN, RUB, SEK, TRY, ZAR. See Appendix 1 for the explanation of currency symbols.
-
The global directional risk basket (GLB) is a volatility-weighted composite of the above 3 global asset class baskets. For older history where credit or currency baskets are not available, the remaining constituents have been used for convenience.
Imports #
Only the standard Python data science packages and the specialized
macrosynergy
package are needed.
import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import math
import json
import yaml
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.
# Define cross sections (currency tickers)
cids = ["GCR", "GEQ", "GFX", "GLB"]
# Define quantamental indicators (category tickers)
main = ["DRBXR_NSA"]
econ = [] # economic context
mark = ["DRBCRR_NSA", "DRBCRY_NSA"] # market links
xcats = main + econ + mark
# Download series from J.P. Morgan DataQuery by tickers
start_date = "1990-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,
show_progress=True,
)
end = timer()
dfd = df
print("Download time from DQ: " + str(timedelta(seconds=end - start)))
Maximum number of tickers is 12
Downloading data from JPMaQS.
Timestamp UTC: 2023-09-06 12:55:20
Connection successful!
Number of expressions requested: 48
Requesting data: 100%|███████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 3.26it/s]
Downloading data: 100%|██████████████████████████████████████████████████████████████████| 3/3 [00:16<00:00, 5.60s/it]
Download time from DQ: 0:00:20.580780
Availability #
cids_exp = cids # cids expected in category panels
msm.missing_in_df(dfd, xcats=main, cids=cids_exp)
Missing xcats across df: []
Missing cids for DRBXR_NSA: []
The broad global directional risk basket series only start in 2001. Older returns exclude credit default swaps (prior to 2001) and FX forwards (prior to 1993).
The cross section identifiers refer to the global
-
CDS index basket (GCR),
-
equity index future basket (GEQ),
-
small, EM and commodity currency basket (GFX), and
-
cross-asset directional risk basket (GLB).
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, 1))
print("Last updated:", date.today())
Last updated: 2023-09-06
xcatx = main
cidx = cids_exp
plot = msm.check_availability(
dfd, xcats=xcatx, cids=cidx, start_size=(18, 1), start_years=False
)
xcatx = main
cidx = cids_exp
plot = msp.heatmap_grades(
dfd,
xcats=xcatx,
cids=cidx,
size=(18, 1),
title=f"Average vintage grades from {start_date} onwards",
)
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),
)
History #
Directional risk basket returns #
Since the baskets are not volatility-targeted, they display different variances and long-term returns, in dependence of the characteristics of the asset class (e.g. currencies are generally less correlated) and the number of contracts traded in the basket.
xcatx = ["DRBXR_NSA"]
cidx = cids_exp
msp.view_ranges(
dfd,
xcats=xcatx,
cids=cidx,
sort_cids_by="std",
start="2001-01-01",
title="Boxplots of risk basket returns, since 2001",
kind="box",
size=(16, 8),
)
xcatx = ["DRBXR_NSA"]
cidx = cids_exp
msp.view_timelines(
dfd,
xcats=xcatx,
cids=cidx,
start=start_date,
title="Cumulative global risk basket returns, % of notional",
title_adj=1.05,
title_xadj=0.535,
cumsum=True,
ncol=2,
same_y=True,
size=(12, 7),
aspect=1.7,
all_xticks=False,
)
Naturally, all directional risk baskets have been positively correlated (since 2001), with the FX correlations less substantial.
xcatx = "DRBXR_NSA"
cidx = cids_exp
msp.correl_matrix(
dfd,
xcats=xcatx,
cids=cidx,
start=start_date,
title="Cross-sectional correlations for risk basket returns, since 2001",
size=(10, 7),
)
Importance #
Research links #
“The gradual information diffusion hypothesis…suggests that information spreads gradually across asset markets, to explain the role of speculator activity in the cross-asset return predictability of foreign exchange (FX) market strategies.” Hasselgren, Peltomäkia and Graham
Empirical clues #
The relation between carry - defined as the return for unchanged prices - and subsequent monthly returns has historically (since 2001) been positive for the credit and equity markets but negative for FX markets.
xcatx = ["DRBCRR_NSA", "DRBXR_NSA"]
cidx = cids_exp
cr = msp.CategoryRelations(
dfd,
xcats=xcatx,
cids=cidx,
freq="M",
lag=1,
xcat_aggs=["last", "sum"],
# fwin=1,
start="2001-01-01",
)
cr.reg_scatter(
title="Risk baskets (real) carry, end of month, and subsequent monthly cumulative returns",
# coef_box="lower right",
xlab="Basket real carry ",
ylab="Basket return",
reg_robust=True,
separator="cids",
)
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).