Skip to content

Fix premium camelCase wire keys + expand registry before converting premium.__call__ onto request_endpoint #119

Description

@martinkersner

Split out of #116 (which converts the 4 non-breaking methods). premium.__call__ was deferred because it is not safely convertible onto request_endpoint yet — the codegen registry (datamaxi/_endpoints.py, op premium) is incomplete for premium, so routing through request_endpoint (which rejects any param absent from the registry) would silently drop working filters.

Two problems, coupled

1. camelCase wire bug (real, live-affecting)

premium.__call__ hand-translates 4 snake_case kwargs into camelCase on the wire, which the snake_case backend ignores:

  • sourceExchange → should be source_exchange
  • targetExchange → should be target_exchange
  • sourceQuote → should be source_quote
  • targetQuote → should be target_quote

So source/target exchange + quote filtering is currently broken against the live API (params silently dropped). The public Python kwargs are already snake_case; only the wire keys are wrong.

2. registry is missing most premium filters (blocks request_endpoint conversion)

The premium registry entry lacks ~35 params the method sends. Evidence they are a registry gap, not dead params:

  • min/max asymmetry: the registry has min_sv/min_tv but not max_sv/max_tv. A backend supporting a min bound but silently ignoring the matching max is implausible — the registry is simply incomplete.
  • token_include/token_exclude are known-working (project memory: they accept full names like bitcoin, not tickers — confirmed from actual use). Absent from the registry.
  • Premium likely hits the front-api, whose params are not captured by the data-api swaggo→openapi.yaml that feeds codegen — so the gap is expected. See [[codegen-upstream]].

The full set currently sent but registry-absent: every min_/max_ pd/pdp/pdp{24h,4h,1h,30m,15m,5m}/spdp*/dsp/dtp filter, max_sv, max_tv, all _net/_source/_target_funding_rate bounds, source_funding_rate_interval, target_funding_rate_interval, token_include, token_exclude.

Remediation (two steps, in order)

  1. Now (SDK-side, no upstream dep): fix the 4 camelCase→snake_case wire keys on the existing self.query("/api/v1/premium", ...) path, keeping all filter params. Update tests/test_premium.py::test_premium_call_param_name_translation to assert source_exchange (not sourceExchange).
  2. Then (upstream): verify each premium filter param-by-param against the live backend; add the genuinely-supported ones to the OpenAPI spec so codegen re-emits them into the registry. Only after the registry is complete, convert premium.__call__ onto request_endpoint and update tests/test_integration.py premium cases (currently call min_pdp/token_include/etc.).

Done when

  • camelCase→snake_case wire fix shipped (step 1); live source/target filtering works.
  • premium registry gap reconciled upstream: every real premium filter present in datamaxi/_endpoints.py; token_include/token_exclude confirmed + added.
  • premium.__call__ routed through request_endpoint with no loss of filter params; tests/test_integration.py premium cases run without TypeError.

Context: reviewed during PR #117. The 4 non-breaking methods merged there. Supersedes the premium portion of #118.

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions