Real effective appreciation #

This category group contains real-time versions of appreciation metrics. They are based on vintages of J.P. Morgan’s CPI-based effective exchange rate measures and estimates of deflators for recent weeks. Estimation is needed due to the publication lag of consumer price indices relative to nominal exchange rates.

Short-term real appreciation #

Ticker : REER_NSA_P1W4WL1

Label : Real effective appreciation, % of the latest week over previous 4 weeks.

Definition : Real effective exchange rate index, real-time, using estimates of recent CPIs, % increase of latest week (5 trading days) over previous 4 weeks (5-trading day periods).

Notes :

  • J.P. Morgan effective exchange rates are trade-weighted indices, focusing on the impact of currency fluctuations via international trade linkages. For a primer on J.P. Morgan effective exchange rates, click here .

  • Real effective exchange rates take into account the role of high, rising, and often widely divergent inflation rates in offsetting or amplifying the economic impact of swings in bilateral nominal exchange rates. In the present case, real exchange rates use headline CPI to make the adjustment.

  • Time series’ of real effective exchange rate indices are continuously revised and updated as new CPI data is released for recent months. The real-time quantamental appreciation measure is calculated based on concurrent vintages and, thus, uses a prediction of CPIs for the latest month(s), based on a trend extrapolation formula.

  • The impact of revisions on short-term real effective appreciation is naturally much stronger than on medium-term appreciation measures.

Medium-term real appreciation #

Ticker : REER_NSA_P1M12ML1

Label : Real effective appreciation, % of the latest month over previous 12 months.

Definition : Real effective exchange rate index, real-time, using estimates of recent CPIs, % increase of latest month (21 trading days) over the previous 12 months (21 trading day periods).

Notes :

  • J.P. Morgan effective exchange rates are trade-weighted indices, focusing on the impact of currency fluctuations via international trade linkages. For a primer on J.P. Morgan effective exchange rates, click here .

  • Real effective exchange rates take into account the role of high, rising, and often widely divergent inflation rates in offsetting or amplifying the economic impact of swings in bilateral nominal exchange rates. In the present case, they use headline CPI to make the adjustment.

  • Time series’ of real effective exchange rate indices are continuously revised and updated as new CPI data is released for recent months. The real-time quantamental appreciation measure is calculated based on concurrent vintages and, thus, uses a prediction of CPIs for the latest month(s), based on a trend extrapolation formula.

  • This medium-term measure is particularly relevant as a predictor of the % changes in nominal indicators (such as consumer prices indices) over a year ago.

Longer-term real appreciation #

Ticker : REER_NSA_P1M60ML1

Label : Real effective appreciation, % of the latest month over previous 5 years.

Definition : Real effective exchange rate index, real-time, using estimates of recent CPIs, % increase of latest month (21 trading days) over the previous 5 years.

Notes :

  • J.P. Morgan effective exchange rates are trade-weighted indexes, focusing on the impact of currency fluctuations via international trade linkages. For a primer on J.P. Morgan effective exchange rates click here .

  • Real effective exchange rates take into account the role of high, rising, and often widely divergent inflation rates in offsetting or amplifying the economic impact of swings in bilateral nominal exchange rates. In the present case, they use headline CPI to make the adjustment.

  • Time series’ of real effective exchange rate indices are continuously revised and updated as new CPI data for recent months are being released. The real-time quantamental appreciation measure is calculated based on concurrent vintages and, thus, uses a prediction of CPIs for the latest month(s), based on a trend extrapolation formula.

  • This long-term measure is particular relevant for capturing the impact of currency appreciation on competitiveness and investment conditions.

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.

# 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 = ["REER_NSA_P1W4WL1", "REER_NSA_P1M12ML1", "REER_NSA_P1M60ML1"]

econ = ["FXCRR_VT10", "RIR_NSA"]  # economic context

mark = [
    "EQXR_NSA",
    "FXXR_NSA",
    "FXXRHvGDRB_NSA",
    "FXXR_VT10",
    "FXTARGETED_NSA",
    "FXUNTRADABLE_NSA",
]  # 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()
    df = downloader.download(
        tickers=tickers,
        start_date=start_date,
        end_date="2023-05-20",
        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 407
Downloading data from JPMaQS.
Timestamp UTC:  2023-07-19 14:47:31
Connection successful!
Number of expressions requested: 1628
Download time from DQ: 0:02:43.507014

Availability #

cids_exp = sorted(list(set(cids) - set(cids_dmec)))  # cids expected in category panels
msm.missing_in_df(dfd, xcats=main, cids=cids_exp)
Missing xcats across df:  []
Missing cids for REER_NSA_P1M12ML1:  []
Missing cids for REER_NSA_P1M60ML1:  []
Missing cids for REER_NSA_P1W4WL1:  []

Quantamental indicators of real effective appreciation are available by 2000 for all presented currency areas.

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, 2))

