Search code examples
rquantmod

getQuotes for ^RUT


I am trying to merge the current quote for an Index with the historial price series to create a complete time series up to now. I am running into issues with the ^RUT index with getQuotes:

> getQuote(c("^RUT", "^GSPC"))
               Trade Time     Last Change % Change    Open    High     Low     Volume
^RUT  2013-03-16 08:05:00  952.482 -0.585   -0.06%  953.50  954.00  949.48          0
^GSPC 2013-03-15 04:35:00 1560.700 -2.530   -0.16% 1563.21 1563.62 1555.74 1426617600

I am doing this on a Monday morning before US markets have opened. The time stamp for ^RUT of March 16th will cause problems for me after every weekend when I try and do a merge with the historical time series as it will create a day on a Saturday where no trading has occurred. As you can see from the above, there is no issue with ^GSPC. Any ideas how I can fix or get around this?

Thank you.


Solution

  • You obviously know what the date should be, so just set it manually.

    Or, since you're doing this on Monday morning before market open, Friday data is available historically, so just use getSymbols.

    > tail(getSymbols("^RUT", from=Sys.Date()-3, auto.assign=FALSE))
               RUT.Open RUT.High RUT.Low RUT.Close RUT.Volume RUT.Adjusted
    2013-03-15    953.5      954  949.48    952.48          0       952.48
    > tail(getSymbols("^GSPC", from=Sys.Date()-3, auto.assign=FALSE))
               GSPC.Open GSPC.High GSPC.Low GSPC.Close GSPC.Volume GSPC.Adjusted
    2013-03-15   1563.21   1563.62  1555.74     1560.7  5175850000        1560.7