Search code examples
rquantmod

Adjusting Daily return in Quantmod


I downloaded the daily returns of stocks in R from quantmod package. I see that the lowest daily return of AT&T is showing as -77% which is little hard to believe. I checked the historical prices and found that this may be because of a share split or bonus. How do I adjust that or correct my returns is my question . Thanks in advance.


Solution

  • Are you sure? When I do this I get the minimum daily return of -7.7%.

    library(quantmod)
    ATT  <- getSymbols("T",auto.assign=FALSE)
    min(dailyReturn(ATT))
    # [1] -0.07721139
    

    It is true that splits can be a problem:

    AAPL <- getSymbols("AAPL",auto.assign=FALSE)
    min(dailyReturn(AAPL))    # reflects 7:1 split
    # [1] -0.8548569
    x <- which.min(dailyReturn(AAPL))
    AAPL[(x-1):x]
    #            AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
    # 2014-06-06     649.9    651.26   644.47     645.57    87484600         91.37
    # 2014-06-09      92.7     93.88    91.75      93.70    75415000         92.83
    

    but that's what Adjusted Close is for:

    min(dailyReturn(Ad(AAPL)))
    # [1] -0.1792507
    y <- which.min(dailyReturn(Ad(AAPL)))
    AAPL[(y-1):y]
    #            AAPL.Open AAPL.High AAPL.Low AAPL.Close AAPL.Volume AAPL.Adjusted
    # 2008-09-26    124.91    129.80   123.00     128.24   281612800         17.35
    # 2008-09-29    119.62    119.68   100.59     105.26   655514300         14.24