Skip to content

Streaming

Quote Stream

python
import asyncio
from trading_sdk import TradingClient

client = TradingClient(strategy_id="AQC-P1A2B3C4")

async def on_quote(data):
    print("Quote:", data)

asyncio.run(client.stream_quotes(["AAPL", "SPY"], on_quote))

Order Updates

python
import asyncio
from trading_sdk import TradingClient

client = TradingClient(strategy_id="AQC-P1A2B3C4")

def on_order_update(update):
    print("Order Update:", update)

asyncio.run(client.stream_order_updates(on_order_update))

The WebSocket endpoint is derived from base_url by replacing http(s) with ws(s) and connecting to /ws/market.