Investor’s Exchange Data

The following endpoints are available under Investor’s Exchange Data:

TOPS

TOPS is IEX’s aggregated best quoted bid and offer position in near real time.

Access is available through the function get_tops():

iexfinance.iexdata.get_tops(symbols=None, **kwargs)

TOPS data for a symbol or list of symbols.

TOPS provides IEX’s aggregated best quoted bid and offer position in near real time for all securities on IEX’s displayed limit order book. TOPS is ideal for developers needing both quote and trade data.

Reference: https://iexcloud.io/docs/api/#tops Data Weighting: Free

Parameters:
  • symbols (str or list, default None, optional) – A symbol or list of symbols
  • kwargs – Additional Request Parameters (see base class)

Usage

from iexfinance.iexdata import get_tops

get_tops('AAPL')

Note

The /tops endpoint without any parameters will return all symbols. TOPS data with all symbols is 1.78mb uncompressed (270kb compressed) and is throttled at one request per second, per IEX docs

Last

Last is IEX real-time trade data from the IEX book. This endpoint allows retrieval of a real-time quote.

Access is available through the function get_last():

iexfinance.iexdata.get_last(symbols=None, **kwargs)

Last data for a symbol or list of symbols

Last provides trade data for executions on IEX. It is a near real time, intraday API that provides IEX last sale price, size and time. Last is ideal for developers that need a lightweight stock quote.

Reference: https://iexcloud.io/docs/api/#last Data Weighting: Free

Parameters:
  • symbols (str or list, default None, optional) – A symbol or list of symbols
  • kwargs – Additional Request Parameters (see base class)

Usage

from iexfinance.iexdata import get_last

df = get_last(symbols="AAPL", output_format='pandas')
df['price']

Note

The /tops/last endpoint without any parameters will return all symbols.

DEEP

DEEP is IEX’s aggregated real-time depth of book quotes. DEEP also provides last trade price and size information.

Access is available through the function get_deep():

iexfinance.iexdata.get_deep(symbols=None, **kwargs)

DEEP data for a symbol or list of symbols

DEEP is used to receive real-time depth of book quotations direct from IEX. The depth of book quotations received via DEEP provide an aggregated size of resting displayed orders at a price and side, and do not indicate the size or number of individual orders at any price level. Non-displayed orders and non-displayed portions of reserve orders are not represented in DEEP.

DEEP also provides last trade price and size information. Trades resulting from either displayed or non-displayed orders matching on IEX will be reported. Routed executions will not be reported.

Reference: https://iexcloud.io/docs/api/#deep Data Weighting: Free

Parameters:
  • symbols (str or list, default None) – A symbol or list of symbols
  • kwargs – Additional Request Parameters (see base class)

Notes

Pandas not supported as an output format for the DEEP endpoint.

Note

Per IEX, DEEP only accepts one symbol at this time.

Usage

from iexfinance.iexdata import get_deep

get_deep("AAPL")[:2]

DEEP Auction

Todo

Coming soon.

DEEP Book

Todo

Coming soon.

DEEP Operational Halt Status

Todo

Coming soon.

DEEP Official Price

Todo

Coming soon.

DEEP Security Event

Todo

Coming soon.

DEEP System Event

Todo

Coming soon.

DEEP Trades

Todo

Coming soon.

DEEP Trade Break

Todo

Coming soon.

DEEP Trading Status

Todo

Coming soon.

Listed Short Interest List

Todo

Coming soon.

Stats Historical Daily

Warning

This endpoint has been marked as in-dev by the provider.

Historical Daily is IEX’s trading statstics from the previous trading sessions.

Access is available through the function get_stats_daily():

iexfinance.iexdata.get_stats_daily(start=None, end=None, last=None, **kwargs)

Stats Historical Daily

This call will return daily stats for a given month or day.

Warning

This endpoint is marked as “in development” by the provider.

Reference: https://iexcloud.io/docs/api/#stats-historical-daily-in-dev Data Weighting: Free

