Function to read, transform, aggregate and save data for further retraining of regression model for a single asset
Function to read, transform, aggregate and save data for further retraining of regression model for a single asset
Function is collecting data from the csv files Data objects are transformed to be suitable for Regression Modelling. Price change will be in the column 'LABEL', column X1 will keep the time index Result will be written to a new or aggregated to the existing '.rds' file
Function is keeping generated dataset to be not larger than specified by the user
indicator_dataset: Dataset containing assets indicator which pattern will be used as predictor
symbol: Character symbol of the asset for which to train the model
timeframe: Data timeframe e.g. 1 min
path_data: Path where the aggregated historical data is stored, if exists in rds format
max_nrows: Integer, Maximum number of rows to collect
Returns
Function is writing files into Decision Support System folder, mainly file object with the model
Details
Function is not handling shift of the price and indicator datasets.
This function is relying on the data collection from the dedicated data robot Other 'aml_*' functions will work based on the data processed by this function
Examples
# write examples for the functionlibrary(dplyr)library(readr)library(lubridate)library(lazytrade)library(magrittr)# sample datasetind = system.file("extdata","AI_RSIADXUSDJPY60.csv", package ="lazytrade")%>% read_csv(col_names =FALSE)# convert to POSIX formatind$X1 <- ymd_hms(ind$X1)# create temporary path (check output of tempdir() to check the result)path_data <- normalizePath(tempdir(),winslash ="/")# add tick data to the foldertick = system.file("extdata","TickSize_AI_RSIADX.csv", package ="lazytrade")%>% read_csv(col_names =FALSE)write_csv(tick, file.path(path_data,"TickSize_AI_RSIADX.csv"), col_names =FALSE)# data transformation using the custom function for one symbolaml_collect_data(indicator_dataset = ind, symbol ='USDJPY', timeframe =60, path_data = path_data)