Skip to content

Commit 1e58cd2

Browse files
author
Freddie Vargus
committed
MAINT: Add attribution for IEX
1 parent 181a0f7 commit 1e58cd2

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

zipline/data/benchmarks.py

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,18 @@
1717
import requests
1818

1919

20-
def get_benchmark_returns(symbol, first_date, last_date):
20+
def get_benchmark_returns(symbol):
2121
"""
22-
Get a Series of benchmark returns from Google associated with `symbol`.
22+
Get a Series of benchmark returns from IEX associated with `symbol`.
2323
Default is `SPY`.
2424
2525
Parameters
2626
----------
2727
symbol : str
2828
Benchmark symbol for which we're getting the returns.
29-
first_date : pd.Timestamp
30-
First date for which we want to get data.
31-
last_date : pd.Timestamp
32-
Last date for which we want to get data.
3329
34-
The furthest date that Google goes back to is 1993-02-01. It has missing
35-
data for 2008-12-15, 2009-08-11, and 2012-02-02, so we add data for the
36-
dates for which Google is missing data.
37-
38-
We're also limited to 4000 days worth of data per request. If we make a
39-
request for data that extends past 4000 trading days, we'll still only
40-
receive 4000 days of data.
41-
42-
first_date is **not** included because we need the close from day N - 1 to
43-
compute the returns for day N.
30+
The data is provided by IEX (https://iextrading.com/), and we can
31+
get up to 5 years worth of data.
4432
"""
4533
r = requests.get(
4634
'https://api.iextrading.com/1.0/stock/{}/chart/5y'.format(symbol)

zipline/data/loader.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,7 @@ def ensure_benchmark_data(symbol, first_date, last_date, now, trading_day,
224224
)
225225

226226
try:
227-
data = get_benchmark_returns(
228-
symbol,
229-
first_date - trading_day,
230-
last_date,
231-
)
227+
data = get_benchmark_returns(symbol)
232228
data.to_csv(get_data_filepath(filename, environ))
233229
except (OSError, IOError, HTTPError):
234230
logger.exception('Failed to cache the new benchmark returns')

0 commit comments

Comments
 (0)