Parameters:
  • start (datetime.datetime, default None, optional) – Start of data retrieval period
  • end (datetime.datetime, default None, optional) – End of data retrieval period
  • last (int, default None, optional) – Used in place of date range to retrieve previous number of trading days (up to 90)
  • kwargs – Additional Request Parameters (see base class)

Data retrieval period must be between 1/2014 and today.

Usage

In [1]: from iexfinance.iexdata import get_stats_daily

In [2]: get_stats_daily(last=3)
Out[2]: 
            isHalfday  litVolume  marketShare  routedVolume     volume
date                                                                  
2019-06-18          0   51689441     0.029820      33015007  210845106
2019-06-17          0   40680174     0.029390      23282516  170230846
2019-06-14          0   43046281     0.030630      27145458  177755875
2019-06-13          0   46164412     0.029920      30714723  183907783
2019-06-12          0   44671436     0.030570      28100207  189201059
2019-06-11          0   51891978     0.030300      34566723  206324558
2019-06-10          0   48343512     0.029130      30443039  186586677
2019-06-07          0   45791451     0.031574      30730583  201918936
2019-06-06          0   46568932     0.028910      31935989  195680125
2019-06-05          0   54866767     0.030280      31790983  222724747
2019-06-04          0   57327938     0.029980      37214701  225569577
2019-06-03          0   62882642     0.029324      30805011  243616956

Stats Historical Summary

Historical Summary is IEX’s trading statstics from the previous trading sessions.

Access is available through the function get_stats_summary():

iexfinance.iexdata.get_stats_summary(start=None, end=None, **kwargs)

Stats Historical Summary

Reference: https://iexcloud.io/docs/api/#stats-historical-summary Data Weighting: Free

Parameters:
  • start (datetime.datetime, default None, optional) – Start of data retrieval period
  • end (datetime.datetime, default None, optional) – End of data retrieval period
  • kwargs – Additional Request Parameters (see base class)

Data retrieval period must be between 1/2014 and today.

Warning

The Historical Summary accepts requests of one month per request. if specifying a long date range, a query will be made for each month in the range, significantly impacting performance

Usage

In [3]: from iexfinance.iexdata import get_stats_summary

In [4]: from datetime import datetime

In [5]: get_stats_summary(start=datetime(2017, 2, 9), end=datetime(2017, 5, 24))[0]
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   2524             try:
-> 2525                 return self._engine.get_loc(key)
   2526             except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'date'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
<ipython-input-5-3f06c10dca00> in <module>()
----> 1 get_stats_summary(start=datetime(2017, 2, 9), end=datetime(2017, 5, 24))[0]

