import pandas as pd
import numpy as np
from IPython.display import Markdown
from tulip.data.bloomberg import BloombergClient as bb
from tulip.data.dataquery import get_us_otr_yields
from tulip.plots import plot_lines, plot_line, switch_trace_to_secondary_axis
from dotenv import load_dotenv
from tulip.data.macrosynergy import get_downloader
load_dotenv()
import macrosynergy.panel as msp
xcats = [
"GNBRGDP_NSA_3MMA",
"GNBRGDP_NSA_6MMA",
"GNBRGDP_NSA_D3M3ML12",
"GNBRGDP_NSA_D6M6ML12",
]
kate_cids = ["USD", "DEM", "GBP", "JPY", "AUD", "CAD", "NZD", "SEK"]
import os
g20_tickers = [cid + "_" + xcat for cid in kate_cids for xcat in xcats]
JPMaQSDownloader = get_downloader()
with JPMaQSDownloader as dq:
df = dq.download(
tickers=g20_tickers,
start_date="2000-01-01",
suppress_warning=True,
metrics=["all"],
show_progress=True,
)Government Requirement Ratios¶
Evolution of Government Borrowing Requirements¶
3mma and 6mma of government borrowing requirements as a percentage of GDP¶
msp.view_timelines(
df,
xcats=["GNBRGDP_NSA_3MMA", "GNBRGDP_NSA_6MMA"],
cids=kate_cids,
ncol=3,
cumsum=False,
start="2015-01-01",
same_y=True,
all_xticks=True,
# title="Cumulative FX returns",
# xcat_labels=["FX returns", "FX forward return for 10% vol target"],
)Since 2024
msp.view_timelines(
df,
xcats=["GNBRGDP_NSA_3MMA", "GNBRGDP_NSA_6MMA"],
cids=kate_cids,
ncol=3,
cumsum=False,
start="2024-01-01",
same_y=True,
all_xticks=True,
# title="Cumulative FX returns",
# xcat_labels=["FX returns", "FX forward return for 10% vol target"],
)3mma and 6mma of government borrowing requirements as a percentage of GDP, along with their year-over-year changes.¶
msp.view_timelines(
df,
xcats=["GNBRGDP_NSA_D3M3ML12", "GNBRGDP_NSA_D6M6ML12"],
cids=kate_cids,
ncol=3,
cumsum=False,
start="2015-01-01",
same_y=True,
all_xticks=True,
# title="Cumulative FX returns",
# xcat_labels=["FX returns", "FX forward return for 10% vol target"],
)Since 2024:
msp.view_timelines(
df,
xcats=["GNBRGDP_NSA_D3M3ML12", "GNBRGDP_NSA_D6M6ML12"],
cids=kate_cids,
ncol=3,
cumsum=False,
start="2024-01-01",
same_y=True,
all_xticks=True,
# title="Cumulative FX returns",
# xcat_labels=["FX returns", "FX forward return for 10% vol target"],
)from tulip_mania.notebook_related import notebook_updated
notebook_updated()