Exemplo n.º 1
0
 def test_deep(self):
     dob = get_iex_book('GS', service='book')
     if dob:
         assert 'GS' in dob
     else:
         pytest.xfail(reason='Can only get Book when market open')
 def test_deep(self):
     dob = get_iex_book("GS", service="book")
     if dob:
         assert "GS" in dob
     else:
         pytest.xfail(reason="Can only get Book when market open")
Exemplo n.º 3
0
 def test_deep(self):
     dob = get_iex_book('GS', service='system-event')
     assert len(dob['eventResponse']) > 0
     assert dob['timestamp'] > datetime.now() - timedelta(days=1)
Exemplo n.º 4
0
# IEX

start = datetime(2015, 2, 9)
# end = datetime(2017, 5, 24)

# iex = web.DataReader('FB', 'iex', start)
# iex.info()
#
# print(iex.tail())

# Book Data
# 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.
# Only works on trading days.

book = web.get_iex_book('AAPL')
print(list(book.keys()))

orders = pd.concat([pd.DataFrame(book[side]).assign(side=side) for side in ['bids', 'asks']])
print(orders.head())

for key in book.keys():
    try:
        print(f'\n{key}')
        print(pd.DataFrame(book[key]))
    except:
        print(book[key])

print(pd.DataFrame(book['trades']).head())

# Quandl