Learn R Programming

PortfolioTesteR (version 0.1.4)

load_mixed_symbols: Load Mixed Symbols Including VIX

Description

Handles loading regular stocks and VIX together, with VIX loaded separately without auto-update to avoid issues.

Usage

load_mixed_symbols(
  db_path,
  symbols,
  start_date,
  end_date,
  frequency = "weekly",
  use_adjusted = TRUE
)

Value

data.table with all symbols properly loaded

Arguments

db_path

Path to SQLite database

symbols

Character vector including regular stocks and optionally "VIX"

start_date

Start date for data

end_date

End date for data

frequency

Data frequency (default: "weekly")

use_adjusted

Use adjusted prices (default: TRUE)

Examples

Run this code
if (FALSE) { # requireNamespace("RSQLite", quietly = TRUE) && file.exists("sp500.db")
# \donttest{
mixed <- load_mixed_symbols(
  db_path  = "sp500.db",
  symbols  = c("AAPL", "MSFT", "VIX"),
  start_date = "2020-01-01",
  end_date   = "2020-12-31",
  frequency  = "weekly"
)
head(mixed)
# }
}

Run the code above in your browser using DataLab