updateDatasets | R Documentation |
updateDatasets()
##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function ()
{
tryCatch({
tickets <- as.character(read.csv("tempTickets.csv")[[1]])
print(NROW(tickets))
for (tticket in tickets) {
tickets <- tickets[tickets != as.character(tticket)]
ticket <- paste(tticket, ".SA", sep = "")
if (file.exists(paste("./Datasets/", ticket, ".csv",
sep = ""))) {
}
dataset <- as.data.frame(getSymbols(Symbols = ticket,
auto.assign = F, symbol.lookup = TRUE))
setDT(dataset, keep.rownames = TRUE)[]
dataset <- formateTicketDf(dataset)
dataset$Amplitude <- dataset$High - dataset$Low
write.csv(dataset, file = paste("Datasets/", ticket,
".csv", sep = ""), row.names = FALSE)
}
}, error = function(e) {
print("Error:")
print(e)
write.csv(tickets, file = "tempTickets.csv", row.names = FALSE)
updateDatasets()
})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.