Expand description
WebSocket-based asset information providers and streaming mechanisms.
This module provides functionality for streaming asset information in real-time from WebSocket APIs. It defines traits for WebSocket connectors and providers, as well as a function for starting a listening loop.
The module provides:
- The
AssetInfoProviderConnectortrait for creating WebSocket connections - The
AssetInfoProvidertrait for managing WebSocket subscriptions and data - The
Dataenum for different types of received data - The
start_listeningfunction which implements the WebSocket listener loop
§WebSocket Strategy
The WebSocket strategy follows these principles:
- Persistent Connections: Maintains persistent WebSocket connections for real-time data
- Automatic Reconnection: Automatically reconnects with exponential backoff if the connection is lost
- Subscription Management: Provides a standard way to subscribe to asset updates
- Error Resilience: Handles connection failures and data errors gracefully
When implementing new WebSocket-based asset providers, implement both the
AssetInfoProviderConnector and AssetInfoProvider traits, and use the
start_listening function to handle the connection lifecycle.
Enums§
- Data
- Represents different types of data that can be received from a WebSocket connection.
Traits§
- Asset
Info Provider - Trait for providers that can stream asset information from WebSocket APIs.
- Asset
Info Provider Connector - Trait for factory objects that can establish connections to WebSocket providers.
Functions§
- start_
listening - Starts listening for asset information from a WebSocket provider.