feat: add high-level wrappers for liquidation / open-interest / cex-symbol#78
Merged
Merged
Conversation
…ymbol
Previously the new endpoints shipped in 0.27.0 were only reachable via
the lower-level `client.<sub>.query(path, params)` escape hatch — the
auto-regen only updated `_endpoints.py` metadata, which the
hand-curated category classes don't actually consume.
This adds hand-written wrappers that match the existing class layout:
client.liquidation.heatmap(window="1h", topN=10)
client.liquidation.map(base="BTC")
client.liquidation.symbol_history(symbol="BTC", interval="5m")
client.open_interest.overview(limit=20)
client.open_interest.summary(topN=10)
client.open_interest.history_aggregated(token_id="bitcoin")
client.cex.symbol.oi(base="BTC")
client.cex.symbol.oi_stats(base="BTC", currency="USD")
client.cex.symbol.liquidation(base="BTC", window="24h")
Top-level `Liquidation` / `OpenInterest` mirror the REST grouping
under `/api/v1/{liquidation,open-interest}/*` and align with the
Rust SDK's typed wrappers in `datamaxi::generated::{Liquidation,
OpenInterest}`. `CexSymbol` is nested under `Cex` to match the
REST path layout (`/api/v1/cex/symbol/*`).
Each method validates the same params the BE enforces (window enum,
topN range, sort enum, currency enum) and surfaces ValueError early
rather than letting the call go through and 400.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The 9 OI / Liquidation / cex-symbol endpoints added in 0.27.0 were only callable via the lower-level `client..query(path, params)` escape hatch. This adds hand-written wrappers so they're reachable as typed methods on the high-level client surface.
New surface
```python
from datamaxi import Datamaxi
c = Datamaxi(api_key="YOUR_KEY")
Liquidation
c.liquidation.heatmap(window="1h", topN=10)
c.liquidation.map(base="BTC")
c.liquidation.symbol_history(symbol="BTC", interval="5m", window="24h")
Open Interest
c.open_interest.overview(limit=20)
c.open_interest.summary(topN=10)
c.open_interest.history_aggregated(token_id="bitcoin", interval="1h")
CEX symbol per-base aggregates
c.cex.symbol.oi(base="BTC")
c.cex.symbol.oi_stats(base="BTC", currency="USD")
c.cex.symbol.liquidation(base="BTC", window="24h")
```
Plus existing-but-newly-exposed: `cex.symbol.tags / metadata / cautions / delistings / volume` and `open_interest()` / `open_interest.list()` / `liquidation()` / `liquidation.feed()`.
Why hand-written
The Python SDK's category-class layout is hand-curated. The codegen only fills `_endpoints.py` metadata and never wired methods into the class hierarchy. Extending the emitter to also generate class wrappers is a separate, larger change; this PR ships a usable surface today while staying within the established pattern (one module per category, validates params, calls `self.query(path, params)`).
Test plan