Skip to content
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

REV/MAINT: Switching back to Yahoo (temp) to deal with Google #1972

Closed
wants to merge 11 commits into from

Conversation

freddiev4
Copy link
Contributor

@freddiev4 freddiev4 commented Oct 3, 2017

Google limited their API to only 251 days worth of data, most likely as a result of the change that Yahoo had made a few months ago. pandas-datareader made a fix for the Yahoo data reader so I'm making this PR to move back to Yahoo until we can do something better. Ideally we'll have a more robust solution before we do another release, so users will have to install latest Zipline master if this is merged.

Hoping to use this as a temp fix for #1965 and all the other issues that reference it

Ran:
zipline run -f buyapple.py -s 2005-1-1 -e 2017-2-1

Output:

[2017-10-21 17:09:23.349648] INFO: Performance: after split: asset: Equity(2696 [AAPL]), amount: 74.0, cost_basis: 38.14, last_sale_price: 88.99
[2017-10-21 17:09:23.350107] INFO: Performance: returning cash: 0.0
[2017-10-21 17:09:31.018709] INFO: Performance: after split: asset: Equity(2696 [AAPL]), amount: 16870.0, cost_basis: 36.52, last_sale_price: 645.57
[2017-10-21 17:09:31.018856] INFO: Performance: returning cash: 0.0
[2017-10-21 17:09:32.856054] INFO: Performance: Simulated 3042 trading days out of 3042.
[2017-10-21 17:09:32.856223] INFO: Performance: first open: 2005-01-03 14:31:00+00:00
[2017-10-21 17:09:32.856361] INFO: Performance: last close: 2017-02-01 21:00:00+00:00

Also attempting to drop Py3.4 packages here so that we don't have to build our own pandas-datareader and requests-ftp packages on conda (also helps make room for Travis jobs when we begin to build Py3.6 packages) #

@@ -356,93 +352,6 @@ def _load_cached_data(filename, first_date, last_date, now, resource_name,
return None


def _load_raw_yahoo_data(indexes=None, stocks=None, start=None, end=None):
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should've been removed in #1812

@coveralls
Copy link

coveralls commented Oct 4, 2017

Coverage Status

Coverage increased (+0.2%) to 87.405% when pulling b784e24 on back-to-yahoo-we-go into 5421ec0 on master.

@freddiev4
Copy link
Contributor Author

image

@JoaoAparicio
Copy link
Contributor

Thank you. This is causing issues to a lot of people.

@freddiev4
Copy link
Contributor Author

freddiev4 commented Oct 5, 2017

@richafrank any thoughts on how to deal with this?

Passing Py27 and Py35 but not Py34. No pandas-datareader conda packages for Py34

Google limited their API to only 251 days worth of data, most likely as a result of the change that Yahoo had made a few months ago. `pandas-datareader` made a fix for the Yahoo data reader so I'm making this PR to move back to Yahoo until we can do something better. Ideally we'll have a more robust solution before we do another release, so users will have to install latest Zipline master if this is merged.
@richafrank
Copy link
Member

Previously we've added a recipe for the missing package with conda skeleton pypi to our recipes dir, and build it ourselves.

@abhilashchowdhary
Copy link

Any updates on this PR? It would be great if it's merged in.

@freddiev4
Copy link
Contributor Author

@abhilashchowdhary Currently working on it 🙂

@freddiev4 freddiev4 force-pushed the back-to-yahoo-we-go branch from b784e24 to d5487ab Compare October 13, 2017 16:13
@freddiev4 freddiev4 force-pushed the back-to-yahoo-we-go branch from d5487ab to f18b9c9 Compare October 13, 2017 16:46
@coveralls
Copy link

coveralls commented Oct 13, 2017

Coverage Status

Coverage increased (+0.2%) to 87.392% when pulling f18b9c9 on back-to-yahoo-we-go into 45257eb on master.

@freddiev4
Copy link
Contributor Author

freddiev4 commented Oct 21, 2017

@richafrank could you take a look at this? (forgot to ping you here)

@richafrank
Copy link
Member

ACK. Started looking...

Copy link
Member

@richafrank richafrank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes general sense to me. I had a couple questions, and I'm currently confirming our use of py3.4.

@@ -55,7 +55,7 @@ def init_class_fixtures(cls):
serialization='pickle',
)

market_data = ('SPY_benchmark.csv', 'treasury_curves.csv')
market_data = ('^GSPC_benchmark.csv', 'treasury_curves.csv')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we make a global name for the default benchmark symbol, so we don't have to change it in 5 places?

@@ -69,6 +69,8 @@ def run_example(example_name, environ):
mod = EXAMPLE_MODULES[example_name]

register_calendar("YAHOO", get_calendar("NYSE"), force=True)
# for when we don't actually have a 'test' bundle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When do we have a 'test' bundle otherwise? Did this work before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we ever actually had a test bundle, but I don't think this failed before when we switched to Google 🤔

.travis.yml Outdated
@@ -3,7 +3,6 @@ sudo: false
fast_finish: true
python:
- 2.7
- 3.4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm, this was removed because of the missing conda packages for the newer pandas-datareader dependency?

I'm currently assessing the internal value of testing this python version...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@freddiev4 Can we keep this row in the matrix for running tests, but not for building conda packages?

@@ -45,17 +42,11 @@ def get_benchmark_returns(symbol, first_date, last_date):
"""
data = pd_reader.DataReader(
symbol,
'google',
'yahoo',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the newer version works ok with yahoo again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes on my machine with a fresh zipline install it works.

@richafrank
Copy link
Member

@freddiev4 Will this PR include fixing the NotImplementedError in rebuild_example_data?

@freddiev4
Copy link
Contributor Author

freddiev4 commented Nov 3, 2017

@richafrank I don't think it's currently worth adding back Yahoo bundles, which we would need for the NotImplementedError so I went ahead and removed it.

Maybe at some other point in time.

@coveralls
Copy link

coveralls commented Nov 3, 2017

Coverage Status

Coverage increased (+0.2%) to 87.427% when pulling b9a76dd on back-to-yahoo-we-go into 45257eb on master.

@coveralls
Copy link

coveralls commented Nov 3, 2017

Coverage Status

Coverage increased (+0.2%) to 87.427% when pulling b9a76dd on back-to-yahoo-we-go into 45257eb on master.

@freddiev4
Copy link
Contributor Author

Closing in favor of #2031

@freddiev4 freddiev4 closed this Dec 2, 2017
@freddiev4 freddiev4 deleted the back-to-yahoo-we-go branch July 12, 2018 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants