Async client¶
Async wrapper for PythPandas.
Wraps the synchronous client via composition, running each method in a
ThreadPoolExecutor for non-blocking behavior in asyncio contexts.
All public methods from PythPandas are auto-generated as async
wrappers — new mixin methods become available without changes here.
- Usage:
>>> async with AsyncPythPandas() as client: ... df = await client.fetch_latest_prices(symbols=["Crypto.BTC/USD"], properties=["price"])
- class pyth_pandas.async_client.AsyncPythPandas(*, max_workers=10, **kwargs)[source]¶
Bases:
objectAsync version of
PythPandas.Accepts the same constructor arguments. Internally creates a synchronous
PythPandasinstance and runs its methods in a thread pool.- Parameters:
max_workers (int)
- async fetch_latest_prices(*args, **kwargs)¶
Fetch the latest update and return it as a parsed-feed DataFrame.
Same arguments as
fetch_latest_prices_raw(). The returned DataFrame has one row per feed; the on-chain payloads andtimestampUsare attached ondf.attrs.- Parameters:
properties – Feed properties to include.
formats – On-chain payload formats. Defaults to
[](parsed only).channel – Update channel.
price_feed_ids – Numeric feed IDs (mutually exclusive with
symbols).symbols – Feed symbols (e.g.
["Crypto.BTC/USD"]).json_binary_encoding –
"hex"or"base64".
- Returns:
DataFrame conforming to
ParsedFeedSchema.- Return type:
DataFrame[ParsedFeedSchema]
- async fetch_latest_prices_raw(*args, **kwargs)¶
Fetch the latest available update for the requested feeds.
- Parameters:
properties – Feed properties to include (
price,confidence,exponent, …).formats – On-chain payload formats to include (
evm,solana,leEcdsa,leUnsigned).channel – Update channel —
real_timeorfixed_rate@*.price_feed_ids – Numeric feed IDs. Mutually exclusive with
symbols.symbols – Feed symbols (e.g.
["Crypto.BTC/USD"]).parsed – Include the
parsedblock in the response.json_binary_encoding –
"hex"or"base64"for binary payloads.
- Returns:
The raw
JsonUpdatedict.- Raises:
PythAPIError – For any non-2xx response from the upstream API.
- Return type:
- async fetch_prices(*args, **kwargs)¶
DataFrame variant of
fetch_prices_raw().- Returns:
DataFrame conforming to
ParsedFeedSchema.- Return type:
DataFrame[ParsedFeedSchema]
- async fetch_prices_raw(*args, **kwargs)¶
Fetch updates issued at a specific point in time.
- Parameters:
timestamp – Microsecond-resolution Unix timestamp. Accepts an int (interpreted as µs if >= 10**14, else seconds), a
pd.Timestamp, or an ISO-8601 string.properties – Feed properties to include.
formats – On-chain payload formats.
channel – Update channel.
price_feed_ids – Numeric feed IDs.
symbols – Feed symbols.
parsed – Include parsed block.
json_binary_encoding – Binary payload encoding.
- Returns:
The raw
JsonUpdatedict.- Return type:
- async get_guardian_set_upgrade(*args, **kwargs)¶
Get the signed Wormhole guardian set upgrade VAA body, if any.
Active when both the current and next guardian sets are present in router state, indicating that a guardian set upgrade is in progress. Returns
Nonewhen no upgrade is in progress.- Returns:
The signed upgrade dict, or
Noneif not in progress.- Return type:
SignedGuardianSetUpgrade | None
- async reduce_price(*args, **kwargs)¶
DataFrame variant of
reduce_price_raw().- Return type:
DataFrame[ParsedFeedSchema]
- async reduce_price_raw(*args, **kwargs)¶
Reduce an existing on-chain payload to only the listed feeds.
- Parameters:
payload – A
JsonUpdatepreviously received fromfetch_latest_prices_raw,fetch_prices_raw, or the WebSocket stream.price_feed_ids – Subset of feed IDs to retain.
- Returns:
A new
JsonUpdatecontaining only the requested feeds.- Return type: