An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-sig-finance/attachments/20130804/71c1d57a/attachment.pl>
QUANTMOD package: retrieving the rolling front month price when using the "getSymbols" function
4 messages · Ryan Christopher, Joshua Ulrich, Frank
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
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
_______________________________________________
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.
On Sun, Aug 4, 2013 at 12:36 PM, Frank <frankm60606 at gmail.com> wrote:
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()
Those are spot prices, not the price of the front-month future, so it doesn't answer Ryan's question. Best, -- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com
-----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. _______________________________________________ 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.