print("Last updated:", date.today())
https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/ae6aed812744c317161d5ef1459e29c78fcb0e6693168111eda31a76b70a4aa2.png
Last updated: 2023-07-19
xcatx = main
cidx = cids_exp

plot = msm.check_availability(
    dfd, xcats=xcatx, cids=cidx, start_size=(18, 2), start_years=False
)
https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/56822a30130f7a1ce94f91a4bdfb3ce260961d8b6597aac1a1a4bff7d847fa1b.png

Since the real effective appreciation indicators are based on J.P. Morgan estimates, all vintages are Grade 2.

xcatx = main
cidx = cids_exp

plot = msp.heatmap_grades(
    dfd,
    xcats=xcatx,
    cids=cidx,
    size=(18, 2),
    title=f"Average vintage grades from {start_date} onwards",
)
https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/265c309ea64830ff630bbf855ed069a4d7beb85054e99ac2a5df76db0cc3d25a.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/financial-conditions/_images/1db7dafbb5941dbfc7b115e6891fbbc73068728fc394192b9f2267286c632780.png https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/8ef6111f07fcaa2a41c4a1a86584e060c3f2f98fef77e4afe0b9dfbbe87e2d0f.png

History #

Short-term real appreciation #

Short-term real effective exchange rate swings have been widest in large EM countries. Some Asian economies with large external surpluses and exchange rate management have posted the smallest fluctions.

Short-term real appreciation or depreciation has occasionally exceeded 10% in EM countries. This implies that short-term exchange rate swings can cause a significant changes in economic conditions and can become a significant factor of economic divergences.

xcatx = ["REER_NSA_P1W4WL1"]
cidx = cids_exp

msp.view_ranges(
    dfd,
    xcats=xcatx,
    cids=cidx,
    sort_cids_by="std",
    start=start_date,
    kind="box",
    title="Boxplots of short-term real effective exchange rate appreciation, % over 4 weeks ago, since 2000",
    size=(16, 8),
)
https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/73bc2d73ffefecebd412019396cba0ce7a90efa07a4d91fea326dcf33819ad01.png
xcatx = ["REER_NSA_P1W4WL1"]
cidx = cids_exp

msp.view_timelines(
    dfd,
    xcats=xcatx,
    cids=cidx,
    start=start_date,
    title="Real effective exchange rate appreciation, % of the latest week over previous 4 weeks",
    title_adj=1.03,
    title_xadj=0.5,
    title_fontsize=27,
    legend_fontsize=17,
    ncol=4,
    same_y=False,
    size=(12, 7),
    aspect=1.7,
    all_xticks=True,
)
https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/dc96e0c34d0f7b2f5683faeac355c76d18e521721d659af258256382c10e7bce.png

For smaller countries, real effective exchange rate changes are predominantly against the US dollar, the Euro and the Chinese yen. This explains why the latter three currency areas post real currency trends that are negatively correlated with most other currency areas. Put simply, short-term real effective currency shifts often entail economic divergences between small and large currency areas.

xcatx = "REER_NSA_P1W4WL1"
cidx = cids_exp

msp.correl_matrix(
    dfd,
    xcats=xcatx,
    cids=cidx,
    size=(20, 14),
    title="Cross-sectional correlations of short-term real effective exchange rate appreciation, since 2000",
    cluster=True,
)
https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/b2bb7148cdd8eb427bd4b99a0a692d981064fe81898c67433de7d745f9695711.png

Medium-term real appreciation #

Medium-term appreciation rates also display vast differences across currencies. The swing frequency here corresponds to economic “minicycles”.

xcatx = ["REER_NSA_P1M12ML1"]
cidx = cids_exp

msp.view_ranges(
    dfd,
    xcats=xcatx,
    cids=cidx,
    sort_cids_by="std",
    start=start_date,
    title="Boxplots of medium-term real effective exchange rate appreciation, % over a year ago, since 2000",
    kind="box",
    size=(16, 8),
)
https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/070ff8e35dc0f480815f43ab6ff4eba4746ccb3efbb7786a480edecaf32643f0.png
xcatx = ["REER_NSA_P1M12ML1"]
cidx = cids_exp

msp.view_timelines(
    dfd,
    xcats=xcatx,
    cids=cidx,
    start=start_date,
    title="Real effective appreciation, % of the latest month over previous 12 months",
    title_fontsize=27,
    legend_fontsize=17,
    title_adj=1.02,
    title_xadj=0.51,
    ncol=4,
    same_y=False,
    size=(12, 7),
    aspect=1.7,
    all_xticks=True,
)
https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/92ed1bd4bd4c5aef6bbb58f59b148297ad9270548804a7a3674bb1487ac45c2c.png

Long-term real appreciation #

The long-term real appreciation metric has displayed the widest fluctuations in some large EM countries. The frequency of these swings correpond to standard business cycle lengths.

