Skip to content

feat: add high-level wrappers for liquidation / open-interest / cex-symbol#78

Merged
haminprk merged 1 commit into
mainfrom
feat/python-high-level-wrappers
May 13, 2026
Merged

feat: add high-level wrappers for liquidation / open-interest / cex-symbol#78
haminprk merged 1 commit into
mainfrom
feat/python-high-level-wrappers

Conversation

@haminprk
Copy link
Copy Markdown
Member

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

  • Local `pip install` + smoke test: 9/9 endpoints return data via the new high-level methods (against prod data-api)
  • `black --check` passes
  • Existing categories untouched

…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.
@haminprk haminprk merged commit e2a71cb into main May 13, 2026
7 checks passed
@haminprk haminprk deleted the feat/python-high-level-wrappers branch May 13, 2026 11:33
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