require(zoo) # Choose Your fund # browseURL("https://stooq.pl/t/?i=591") fundname <- "1018.n" # fundname <- "wig" # Creating CSV file CreFile = FALSE if(CreFile){ filename <- paste0("https://stooq.pl/q/d/l/?s=",fundname,"&i=d") x <- read.csv2(file=filename, head=TRUE, sep=",", dec=".") y <- x[,c(1,5)] colnames(y) <- c("Dates","Price") write.csv(y,"FundData.csv", row.names = FALSE) } # Downloading the data y <- read.csv2(file="FundData.csv", head=TRUE, sep=",", dec=".") P <- zoo(y$Price, order.by = as.Date(y$Dates)) r <- diff(log(P))