1313from pandas_datareader .google .daily import GoogleDailyReader
1414from pandas_datareader .google .options import Options as GoogleOptions
1515from pandas_datareader .google .quotes import GoogleQuotesReader
16+ from pandas_datareader .iex .deep import Deep as IEXDeep
17+ from pandas_datareader .iex .tops import LastReader as IEXLasts
18+ from pandas_datareader .iex .tops import TopsReader as IEXTops
1619from pandas_datareader .moex import MoexReader
1720from pandas_datareader .nasdaq_trader import get_nasdaq_symbols
1821from pandas_datareader .oecd import OECDReader
2932 'get_data_fred' , 'get_data_google' , 'get_data_moex' ,
3033 'get_data_quandl' , 'get_data_yahoo' , 'get_data_yahoo_actions' ,
3134 'get_nasdaq_symbols' , 'get_quote_google' , 'get_quote_yahoo' ,
35+ 'get_tops_iex' , 'get_summary_iex' , 'get_records_iex' ,
36+ 'get_recent_iex' , 'get_markets_iex' , 'get_last_iex' ,
37+ 'get_iex_symbols' , 'get_iex_book' , 'get_dailysummary_iex' ,
3238 'get_data_stooq' , 'DataReader' ]
3339
3440
@@ -76,6 +82,129 @@ def get_data_stooq(*args, **kwargs):
7682 return StooqDailyReader (* args , ** kwargs ).read ()
7783
7884
85+ def get_tops_iex (* args , ** kwargs ):
86+ return IEXTops (* args , ** kwargs ).read ()
87+
88+
89+ def get_last_iex (* args , ** kwargs ):
90+ return IEXLasts (* args , ** kwargs ).read ()
91+
92+
93+ def get_markets_iex (* args , ** kwargs ):
94+ """
95+ Returns near-real time volume data across markets segregated by tape
96+ and including a percentage of overall volume during the session
97+
98+ This endpoint does not accept any parameters.
99+
100+ Reference: https://www.iextrading.com/developer/docs/#markets
101+
102+ :return: DataFrame
103+ """
104+ from pandas_datareader .iex .market import MarketReader
105+ return MarketReader (* args , ** kwargs ).read ()
106+
107+
108+ def get_dailysummary_iex (* args , ** kwargs ):
109+ """
110+ Returns a summary of daily market volume statistics. Without parameters,
111+ this will return the most recent trading session by default.
112+
113+ :param start:
114+ A datetime object - the beginning of the date range.
115+ :param end:
116+ A datetime object - the end of the date range.
117+
118+ Reference: https://www.iextrading.com/developer/docs/#historical-daily
119+
120+ :return: DataFrame
121+ """
122+ from pandas_datareader .iex .stats import DailySummaryReader
123+ return DailySummaryReader (* args , ** kwargs ).read ()
124+
125+
126+ def get_summary_iex (* args , ** kwargs ):
127+ """
128+ Returns an aggregated monthly summary of market volume and a variety of
129+ related metrics for trades by lot size, security market cap, and venue.
130+ In the absence of parameters, this will return month-to-date statistics.
131+ For ranges spanning multiple months, this will return one row per month.
132+
133+ :param start:
134+ A datetime object - the beginning of the date range.
135+ :param end:
136+ A datetime object - the end of the date range.
137+
138+ :return: DataFrame
139+ """
140+ from pandas_datareader .iex .stats import MonthlySummaryReader
141+ return MonthlySummaryReader (* args , ** kwargs ).read ()
142+
143+
144+ def get_records_iex (* args , ** kwargs ):
145+ """
146+ Returns the record value, record date, recent value, and 30-day average for
147+ market volume, # of symbols traded, # of routed trades and notional value.
148+ This function accepts no additional parameters.
149+
150+ Reference: https://www.iextrading.com/developer/docs/#records
151+
152+ :return: DataFrame
153+ """
154+ from pandas_datareader .iex .stats import RecordsReader
155+ return RecordsReader (* args , ** kwargs ).read ()
156+
157+
158+ def get_recent_iex (* args , ** kwargs ):
159+ """
160+ Returns market volume and trade routing statistics for recent sessions.
161+ Also reports IEX's relative market share, lit share volume and a boolean
162+ halfday indicator.
163+
164+ Reference: https://www.iextrading.com/developer/docs/#recent
165+
166+ :return: DataFrame
167+ """
168+ from pandas_datareader .iex .stats import RecentReader
169+ return RecentReader (* args , ** kwargs ).read ()
170+
171+
172+ def get_iex_symbols (* args , ** kwargs ):
173+ """
174+ Returns a list of all equity symbols available for trading on IEX. Accepts
175+ no additional parameters.
176+
177+ Reference: https://www.iextrading.com/developer/docs/#symbols
178+
179+ :return: DataFrame
180+ """
181+ from pandas_datareader .iex .ref import SymbolsReader
182+ return SymbolsReader (* args , ** kwargs ).read ()
183+
184+
185+ def get_iex_book (* args , ** kwargs ):
186+ """
187+ Returns an array of dictionaries with depth of book data from IEX for up to
188+ 10 securities at a time. Returns a dictionary of the bid and ask books.
189+
190+ :param symbols:
191+ A string or list of strings of valid tickers
192+ :param service:
193+ 'book': Live depth of book data
194+ 'op-halt-status': Checks to see if the exchange has instituted a halt
195+ 'security-event': Denotes individual security related event
196+ 'ssr-status': Short Sale Price Test restrictions, per reg 201 of SHO
197+ 'system-event': Relays current feed status (i.e. market open)
198+ 'trades': Retrieves recent executions, trade size/price and flags
199+ 'trade-breaks': Lists execution breaks for the current trading session
200+ 'trading-status': Returns status and cause codes for securities
201+
202+ :return: Object
203+ """
204+ from pandas_datareader .iex .deep import Deep
205+ return Deep (* args , ** kwargs ).read ()
206+
207+
79208def DataReader (name , data_source = None , start = None , end = None ,
80209 retry_count = 3 , pause = 0.001 , session = None , access_key = None ):
81210 """
@@ -103,6 +232,8 @@ def DataReader(name, data_source=None, start=None, end=None,
103232 single value given for symbol, represents the pause between retries.
104233 session : Session, default None
105234 requests.sessions.Session instance to be used
235+ access_key : (str, None)
236+ Optional parameter to specify an API key for certain data sources.
106237
107238 Examples
108239 ----------
@@ -117,6 +248,13 @@ def DataReader(name, data_source=None, start=None, end=None,
117248 # Data from Google Finance
118249 aapl = DataReader("AAPL", "google")
119250
251+ # Price and volume data from IEX
252+ tops = DataReader(["GS", "AAPL"], "iex-tops")
253+ # Top of book executions from IEX
254+ gs = DataReader("GS", "iex-last")
255+ # Real-time depth of book data from IEX
256+ gs = DataReader("GS", "iex-book")
257+
120258 # Data from FRED
121259 vix = DataReader("VIXCLS", "fred")
122260
@@ -140,6 +278,7 @@ def DataReader(name, data_source=None, start=None, end=None,
140278 return YahooActionReader (symbols = name , start = start , end = end ,
141279 retry_count = retry_count , pause = pause ,
142280 session = session ).read ()
281+
143282 elif data_source == "yahoo-dividends" :
144283 return YahooDivReader (symbols = name , start = start , end = end ,
145284 adjust_price = False , chunksize = 25 ,
@@ -151,6 +290,15 @@ def DataReader(name, data_source=None, start=None, end=None,
151290 chunksize = 25 ,
152291 retry_count = retry_count , pause = pause ,
153292 session = session ).read ()
293+ elif data_source == "iex-tops" :
294+ return IEXTops (symbols = name , start = start , end = end ,
295+ retry_count = retry_count , pause = pause ,
296+ session = session ).read ()
297+
298+ elif data_source == "iex-last" :
299+ return IEXLasts (symbols = name , start = start , end = end ,
300+ retry_count = retry_count , pause = pause ,
301+ session = session ).read ()
154302
155303 elif data_source == "bankofcanada" :
156304 return BankOfCanadaReader (symbols = name , start = start , end = end ,
@@ -162,6 +310,11 @@ def DataReader(name, data_source=None, start=None, end=None,
162310 retry_count = retry_count , pause = pause ,
163311 session = session ).read ()
164312
313+ elif data_source == "iex-book" :
314+ return IEXDeep (symbols = name , service = "book" , start = start , end = end ,
315+ retry_count = retry_count , pause = pause ,
316+ session = session ).read ()
317+
165318 elif data_source == "enigma" :
166319 return EnigmaReader (dataset_id = name , api_key = access_key ).read ()
167320
0 commit comments