13
13
from pandas_datareader .google .daily import GoogleDailyReader
14
14
from pandas_datareader .google .options import Options as GoogleOptions
15
15
from pandas_datareader .google .quotes import GoogleQuotesReader
16
- from pandas_datareader .iex .market import MarketReader as IEXMarkets
17
- from pandas_datareader .iex .ref import SymbolsReader as IEXSymbols
18
- from pandas_datareader .iex .stats import DailySummaryReader as IEXHistorical
19
- from pandas_datareader .iex .stats import MonthlySummaryReader as IEXMonthSummary
20
16
from pandas_datareader .iex .deep import Deep as IEXDeep
21
- from pandas_datareader .iex .stats import RecentReader as IEXRecents
22
- from pandas_datareader .iex .stats import RecordsReader as IEXRecords
23
17
from pandas_datareader .iex .tops import LastReader as IEXLasts
24
18
from pandas_datareader .iex .tops import TopsReader as IEXTops
25
19
from pandas_datareader .moex import MoexReader
38
32
'get_data_fred' , 'get_data_google' , 'get_data_moex' ,
39
33
'get_data_quandl' , 'get_data_yahoo' , 'get_data_yahoo_actions' ,
40
34
'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' ,
41
38
'get_data_stooq' , 'DataReader' ]
42
39
43
40
@@ -80,9 +77,11 @@ def get_data_quandl(*args, **kwargs):
80
77
def get_data_moex (* args , ** kwargs ):
81
78
return MoexReader (* args , ** kwargs ).read ()
82
79
80
+
83
81
def get_data_stooq (* args , ** kwargs ):
84
82
return StooqDailyReader (* args , ** kwargs ).read ()
85
83
84
+
86
85
def get_tops_iex (* args , ** kwargs ):
87
86
return IEXTops (* args , ** kwargs ).read ()
88
87
@@ -92,31 +91,118 @@ def get_last_iex(*args, **kwargs):
92
91
93
92
94
93
def get_markets_iex (* args , ** kwargs ):
95
- return IEXMarkets (* args , ** kwargs ).read ()
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 ()
96
106
97
107
98
- def get_data_iex (* args , ** kwargs ):
99
- return IEXHistorical (* args , ** kwargs ).read ()
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 ()
100
124
101
125
102
126
def get_summary_iex (* args , ** kwargs ):
103
- return IEXMonthSummary (* args , ** kwargs ).read ()
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 ()
104
142
105
143
106
144
def get_records_iex (* args , ** kwargs ):
107
- return IEXRecords (* args , ** kwargs ).read ()
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 ()
108
156
109
157
110
158
def get_recent_iex (* args , ** kwargs ):
111
- return IEXRecents (* args , ** kwargs ).read ()
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 ()
112
170
113
171
114
172
def get_iex_symbols (* args , ** kwargs ):
115
- return IEXSymbols (* args , ** kwargs ).read ()
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 ()
116
183
117
184
118
185
def get_iex_book (* args , ** kwargs ):
119
- return IEXDeep (* args , ** kwargs ).read ()
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 ()
120
206
121
207
122
208
def DataReader (name , data_source = None , start = None , end = None ,
@@ -146,7 +232,9 @@ def DataReader(name, data_source=None, start=None, end=None,
146
232
single value given for symbol, represents the pause between retries.
147
233
session : Session, default None
148
234
requests.sessions.Session instance to be used
149
-
235
+ access_key : (str, None)
236
+ Optional parameter to specify an API key for certain data sources.
237
+
150
238
Examples
151
239
----------
152
240
@@ -159,7 +247,14 @@ def DataReader(name, data_source=None, start=None, end=None,
159
247
160
248
# Data from Google Finance
161
249
aapl = DataReader("AAPL", "google")
162
-
250
+
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
+
163
258
# Data from FRED
164
259
vix = DataReader("VIXCLS", "fred")
165
260
@@ -183,6 +278,7 @@ def DataReader(name, data_source=None, start=None, end=None,
183
278
return YahooActionReader (symbols = name , start = start , end = end ,
184
279
retry_count = retry_count , pause = pause ,
185
280
session = session ).read ()
281
+
186
282
elif data_source == "yahoo-dividends" :
187
283
return YahooDivReader (symbols = name , start = start , end = end ,
188
284
adjust_price = False , chunksize = 25 ,
0 commit comments