# Plot OHLC bar chart for the last `nDays' days of the instrument `instrument'
nDays <- 50
instrument <- "^spc"
start <- strftime(as.POSIXlt(Sys.time() - nDays*24*3600), format="%Y-%m-%d")
end <- strftime(as.POSIXlt(Sys.time()), format = "%Y-%m-%d")
x <- get.hist.quote(instrument = instrument, start = start, end = end)
plotOHLC(x, ylab = "price", main = instrument)
Run the code above in your browser using DataLab