QUANTMOD package: retrieving the rolling front month price when using the "getSymbols" function
On Sun, Aug 4, 2013 at 11:48 AM, Ryan Christopher <ryanc023 at gmail.com> wrote:
Hello, I'm working on a project that requires me to retrieve the prices of NYMEX WTI oil futures over a 5-year period of time. I'm interested in retrieving the rolling 'front month' price, rather than a particular contract expiration. I'm using the "getSymbols" function in the Quantmod package to retrieve the data from Yahoo.
No you're not, because Yahoo doesn't provide historical data for NYMEX crude oil futures. Go to the page for the symbol you want and you'll see there is no "Historical Data" link: http://finance.yahoo.com/q?s=CLU13.NYM
At this point, I can't even seem to retrieve My code is:
************************************************************
initDate <- "2008-07-31"
endDate <- "2013-07-31"
symbols <- c("CLU13.NYM")
getSymbols(symbols, src="yahoo",from=initDate, to=endDate,
index.class=c("POSIXt","POSIXct"))
Which returns this error message:
Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,
:
cannot open URL '
http://chart.yahoo.com/table.csv?s=CLU13.NYM&a=6&b=31&c=2009&d=6&e=19&f=2013&g=d&q=q&y=0&z=CLU13.NYM&x=.csv
'
In addition: Warning message:
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m, :
cannot open: HTTP status was '404 Not Found'
************************************************************
Does anyone know if it's possible to retrieve the rolling front month price
(instead of a particular contract expiration)?
Google knows. The first page of results from searching "wti futures historical prices" has many candidates. One is the Open Financial Data Project, which is available via Quandl: http://www.quandl.com/OFDP-Open-Financial-Data-Project/FUTURE_CL1-NYMEX-Crude-Oil-Futures-Continuous-Contract-1-CL1-Front-Month
Thanks, Ryan
Best, -- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com