Build Your Own:

get_marketdepth() returns a live order book snapshot for a symbol, showing bid and ask levels side by side. Build one step by step:

Step 1 — Import the library

import icepython as ice

Step 2 - (Optional) Discover available market depth types for your symbol

ice.get_marketdepth_types('msft')
# ('NASDAQ - Order Book', 'NASDAQ - Book By Market Maker', 'NASDAQ - Book By Market Maker Ext', 'Arca - Order Book')

Step 3 - (Optional) Check available fields

ice.get_marketdepth_fields()
# ('MMID', 'Price', 'Size', 'Date', 'Time', 'Order ID', 'Orders', 'Exchange ID', 'Broker ID',
#  'Min Quantity', 'Min Increment', 'Min Balance Remaining')

Step 4 - Choose your symbol, depth type, and fields

symbol = 'msft'
mdtype = ''
fields = ['MMID', 'Price', 'Size']

Step 5 - Set your row limit and make the request

data = ice.get_marketdepth(symbol, mdtype, fields, maxrows=5)
print(data)

Step 6 - Read the output

(('', 'Bid.MMID', 'Bid.Price', 'Bid.Size', 'Ask.MMID', 'Ask.Price', 'Ask.Size'), (0, 'ARCX', 393.630016, 160, 'ARCX', 393.66, 80), (1, 'BATS', 393.630016, 80, 'NSDQ', 393.66, 1), (2, 'BATY', 393.630016, 40, 'EDGX', 393.68, 80), (3, 'NSDQ', 393.630016, 1, 'BATS', 393.68, 40), (4, 'MEMX', 393.62, 40, 'IEXX', 393.68, 40))