Search code examples
rquantmod

load symbols using quantmod up to a specific date


How would I load the stock data of AMZN that does not include the stock prices after 2016-01-12?

The code to load the most up-to-date stock prices is this getSymbols("AMZN", auto.assign = FALSE) But I want to pretend that today is January 12th and eliminate the prices after that date. What would be the most convenient way to do that?


Solution

  • mySeries <- getSymbols("AMZN", auto.assign = FALSE)
    
    t <- mySeries['::2016-01-12']
    

    An explanation of subsetting is given here http://www.quantmod.com/examples/data/