xcatx = ["REER_NSA_P1M60ML1"]
cidx = cids_exp

msp.view_ranges(
    dfd,
    xcats=xcatx,
    cids=cidx,
    sort_cids_by="std",
    start=start_date,
    title="Boxplots of long-term real effective exchange rate appreciation, % over 5 years ago, since 2000",
    kind="box",
    size=(16, 8),
)
https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/c49bf048153f7004f53c664061566e91eba966f5b8b409e82d66ed85ac232155.png
xcatx = ["REER_NSA_P1M60ML1", "REER_NSA_P1M12ML1"]
cidx = cids_exp

msp.view_timelines(
    dfd,
    xcats=xcatx,
    cids=cidx,
    start=start_date,
    title="Long and medium term real effective appreciation",
    title_adj=1.03,
    title_fontsize=27,
    legend_fontsize=17,
    title_xadj=0.43,
    label_adj=0.075,
    xcat_labels=["Long term (% over 5 years ago)", "Medium term (% over a year ago)"],
    ncol=4,
    same_y=False,
    size=(12, 7),
    aspect=1.7,
    all_xticks=True,
)
https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/0f0902fa1e0d2f44664c2ee9ca74fceddeebd8b35341d521f5ad6a170bd94761.png

Importance #

Empirical clues #

Historically, there has been some evidence of a negative long-term relation between real effective currency strength and subsequent medium-term FX returns.

dfb = dfd[dfd["xcat"].isin(["FXTARGETED_NSA", "FXUNTRADABLE_NSA"])].loc[
    :, ["cid", "xcat", "real_date", "value"]
]
dfba = (
    dfb.groupby(["cid", "real_date"])
    .aggregate(value=pd.NamedAgg(column="value", aggfunc="max"))
    .reset_index()
)
dfba["xcat"] = "FXBLACK"
fxblack = msp.make_blacklist(dfba, "FXBLACK")
fxblack
{'BRL': (Timestamp('2012-12-03 00:00:00'), Timestamp('2013-09-30 00:00:00')),
 'CHF': (Timestamp('2011-05-02 00:00:00'), Timestamp('2016-06-30 00:00:00')),
 'CNY': (Timestamp('2000-01-03 00:00:00'), Timestamp('2023-05-19 00:00:00')),
 'CZK': (Timestamp('2014-01-01 00:00:00'), Timestamp('2017-07-31 00:00:00')),
 'ILS': (Timestamp('2000-01-03 00:00:00'), Timestamp('2005-12-30 00:00:00')),
 'INR': (Timestamp('2000-01-03 00:00:00'), Timestamp('2004-12-31 00:00:00')),
 'MYR_1': (Timestamp('2000-01-03 00:00:00'), Timestamp('2007-11-30 00:00:00')),
 'MYR_2': (Timestamp('2018-07-02 00:00:00'), Timestamp('2023-05-19 00:00:00')),
 'PEN': (Timestamp('2021-07-01 00:00:00'), Timestamp('2021-07-30 00:00:00')),
 'RON': (Timestamp('2000-01-03 00:00:00'), Timestamp('2005-11-30 00:00:00')),
 'RUB_1': (Timestamp('2000-01-03 00:00:00'), Timestamp('2005-11-30 00:00:00')),
 'RUB_2': (Timestamp('2022-02-01 00:00:00'), Timestamp('2023-05-19 00:00:00')),
 'SGD': (Timestamp('2000-01-03 00:00:00'), Timestamp('2023-05-19 00:00:00')),
 'THB': (Timestamp('2007-01-01 00:00:00'), Timestamp('2008-11-28 00:00:00')),
 'TRY_1': (Timestamp('2000-01-03 00:00:00'), Timestamp('2003-09-30 00:00:00')),
 'TRY_2': (Timestamp('2020-01-01 00:00:00'), Timestamp('2023-05-19 00:00:00'))}
xcatx = ["REER_NSA_P1M60ML1", "FXXR_NSA"]
cidx = list(set(cids_exp) - set(["USD"]))

cr = msp.CategoryRelations(
    dfd,
    xcats=xcatx,
    cids=cidx,
    freq="Q",
    lag=1,
    xcat_aggs=["last", "sum"],
    fwin=1,
    blacklist=fxblack,
    start="2000-01-01",
)

cr.reg_scatter(
    title="Real long-term appreciation and subsequent quarterly FX returns since 2000",
    labels=False,
    prob_est="map",
    coef_box="upper right",
    ylab="Quarterly FX forward return",
    xlab="Estimated long-term real appreciation (latest month, % over previous 5 years)",
)
https://macrosynergy.com/notebooks.build/themes/financial-conditions/_images/eeab92bcb80b9d885ab5a128fa4a971ad1f6653161f0ecb10b174dfa77fed6c9.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).