asynctradier.clients.streaming_client module

class asynctradier.clients.streaming_client.StreamingClient(session: WebUtil, account_id: str, token: str, sandbox: bool = False)[source]

Bases: object

A client for streaming market data and order events.

Parameters:
  • session (WebUtil) – The session object for making HTTP requests.

  • account_id (str) – The ID of the account.

  • token (str) – The authentication token.

  • sandbox (bool, optional) – Whether to use the sandbox environment. Defaults to False.

async get_order(order_id: str) Order[source]

Get an order by its ID.

Parameters:

order_id (str) – The ID of the order.

Returns:

The Order object.

Return type:

Order

async stream_market_data(symbols: List[str], filters: List[MarketDataType] = None, linebreak: bool = True, valid_only: bool = True, advanced_details: bool = True) AsyncIterator[MarketData][source]

Streams market data for the given symbols.

Parameters:
  • symbols (List[str]) – The list of symbols to stream market data for.

  • filters (List[MarketDataType], optional) – The list of market data types to filter. Defaults to None.

  • linebreak (bool, optional) – Whether to include linebreaks in the streamed data. Defaults to True.

  • valid_only (bool, optional) – Whether to include only valid market data. Defaults to True.

  • advanced_details (bool, optional) – Whether to include advanced details in the market data. Defaults to True.

Yields:

MarketData – The streamed market data.

async stream_order(with_detail: bool = True) AsyncIterator[Order][source]

Stream order events.

Parameters:

with_detail (bool, optional) – Whether to include order details. Defaults to True.