Skip to content

feat: add MetaAndAssetContexts to achieve `Retrieve perpetuals asset … #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

llvm-x86
Copy link
Contributor

…contexts (includes mark price, current funding, open interest, etc.)`

llvm-x86 added 4 commits May 14, 2025 18:28
…contexts (includes mark price, current funding, open interest, etc.)`
Introduce `AssetContext` and `MetaAndAssetCtxs` as generic
versions of `SpotAssetContext` and `SpotMetaAndAssetCtxs` respectively.
These new types allow for more flexible handling of metadata and
context for various asset types beyond spot.

The `AssetMeta` struct is enhanced with `max_leverage` and
`only_isolated` fields to better describe diverse asset
characteristics, such as those for perpetual contracts.

These changes facilitate broader asset type support within the system.
The `meta_and_asset_contexts` method in `InfoClient` now returns `Result<Vec<MetaAndAssetCtxs>>` instead of `Result<Vec<Meta>>`.

This change aligns the function's return type with the actual data structure provided by the corresponding API endpoint, which includes both metadata and asset contexts. This improves type safety and ensures clients receive the complete expected information.
Modify `meta_and_asset_contexts` to return `(Meta, Vec<AssetContext>)`.
This change enhances robustness by deserializing `AssetContext`
entries individually from raw JSON values, skipping any that fail.
Previously, a single malformed context could cause the entire
`MetaAndAssetCtxs` request to fail.

Additionally, removed `#[allow(dead_code)]` attributes from
`MetaAndAssetCtxs` enum variants and related structs in `meta.rs`
as part of this refinement.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant