christophsax / seasonalbook.content

https://christophsax.github.io/seasonalbook.content/
1 stars 0 forks source link

Real-world transaction data #17

Open andreranza opened 7 months ago

andreranza commented 7 months ago

Taking this is here from an e-mail. This shows real transaction data at a daily frequency. We can see relevant peaks on Wed-Tue. Sun and Sat are missing.

Would it make sense to add this in the trading days chp as part of the introduction? This would make it clear that if we see fewer or less of these days it might have an impact on the final adjustment. Would make sense to make a rough estimate of what's the impact on different scenarios?

library(ggplot2)

trans_df <- 
  tibble::tibble(
    value_date = as.Date(c(
      "2022-07-01", "2022-07-04", "2022-07-05", "2022-07-06", "2022-07-07",
      "2022-07-08", "2022-07-13", "2022-07-14", "2022-07-15", "2022-07-18",
      "2022-07-19", "2022-07-20", "2022-07-21", "2022-07-22", "2022-07-25",
      "2022-07-26", "2022-07-27", "2022-07-28", "2022-07-29", "2022-08-01",
      "2022-08-02", "2022-08-03", "2022-08-04", "2022-08-05", "2022-08-08",
      "2022-08-09", "2022-08-10", "2022-08-11", "2022-08-12", "2022-08-15",
      "2022-08-16", "2022-08-17", "2022-08-18", "2022-08-19", "2022-08-22",
      "2022-08-23", "2022-08-24", "2022-08-25", "2022-08-26", "2022-08-29",
      "2022-08-30", "2022-08-31", "2022-09-01", "2022-09-02", "2022-09-05",
      "2022-09-06", "2022-09-07", "2022-09-08", "2022-09-09", "2022-09-12",
      "2022-09-13", "2022-09-14", "2022-09-15", "2022-09-16", "2022-09-19",
      "2022-09-20", "2022-09-21", "2022-09-22", "2022-09-23", "2022-09-26",
      "2022-09-27", "2022-09-28", "2022-09-29", "2022-09-30"
    )),
    amount = c(
      30293627, 29684302, 18354636, 35183606, 9582177, 14897203, 1069765, 43384861,
      39524015, 86802632, 6614005, 17761052, 8276755, 21152542, 16291322, 7772429,
      20393879, 5318004, 11859141, 23864014, 12376091, 279657, 3614375, 19932634,
      586553, 33552104, 33483075, 8039351, 6629124, 14459099, 161360799, 26694683,
      12940912, 32584637, 23363951, 23351179, 9331648, 5428734, 10499438, 7540658,
      6299517, 25319539, 8195559, 57542928, 31303483, 269582871, 18277812, 39795633,
      36711, 16797389, 20370978, 22465056, 43725288, 73089307, 36169962, 93165179,
      107295392, 69236616, 19283321, 42972503, 61393684, 329600009, 78949695,
      119115555
    ),
    day = ordered(
      c(
        "Fri", "Mon", "Tue", "Wed", "Thu", "Fri", "Wed", "Thu", "Fri", "Mon", "Tue",
        "Wed", "Thu", "Fri", "Mon", "Tue", "Wed", "Thu", "Fri", "Mon", "Tue", "Wed",
        "Thu", "Fri", "Mon", "Tue", "Wed", "Thu", "Fri", "Mon", "Tue", "Wed", "Thu",
        "Fri", "Mon", "Tue", "Wed", "Thu", "Fri", "Mon", "Tue", "Wed", "Thu", "Fri",
        "Mon", "Tue", "Wed", "Thu", "Fri", "Mon", "Tue", "Wed", "Thu", "Fri", "Mon",
        "Tue", "Wed", "Thu", "Fri", "Mon", "Tue", "Wed", "Thu", "Fri"
      ),
      levels = c("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat")
    ),
  )

trans_df |>
  ggplot(aes(x = value_date, y = amount)) +
  geom_line() +
  scale_x_date(date_breaks = 'day', date_labels = '%Y-%m-%d, %a') +
  theme_minimal() +
  theme(
    panel.grid.minor.x = element_blank(),
    axis.text.x = element_text(angle = 90, size = rel(0.6), vjust = -0.01)
  )

Created on 2024-01-17 with reprex v2.0.2

christophsax commented 7 months ago

Thanks. We don't cover daily data for the moment. Perhaps one day in one of the final chapters to the book. Also, we need around 10 years of data for a reasonable adjustment. I guess we park this for the moment.