Skip to content

Convert premium.__call__ onto request_endpoint; drop data-api-dead filters (#121)#124

Merged
martinkersner merged 1 commit into
mainfrom
issue-121-premium-request-endpoint
Jul 1, 2026
Merged

Convert premium.__call__ onto request_endpoint; drop data-api-dead filters (#121)#124
martinkersner merged 1 commit into
mainfrom
issue-121-premium-request-endpoint

Conversation

@martinkersner

Copy link
Copy Markdown
Member

Closes #121

Follow-up to #119 / PR #120 (Step 1, camelCase→snake_case wire fix). This is the deferred Step 2.

Correction to the issue premise

The issue proposed expanding the codegen registry upstream. That was investigated and dropped: verified against datamaxi-backend main that the data-api /api/v1/premium Go handler reads exactly the 21 query params already in datamaxi/_endpoints.py op premium. The ~34 extra kwargs premium.__call__ was sending are dead — silently ignored by data-api; they belong to the spec-excluded front-api /api/v1/front/premium. So no registry/backend changes.

Direction A (this PR)

Route Premium.__call__ through self.request_endpoint("premium", **params) instead of the hand-rolled self.query("/api/v1/premium", params), and drop the dead kwargs at the signature level (request_endpoint rejects any param absent from the registry).

Retained kwargs (20 + pandas): source_exchange, target_exchange, asset, source_quote, target_quote, sort, key, page, limit, currency, conversion_base, min_sv, min_tv, source_market, target_market, only_transferable, network, premium_type, token_include, token_exclude.

Dropped kwargs (dead): min_pd/max_pd, all min_pdp*/max_pdp* (incl. 24h/4h/1h/30m/15m/5m), min_dsp/max_dsp, min_dtp/max_dtp, all min_spdp*/max_spdp*, max_sv, max_tv, min/max net/source/target funding-rate, source/target funding_rate_interval.

Response handling (empty-data ValueError, DataFrame flatten of detail + annualized funding rates, pandas=False raw return) unchanged. exchanges() untouched.

Test plan

  • pytest -m "not integration": 113 passed, 11 skipped, 107 deselected.
  • Removed 5 integration methods that passed now-dropped kwargs (would raise TypeError): test_premium_min_pdp, test_premium_max_pdp, test_premium_min_max_pdp, test_premium_pdp24h_filters, test_premium_funding_rate_filters. Other premium integration tests (incl. test_premium_volume_filters using min_sv) intact.
  • flake8 + black --check clean. # noqa: C901 kept (complexity 23 > 10).

…lters (#121)

Route Premium.__call__ through request_endpoint("premium", **params) instead
of the hand-rolled self.query path, and drop ~34 kwargs that data-api's
/api/v1/premium handler never reads (they belong to the spec-excluded
front-api /api/v1/front/premium). Retain the 20 kwargs backed by the codegen
registry. No registry/backend changes.

Remove the 5 integration tests exercising the dropped kwargs.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@martinkersner martinkersner self-assigned this Jul 1, 2026
@martinkersner martinkersner merged commit 5102323 into main Jul 1, 2026
7 checks passed
@martinkersner martinkersner deleted the issue-121-premium-request-endpoint branch July 1, 2026 07:38
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.

Expand premium registry upstream + convert premium.__call__ onto request_endpoint (Step 2 of #119)

1 participant