Real-Time Data#
CryptoDataStream#
- class alpaca.data.live.crypto.CryptoDataStream(api_key: str, secret_key: str, raw_data: bool = False, feed: CryptoFeed = CryptoFeed.US, url_override: Optional[str] = None, websocket_params: Optional[Dict] = None)#
A WebSocket client for streaming live crypto data.
See BaseStream for more information on implementation and the methods available.
- async close() None #
Closes the websocket connection.
- run() None #
Starts up the websocket connection’s event loop
- stop() None #
Stops the websocket connection.
- async stop_ws() None #
Signals websocket connection should close by adding a closing message to the stop_stream_queue
- subscribe_bars(handler: Callable, *symbols) None #
Subscribe to minute bar data for symbol inputs
- Parameters:
handler (Callable) – The coroutine callback function to handle live minute bar data
*symbols – Variable string arguments for ticker identifiers to be subscribed to.
- subscribe_daily_bars(handler: Callable, *symbols) None #
Subscribe to daily bar data for symbol inputs
- Parameters:
handler (Callable) – The coroutine callback function to handle live daily bar data
*symbols – Variable string arguments for ticker identifiers to be subscribed to.
- subscribe_quotes(handler: Callable, *symbols) None #
Subscribe to quote data for symbol inputs
- Parameters:
handler (Callable) – The coroutine callback function to handle live quote data
*symbols – Variable string arguments for ticker identifiers to be subscribed to.
- subscribe_trades(handler: Callable, *symbols) None #
Subscribe to trade data for symbol inputs
- Parameters:
handler (Callable) – The coroutine callback function to handle live trade data
*symbols – Variable string arguments for ticker identifiers to be subscribed to.
- subscribe_updated_bars(handler: Callable, *symbols) None #
Subscribe to updated bar data for symbol inputs
- Parameters:
handler (Callable) – The coroutine callback function to handle live updated bar data
*symbols – Variable string arguments for ticker identifiers to be subscribed to.
- unsubscribe_bars(*symbols) None #
Unsubscribe from minute bar data for symbol inputs
- Parameters:
*symbols – Variable string arguments for ticker identifiers to be unsubscribed from.
- unsubscribe_daily_bars(*symbols) None #
Unsubscribe from daily bar data for symbol inputs
- Parameters:
*symbols – Variable string arguments for ticker identifiers to be unsubscribed from.
- unsubscribe_quotes(*symbols) None #
Unsubscribe from quote data for symbol inputs
- Parameters:
*symbols – Variable string arguments for ticker identifiers to be unsubscribed from.
- unsubscribe_trades(*symbols) None #
Unsubscribe from trade data for symbol inputs
- Parameters:
*symbols – Variable string arguments for ticker identifiers to be unsubscribed from.
- unsubscribe_updated_bars(*symbols) None #
Unsubscribe from updated bar data for symbol inputs
- Parameters:
*symbols – Variable string arguments for ticker identifiers to be unsubscribed from.