IT博客汇
  • 首页
  • 精华
  • 技术
  • 设计
  • 资讯
  • 扯淡
  • 权利声明
  • 登录 注册

    Trend-Anomaly Analysis: Ethereum’s Pectra Upgrade

    Selcuk Disci发表于 2025-05-07 13:44:37
    love 0
    [This article was first published on DataGeeek, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
    Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

    The Pectra upgrade for Ethereum could catalyze the expected uptrend despite the reduced risk appetite caused by the Tariff War between the US and China.

    Based on the trend-anomaly analysis, this suggests the potential for a 40% increase in the near term.

    library(tidyverse)
    library(tidyquant)
    library(timetk)
    
    #Ethereum (ETH-USD)
    df_eth <- 
      tq_get("ETH-USD") %>% 
      select(date, close)
    
    #Anomaly Plot
    df_eth %>%
      filter(date >= last(date) - months(12)) %>% 
      anomalize(date, close) %>% 
      plot_anomalies(date, 
                     .line_size = 1,
                     .line_type = 1,
                     .interactive = FALSE,
                     .title = "Trend-<span style= 'color:red;'>Anomaly</span> Chart of Ethereum ETH") +
      ggrepel::geom_text_repel(
        data = . %>%  slice_tail(n = 1),
        aes(label = paste0("$",format(round(recomposed_l2, 0), big.mark = ",")), 
            x= date,
            y = recomposed_l2),
        hjust = 1, 
        vjust = .5,
        nudge_x = 0.5,
        fontface = "bold", 
        family = "Roboto Slab",
        size = 6,
        color = "dimgray",
        segment.color = NA
      ) +
      ggrepel::geom_text_repel(
        data = . %>%  slice_tail(n = 1),
        aes(label = paste0("$",format(round(observed , 0), big.mark = ",")), 
            x= date,
            y = observed),
        hjust = 1, 
        vjust = .5,
        nudge_x = 0.5,
        fontface = "bold", 
        family = "Roboto Slab",
        size = 6,
        color = "black",
        segment.color = NA
      ) +
      geom_line(size = 0.2) +
      scale_y_continuous(labels = scales::label_currency()) +
      scale_x_date(expand = expansion(mult = c(.1, .25)),
                   labels = scales::label_date("%b %Y")) +
      theme_minimal(base_family = "Roboto Slab", base_size = 18) +
      theme(legend.position = "none",
            panel.grid = element_blank(),
            axis.text = element_text(face = "bold"),
            #axis.text.x = element_text(angle = 60, hjust = 1, vjust = 1),
            plot.background = element_rect(fill = "azure", color = "azure"),
            panel.grid.major.x = element_line(linetype = "dashed", color = "gray"),
            panel.grid.major.y = element_line(linetype = "dashed", color = "gray"),
            plot.title = ggtext::element_markdown(face = "bold", hjust = 0.5))
    
    To leave a comment for the author, please follow the link and comment on their blog: DataGeeek.

    R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
    Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
    Continue reading: Trend-Anomaly Analysis: Ethereum’s Pectra Upgrade


沪ICP备19023445号-2号
友情链接