~/Documents/iex/iexfinance/iexfinance/iexdata/__init__.py in get_stats_summary(start, end, **kwargs)
    190         Additional Request Parameters (see base class)
    191     """
--> 192     return MonthlySummaryReader(start=start, end=end, **kwargs).fetch()

~/Documents/iex/iexfinance/iexfinance/iexdata/base.py in fetch(self)
    404         if self.output_format == 'pandas':
    405             result = pd.concat(dfs) if len(dfs) > 0 else pd.DataFrame()
--> 406             return result.set_index('date')
    407         else:
    408             return dfs

~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/frame.py in set_index(self, keys, drop, append, inplace, verify_integrity)
   3144                 names.append(None)
   3145             else:
-> 3146                 level = frame[col]._values
   3147                 names.append(col)
   3148                 if drop:

~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/frame.py in __getitem__(self, key)
   2137             return self._getitem_multilevel(key)
   2138         else:
-> 2139             return self._getitem_column(key)
   2140 
   2141     def _getitem_column(self, key):

~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/frame.py in _getitem_column(self, key)
   2144         # get column
   2145         if self.columns.is_unique:
-> 2146             return self._get_item_cache(key)
   2147 
   2148         # duplicate columns & possible reduce dimensionality

~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/generic.py in _get_item_cache(self, item)
   1840         res = cache.get(item)
   1841         if res is None:
-> 1842             values = self._data.get(item)
   1843             res = self._box_item_values(item, values)
   1844             cache[item] = res

~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/internals.py in get(self, item, fastpath)
   3841 
   3842             if not isna(item):
-> 3843                 loc = self.items.get_loc(item)
   3844             else:
   3845                 indexer = np.arange(len(self.items))[isna(self.items)]

~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   2525                 return self._engine.get_loc(key)
   2526             except KeyError:
-> 2527                 return self._engine.get_loc(self._maybe_cast_indexer(key))
   2528 
   2529         indexer = self.get_indexer([key], method=method, tolerance=tolerance)

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'date'

Stats Intraday

Intraday is IEX’s aggregated best quoted bid and offer position in near real time.

Access is available through the function get_stats_intraday():

iexfinance.iexdata.get_stats_intraday(**kwargs)

Stats intraday

Reference: https://iexcloud.io/docs/api/#stats-intraday Data Weighting: Free

Parameters:kwargs – Additional Request Parameters (see base class)

Usage

In [6]: from iexfinance.iexdata import get_stats_intraday

In [7]: get_stats_intraday()
Out[7]: 
              marketShare       notional   routedVolume  symbolsTraded  \
lastUpdated  1.570359e+12  1632553854025  1601109190742  1633638318692   
value        2.872000e-02     9337041272       31774105           5987   

                    volume  
lastUpdated  1606453957734  
value            198278815  

Stats Recent

Recent is IEX’s trading statstics from the previous five trading days.

Access is available through the function get_stats_recent():

iexfinance.iexdata.get_stats_recent(**kwargs)

Stats Recent

This call will return a minimum of the last five trading days up to all trading days of the current month.

Reference: https://iexcloud.io/docs/api/#stats-recent Data Weighting: Free

Parameters:kwargs – Additional Request Parameters (see base class)

Usage

In [8]: from iexfinance.iexdata import get_stats_recent

In [9]: get_stats_recent()[0]
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   2524             try:
-> 2525                 return self._engine.get_loc(key)
   2526             except KeyError:

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 0

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
<ipython-input-9-a3f3c49f6e23> in <module>()
----> 1 get_stats_recent()[0]

~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/frame.py in __getitem__(self, key)
   2137             return self._getitem_multilevel(key)
   2138         else:
-> 2139             return self._getitem_column(key)
   2140 
   2141     def _getitem_column(self, key):

~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/frame.py in _getitem_column(self, key)
   2144         # get column
   2145         if self.columns.is_unique:
-> 2146             return self._get_item_cache(key)
   2147 
   2148         # duplicate columns & possible reduce dimensionality

~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/generic.py in _get_item_cache(self, item)
   1840         res = cache.get(item)
   1841         if res is None:
-> 1842             values = self._data.get(item)
   1843             res = self._box_item_values(item, values)
   1844             cache[item] = res

~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/internals.py in get(self, item, fastpath)
   3841 
   3842             if not isna(item):
-> 3843                 loc = self.items.get_loc(item)
   3844             else:
   3845                 indexer = np.arange(len(self.items))[isna(self.items)]

~/.virtualenvs/iexdocs/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
   2525                 return self._engine.get_loc(key)
   2526             except KeyError:
-> 2527                 return self._engine.get_loc(self._maybe_cast_indexer(key))
   2528 
   2529         indexer = self.get_indexer([key], method=method, tolerance=tolerance)

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 0

Stats Records

Records is IEX’s trading statstics from the previous trading sessions.

Access is available through the function get_stats_records():

iexfinance.iexdata.get_stats_records(**kwargs)

Stats Records

Reference: https://iexcloud.io/docs/api/#stats-records Data Weighting: Free

Parameters:kwargs – Additional Request Parameters (see base class)

Usage

In [10]: from iexfinance.iexdata import get_stats_records

In [11]: get_stats_records()
Out[11]: 
                     notional routedVolume symbolsTraded      volume
avg30Value        9.89669e+09     30946216          5956   200781508
previousDayValue  1.07395e+10     33437276          6183   213625824
recordDate         2018-02-07   2016-11-23    2018-12-30  2019-01-02
recordValue       1.75931e+10     76440640          6922   314341497