The ‘financialDataAnalysis’ project was split up into 4 prototypes. This is a demonstration of of prototype 1.
Prototype 1 includes the following features:
- A large and rich dataset about a set of stocks, which can be freely used and analysed.
- Two models, fit on a large dataset of historic stock prices, allowing you to predict the price of a variety of stocks.
The stock data contains 497 rows and 100 columns. Each row represents a particular stock.
The models can be used in the following way:
Note that the shown method for generating predictions will no longer
work as of prototype 4. Instead, use the predict_price()
function.
First we need to create a data frame to predict on. Lets use make monthly predictions, going 6 months ahead.
data <- tibble(
ticker = "GOOGL",
ref_date = seq(
from = today(),
to = today() + months(6),
by = "month"
)
)
data
#> # A tibble: 7 × 2
#> ticker ref_date
#> <chr> <date>
#> 1 GOOGL 2023-02-19
#> 2 GOOGL 2023-03-19
#> 3 GOOGL 2023-04-19
#> 4 GOOGL 2023-05-19
#> 5 GOOGL 2023-06-19
#> 6 GOOGL 2023-07-19
#> 7 GOOGL 2023-08-19
Now lets make predictions on the data using the monthly model.
predict(monthly_stock_model, data)
You can also add the predictions automatically to the data you have created.
augment(monthly_stock_model, data)