avantis_trader_sdk.feed package
Submodules
avantis_trader_sdk.feed.feed_client module
- class avantis_trader_sdk.feed.feed_client.FeedClient(ws_url='wss://hermes.pyth.network/ws', on_error=None, on_close=None, hermes_url='https://hermes.pyth.network/v2/updates/price/latest', pair_fetcher=None)[source]
Bases:
object
Client for interacting with the Pyth price feed websocket.
- Parameters:
pair_fetcher (Callable)
- async default_pair_fetcher()[source]
Default pair fetcher that retrieves data from the Avantis API. :rtype:
List
[dict
] :returns: A list of validated trading pairs.- Raises:
ValueError if API response is invalid. –
- Return type:
List[dict]
- async get_latest_price_updates(identifiers)[source]
Retrieves the latest price updates for the specified feed ids.
- Parameters:
feedIds – The list of feed ids to retrieve the latest price updates for.
identifiers (List[str])
- Returns:
A PriceFeedUpdatesResponse object containing the latest price updates.
- get_pair_from_feed_id(feed_id)[source]
Retrieves the pair string from the feed id.
- Parameters:
feed_id – The feed id to retrieve the pair string for.
- Returns:
The pair string.
- async listen_for_price_updates()[source]
Listens for price updates from the Pyth price feed websocket. When a price update is received, the registered callbacks will be called with the updated price feed data.
- Raises:
Exception – If an error occurs while listening for price updates.