[R-SIG-Finance] QUANTMOD package: retrieving the rolling front month price when using the "getSymbols" function

Frank frankm60606 at gmail.com
Sun Aug 4 19:36:03 CEST 2013


WTI crude prices are available, I use:

getSymbols('DCOILWTICO',src='FRED')
DCOILWTICO <- na.locf(DCOILWTICO)
tail(DCOILWTICO)
file_name <- "DCOILWTICO.csv"
write.zoo(DCOILWTICO, file = file_name, append = FALSE, quote = TRUE, sep =
",")
quit()

-----Original Message-----
From: r-sig-finance-bounces at r-project.org
[mailto:r-sig-finance-bounces at r-project.org] On Behalf Of Ryan Christopher
Sent: Sunday, August 04, 2013 11:48 AM
To: r-sig-finance at r-project.org
Subject: [R-SIG-Finance] QUANTMOD package: retrieving the rolling front
month price when using the "getSymbols" function

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.

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)?

Thanks,
Ryan

	[[alternative HTML version deleted]]

_______________________________________________
R-SIG-Finance at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions
should go.



More information about the R-SIG-Finance mailing list