How to confuse R with a stock ticker

Home Forums Quantitative Methods and Programming How to confuse R with a stock ticker

Tagged: , ,

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #21573

    First try for Apple (AAPL)
    > ohlc = quantmod::getSymbols(“AAPL”, auto.assign = FALSE)
    > sd(quantmod::dailyReturn(ohlc))
    [1] 0.02033598

    So far, so good.
    Now try for OPEN (“OPENDOOR TECHNOLOGIES INC”)
    > ohlc = quantmod::getSymbols(“OPEN”, auto.assign = FALSE)
    > sd(quantmod::dailyReturn(ohlc))
    Error in Delt_(getFirst(xx[1]), getLast(xx[ep[2]]), type = type) :
    x1 and x2 must be of same length

    Why? Well, I did not debug deeply but it is definitely to the ticker OPEN
    Try
    > head(ohlc)
    OPEN.Open OPEN.High OPEN.Low OPEN.Close OPEN.Volume OPEN.Adjusted
    2020-06-18 10.75 11.500 10.70 10.804 474700 10.804
    2020-06-19 11.40 11.400 10.83 10.930 57400 10.930
    2020-06-22 11.11 12.825 10.90 11.360 529800 11.360
    2020-06-23 11.65 12.230 11.25 11.610 321700 11.610
    2020-06-24 11.86 11.860 11.15 11.250 214800 11.250
    2020-06-25 11.12 11.400 11.12 11.370 217800 11.370
    So likely it confuses OPEN (ticker) and Open (price)!

    P.S.
    with Ford (ticker F) you can confuse R even stronger, since F means FALSE in R!

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.