1from pandas_datareader.iex import IEX
2
3# Data provided for free by IEX
4# Data is furnished in compliance with the guidelines promulgated in the IEX
5# API terms of service and manual
6# See https://iextrading.com/api-exhibit-a/ for additional information
7# and conditions of use
8
9
10class TopsReader(IEX):
11    """
12    Near-real time aggregated bid and offer positions
13
14    Notes
15    -----
16    IEX's aggregated best quoted bid and offer position for all securities
17    on IEX's displayed limit order book.
18    """
19
20    def __init__(
21        self, symbols=None, start=None, end=None, retry_count=3, pause=0.1, session=None
22    ):
23        super(TopsReader, self).__init__(
24            symbols=symbols,
25            start=start,
26            end=end,
27            retry_count=retry_count,
28            pause=pause,
29            session=session,
30        )
31
32    @property
33    def service(self):
34        """Service endpoint"""
35        return "tops"
36
37
38class LastReader(IEX):
39    """
40    Information of executions on IEX
41
42    Notes
43    -----
44    Last provides trade data for executions on IEX. Provides last sale price,
45    size and time.
46    """
47
48    # todo: Eventually we'll want to implement WebSockets as an option.
49    def __init__(
50        self, symbols=None, start=None, end=None, retry_count=3, pause=0.1, session=None
51    ):
52        super(LastReader, self).__init__(
53            symbols=symbols,
54            start=start,
55            end=end,
56            retry_count=retry_count,
57            pause=pause,
58            session=session,
59        )
60
61    @property
62    def service(self):
63        """Service endpoint"""
64        return "tops/last"
65