Created
May 8, 2022 13:54
-
-
Save jkr216/d6c11d18a7e86b0b330b9c1c0c7228d2 to your computer and use it in GitHub Desktop.
Fed Balance Sheet QT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fed_assets_on_bs <- | |
"WALCL" %>% | |
tq_get(get = "economic.data") %>% | |
summarise_by_time( | |
.date_var = date, | |
.by = "months", | |
monthly_assets = mean(price) | |
) | |
fed_assets_on_bs %>% | |
future_frame( | |
.date_var = date, | |
.length_out = 31, | |
.bind_data = T | |
) %>% | |
mutate(monthly_assets = monthly_assets * 1000000) %>% | |
fill(monthly_assets, .direction = "down") %>% | |
mutate( | |
months_taper = (interval(date, today()) %/% months(1) * -1) + 1, | |
future_monthly_assets = | |
case_when( | |
date >= "2022-06-01" & date <= "2022-08-01" ~ | |
monthly_assets - (47500000000 * months_taper), | |
date > "2022-08-01" ~ monthly_assets - (95000000000 * months_taper), | |
T ~ monthly_assets), | |
taper = date > "2022-06-01" | |
) %>% | |
ggplot(aes(x = date, y = future_monthly_assets, color = taper, linetype = taper)) + | |
geom_line(show.legend = F) + | |
geom_text_repel(aes(label = dollar(future_monthly_assets, | |
scale = 1/1000000000000, | |
suffix = "T")), | |
data = . %>% filter(future_monthly_assets == max(future_monthly_assets)), | |
show.legend = F, | |
direction = "y", | |
nudge_y = 500000000) + | |
geom_text_repel(aes(label = dollar(future_monthly_assets, | |
scale = 1/1000000000000, | |
suffix = "T")), | |
data = . %>% filter(date == max(date)), | |
show.legend = F, | |
direction = "y", | |
nudge_y = -500000000) + | |
scale_y_continuous(labels = dollar_format(scale = 1/1000000000000, | |
suffix = "T"), | |
breaks = pretty_breaks(10), | |
limits = c(2000000000000, 10000000000000)) + | |
scale_x_date(date_breaks = "1 year", | |
date_labels = "%Y") + | |
theme_minimal() + | |
theme(plot.title = element_text(hjust = .5)) + | |
labs(x = "", y = "", title = "Fed Balance Sheet According to Planned QT", | |
caption = "Source: Fred Data and Author Calcs based on FOMC guidance") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment