Chapter 9 Backend Server
Start with server
. How can I get data? I need 3 different datasets. The first was historical data, where the user entered the start date and end date as the “input”. We used this data set for “Plot”. Another data set was the last trade date data, we used it for the “stock symbol patterns”. The latter was used to create the Bollinger Bands plot. The get_stock(symbol, date_from, date_to,periodicity) function in global.R returned all the data we needed.
get_stock <- function(symbol, date_from, date_to,periodicity){
dt <- getSymbols(symbol,
from = date_from,
to = date_to,
warnings = FALSE,
verbose = FALSE,
symbol.lookup = TRUE,
auto.assign = FALSE,src = 'yahoo',
periodicity = periodicity
)
------------
}
Once we have these datasets, we can start building the list of Stock Symbol Patterns
, let’s see what it looked like.