View source: R/data_adapters.R
| sql_adapter | R Documentation |
Loads stock price data from SQLite database with automatic frequency conversion.
sql_adapter(
db_path,
symbols,
start_date = NULL,
end_date = NULL,
auto_update = TRUE,
frequency = "daily"
)
db_path |
Path to SQLite database file |
symbols |
Character vector of stock symbols to load |
start_date |
Start date (YYYY-MM-DD) or NULL |
end_date |
End date (YYYY-MM-DD) or NULL |
auto_update |
Auto-update database before loading (default: TRUE) |
frequency |
"daily", "weekly", or "monthly" (default: "daily") |
data.table with Date column and one column per symbol
prices <- sql_adapter(
db_path = "sp500.db",
symbols = c("AAPL", "MSFT"),
start_date = "2020-01-01",
end_date = "2020-12-31",
frequency = "weekly"
)
head(prices)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.