Marketdata
Get market status
Get the market status for a symbol and venue, e.g. if it's currently quoting or trading.
status = await client.get_market_status(
symbol="BTC Crypto/USD",
venue="COINBASE"
)
Get ticker
Get a marketdata ticker for a symbol and venue. Tickers include basic summary statistics like volumes, open interest, settlement price, as well as slowly changing dimensions e.g. dividend yields, P/E ratios, market caps for equities.
ticker = await client.get_ticker(
symbol="AAPL US Equity/USD",
venue="US-EQUITIES"
)
Get L1 book snapshot
snap = await client.get_l1_book_snapshot(
symbol="GC 20250626 CME Future/USD",
venue="CME"
)
# get multiple snapshots
snaps = await client.get_l1_book_snapshots(
symbols=["GC 20250626 CME Future/USD", "ES 20250620 CME Future/USD"],
venue="CME"
)
Stream L1 book snapshots
Stream L1 book snapshots for the given symbols, for the given venue.
async for snap in client.stream_l1_book_snapshots(
symbols=["BTC Crypto/USD"],
venue="COINBASE"
):
print(snap)
Subscribe to L1 book
Subscribe to the L1 book for a symbol and venue in a background task. The current state of the book is available anytime via the returned reference. Calling subscribe again for the same symbol and venue will return the same reference. Call the unsubscribe method to terminate the subscription.
book = await client.subscribe_l1_book(
symbol="BTC Crypto/USD",
venue="COINBASE"
)
# ...
await client.unsubscribe_l1_book(
symbol="BTC Crypto/USD",
venue="COINBASE"
)
Get L2 book snapshot
book = await client.get_l2_book_snapshot(
symbol="GC 20250626 CME Future/USD",
venue="CME"
)
Stream L2 book updates
Stream L2 book updates for a given symbol and venue. This is a diff stream; the first message will contain a full snapshot, and subsequent messages represent diffs to be applied successively to maintain the state of the book.
from architect_py import L2BookSnapshot, L2BookDiff
async for update in client.stream_l2_book_updates(
symbol="BTC Crypto/USD",
venue="COINBASE"
):
if isinstance(update, L2BookSnapshot):
print(update)
elif isinstance(update, L2BookDiff):
print(update)
Applying diffs
For each diff message, a price level with non-zero quantity indicates that that price level should be updated to the stated quantity. A price level with a quantity of zero indicates that the price level should be removed from the book.
Sequence numbers
Sequence numbers are monotonically increasing integers that are assigned to each message. They can be used to detect gaps in the stream. From the first snapshot, each diff message should have a sequence number that is exactly one greater than the sequence number of the last received update.
Additionally, messages include a sequence ID field. Sequence IDs must be the same for all updates in a stream; if the sequence ID is observed to change, diff updates are no longer valid and the subscription should be restarted with a new snapshot.
Subscribe to L2 book
Subscribe to and maintain an L2 book for a given symbol and venue in a background task. The current state of the book is available anytime via the returned reference. Calling subscribe again for the same symbol and venue will return the same reference.
book = await client.subscribe_l2_book(
symbol="BTC Crypto/USD",
venue="COINBASE"
)
Stream trades
Stream the latest trades for a given symbol and venue.
async for trade in client.stream_trades(
symbol="BTC Crypto/USD",
venue="COINBASE"
):
print(trade)
Stream candles (klines)
Candles are produced at different fixed periods and include the open, high, low, close, and volumes for that period. Not all exchange feeds produce all candle widths.
from architect_py import CandleWidth
stream = client.stream_candles(
symbol="BTC Crypto/USD",
venue="COINBASE",
candle_widths=[CandleWidth.OneSecond]
)
async for candle in stream:
print(candle)
Streaming candles availability and request limits
CME
1s, 1h, 15m, 1h, 1d
CFE
1s, 1h, 15m, 1h, 1d
US-EQUITIES
Get historical candles
Retrieve historical candles for a symbol and venue.
from architect_py import CandleWidth
from datetime import datetime, timedelta, timezone
candles = await client.get_historical_candles(
symbol="GC 20250428 CME Future/USD",
venue="CME",
candle_width=CandleWidth.OneHour,
start=datetime.now(timezone.utc) - timedelta(days=1),
end=datetime.now(timezone.utc)
# pass as_dataframe=True to return a pandas DataFrame
)
Historical candles availability and request limits
1s
8 hours
5s
1 day
1m
7 days
15m
90 days
1h
365 days (~1 year)
1d
3650 days (~10 years)
CME
CFE
US-EQUITIES
Last updated