Skip to content

Can't get Crude Oil data from Yahoo! Finance #290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
xuantianfengwu opened this issue Mar 28, 2017 · 4 comments
Closed

Can't get Crude Oil data from Yahoo! Finance #290

xuantianfengwu opened this issue Mar 28, 2017 · 4 comments

Comments

@xuantianfengwu
Copy link

First thanks for such a convenient tool to get data from all over the world.
But I met this problem when I tried to get daily historical data of Crude Oil from Yahoo,
my code is like this:

import pandas_datareader.data as data
import datetime
begin = datetime.datetime(2017,1,1)
end = datetime.datetime(2017,3,31)
oil = data.DataReader("CL.NYM", 'yahoo', begin, end)
oil.head()

I have tried CL, CL=F, F_CL, FCL, FCL.NYM, CL.NYM, a lot of that and still can't get the data I need. At last I have to use USO.
But I still want to know if I can get data of the crude oil Futures with pandas-datareader. Is there any category limitation when using pandas-datareader ?

@gliptak
Copy link
Contributor

gliptak commented May 11, 2017

https://finance.yahoo.com/lookup?s=cl.nym shows no results ...

@rgkimball
Copy link
Contributor

If you add the expiration you can see the info: https://finance.yahoo.com/quote/CLM17.NYM?p=CLM17.NYM

I'm able to retrieve data via YQL: http://developer.yahoo.com/yql/console/?q=select%20*%20from%20yahoo.finance.quote%20where%20symbol%20%3D%20%22CLM17.NYM%22&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys

My inclination from a bit of testing is that this is a limitation of the icharts API.

@rgkimball
Copy link
Contributor

The silver lining in the icharts API being deprecated, the new URL structure implemented by #331 will fix this problem - just tested:

import pandas_datareader as pdr
import datetime

begin = datetime.datetime(2017, 1, 1)
cl = pdr.DataReader('CLM17.NYM', 'yahoo', begin)

Output (CSV):

Date,Open,High,Low,Close,Adj Close,Volume
2017-05-17,48.169998,49.020000,48.160000,48.869999,48.869999,30528362
2017-05-16,49.029999,49.380001,48.080002,48.090000,48.090000,236432590
2017-05-15,48.549999,49.660000,48.509998,48.919998,48.919998,316061712
2017-05-14,47.849998,47.880001,47.750000,47.790001,47.790001,219844
....

@bashtage
Copy link
Contributor

Yahoo has been deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants