Impact of Trump’s Win on Financial ETFs

Donald Trump’s recent election win has sparked a rapid surge in sectors like Financials. Barclays calls this a clear reflection of the “Trump playbook,” trends seen in 2016. According to this, the iShares Global Financials ETF seems to have room to continue the uptrend.

Source code:

library(tidyverse)
library(tidyquant)
library(timetk)

#iShares Global Financials ETF (IXG) Stock Price
df_ixg <- 
  tq_get("IXG") %>% 
  select(date, ixg = close)


#2016 term
df_ixg_2016 <- 
  df_ixg %>% 
  filter(date >= as.Date("2016-10-29"),
         date <= as.Date("2016-12-08")) %>% 
  mutate(ixg = round(ixg / subset(., date=="2016-11-08")[["ixg"]] * 100),
         symbol = "2016") %>% 
  mutate(
    days_from_election = as.integer(date - as.Date("2016-11-08")),
    t_label = ifelse(
      days_from_election == 0,
      "t",
      ifelse(
        days_from_election > 0,
        paste0("t+", days_from_election),
        paste0("t", days_from_election)
      )
    )
  ) %>% 
  select(t_label, symbol, ixg) %>% 
  mutate(t_label = factor(t_label, levels = .$t_label))


#2024 term
df_ixg_2024 <- 
  df_ixg %>% 
  filter(date >= as.Date("2024-10-26"),
         date <= as.Date("2024-11-13")) %>% 
  mutate(ixg = round(ixg / subset(., date=="2024-11-05")[["ixg"]] * 100),
         symbol = "2024") %>% 
  mutate(
    days_from_election = as.integer(date - as.Date("2024-11-05")),
    t_label = ifelse(
      days_from_election == 0,
      "t",
      ifelse(
        days_from_election > 0,
        paste0("t+", days_from_election),
        paste0("t", days_from_election)
      )
    )
  ) %>% 
  select(t_label, symbol, ixg) %>% 
  mutate(t_label = factor(t_label, levels = .$t_label))

#Merging the datasets
df_merged <- 
  bind_rows(
    df_ixg_2024,
    df_ixg_2016
  )


#Plot
df_merged %>% 
  ggplot(aes(t_label, ixg, col = symbol)) +
  geom_line(linewidth = 1.5, aes(group = symbol)) +
  ggrepel::geom_text_repel(
    data = . %>% slice_tail(n = 1, by = symbol),
    aes(label = ixg),
    hjust = 1, 
    vjust = 1,
    nudge_x = 0.5,
    size = 8,
    fontface = "bold", 
    family = "Roboto Slab"
  ) +
  scale_color_manual(
    values = c("2024" ="darkorange","2016"  = "navyblue")
  ) +
  scale_x_discrete(expand = expansion(mult = c(.1, .1)),
                   breaks = c(as.factor("t-8"),
                              as.factor("t"),
                              as.factor("t+8"),
                              as.factor("t+30"))) +
  geom_vline(xintercept = "t", 
             size = 1.5, 
             linetype= "dashed", 
             color = "red") +
  labs(
    x = element_blank(), 
    y = element_blank(),
    subtitle = "<span style = 'color:red;'>US Election Date</span><br>Daily Index: (t = 100)",
    title = "iShares Global Financials ETF<br><span style = 'color:darkorange;'>2024</span> vs. <span style = 'color:navyblue'>2016</span>"
  ) +
  theme_minimal(
    base_family = "Roboto Slab"
  ) +
  theme(
    panel.grid = element_blank(),
    panel.grid.major.x = element_line(linetype = "dashed", color = "gray"),
    panel.grid.major.y = element_line(linetype = "dashed", color = "gray"),
    plot.subtitle = ggtext::element_markdown(face = "bold",size = 18),
    plot.title = ggtext::element_markdown(face = "bold", size = 20),
    axis.text = element_text(face = "bold", size = 18),
    plot.background = element_rect(fill = "azure", color = "azure"),
    legend.position = "none"
  )

One response to “Impact of Trump’s Win on Financial ETFs”

  1. Jeff Eicher Avatar
    Jeff Eicher

    Thanks for sharing.

    I had to include library(ggtext) and comment out the roboto font to get the code to work.

    It’s been over 30 days…how well did this prediction perform?

    Like

Leave a reply to Jeff Eicher Cancel reply

I’m Selcuk Disci

The DataGeeek focuses on machine learning, deep learning, and Generative AI in data science using financial data for educational and informational purposes.

Let’s connect