data-raw/DATASET.R

# set up folder like that:
# usethis::use_data_raw(name = "DATASET")

## code to prepare `DATASET` dataset goes here

library(magrittr)


date_seq <- tradr::seq_date(as.Date("2007-01-01"), as.Date("2025-03-22"))

indexes <- read.csv("./data-raw/indexes.csv",
                    stringsAsFactors = FALSE, na.strings = c(NA, ""))


investment_universe <- readRDS("./data-raw/investment_universe.rds")
stock_universe <- readRDS("./data-raw/stock_universe.rds")
index_components <- readRDS("./data-raw/index_components.rds")

etf_universe <- readRDS("./data-raw/etf_universe.rds")
crypto_universe <- readRDS("./data-raw/crypto_universe.rds")

isin_deprecated <- read.csv("../strategy_development/01_stock_universe/@data/discontinued.csv",
                            na.strings = c(NA, ""), header = FALSE) %>%
    `colnames<-`(c("old", "new"))


# Download Historical Data ------------------------------------------------

world_price <- tradr::get_prices("3193857", src = "onvista_bx") %>%
    tradr::fix_OHLC()



# Save Datasets -----------------------------------------------------------

usethis::use_data(date_seq,
                  indexes,
                  world_price,
                  investment_universe,
                  stock_universe,
                  etf_universe,
                  crypto_universe,
                  isin_deprecated,
                  index_components,
                  internal = TRUE,
                  overwrite = TRUE)
rengelke/tradr documentation built on Jan. 2, 2022, 2:03 p.m.