Skip to content

Convert 4 client methods off dead params onto request_endpoint (SDK-side fix) #116

Description

@martinkersner

Corrected diagnosis (supersedes the original "registry missing params" framing)

Original theory: _endpoints.py / openapi.yaml was missing params the live API accepts, so the SDK was "ahead" of the spec and converting these 5 methods would regress real behavior. That is backwards. Verified against the Go backend (datamaxi-backend, cmd/data-api / pkg/api*):

cmd/data-api/docs/openapi.yaml is generated by swaggo from @Param annotations on each handler, and those mirror exactly what the handler reads via c.Query(...). So _endpoints.py (codegen ← openapi.yaml ← handler) faithfully reflects the live backend contract. "Registry lacks param X" ⇔ the handler never reads X.

In all 5 cases the SDK sends a param the current handler silently ignores (fiber drops unknown query keys):

SDK sends Backend handler reads Verdict
funding_rate.latest: sort, limit only exchange, symbol dead params
cex_token.updates: sort type, page, limit; sort = hardcoded defaultSort dead param
premium.__call__: camelCase sourceExchange snake_case source_exchange… (dataapipremium/handler.go:388) wrong casing → ignored
cex_symbol.volume: exchange base, market dead param
cex_symbol.delistings: base exchange, market, from_ms, to_ms dead param

The SDK is not ahead of the API — it carries vestigial / mis-cased params accumulated over years of hand-editing. The registry is the correct current contract. The mocked SDK tests that assert e.g. qs["sort"] == ["desc"] pin a fictional wire contract (a param that never affects the real response).

Corrected remediation

  • Do NOT add these params upstream to openapi.yaml / datamaxi-codegen — the backend doesn't support them; that would make the registry lie to match the SDK's stale expectation.
  • The fix is SDK-side: convert the 5 methods onto request_endpoint, dropping the dead params, and update the over-specified mocked tests that assert them.
  • These 5 are convertible — no upstream dependency.

Per-method

  • funding_rate.latest — drop sort/limit from the wire. (latest() test only asserts DataFrame shape, so it passes unchanged; decide whether to keep the kwargs as accepted-but-ignored no-ops or remove them.)
  • cex_token.updates — drop sort from the wire; update test_cex_token which asserts qs["sort"].
  • cex_symbol.volume — drop exchange; update test.
  • cex_symbol.delistings (+ cautions) — drop base; update test.
  • premium.__call__genuine breaking change: rename camelCase → snake_case to match dataapipremium.Handler, reconcile the filter param set against what the handler actually reads. Needs a deliberate public-interface decision; treat as its own item.

Done when

  • The 4 non-breaking methods (latest, updates, volume, delistings/cautions) go through request_endpoint; their tests updated to the real contract.
  • premium.__call__ decision made and (if approved) converted.
  • grep for /api/v clean in datamaxi/**.py except _endpoints.py + doc-link comments.

Certainty

latest and token/updates handlers verified line-by-line. premium, volume, delistings confirmed at the c.Query level but not chased through possible remapping middleware / front-vs-data-API split — treat premium as "very likely," verify param-by-param before the breaking rename.

Follow-up to #114 / PR #115 (which converts the other ~9 modules and merges independently).

Metadata

Metadata

Assignees

Labels

claude-foundSurfaced by ClaudereviewAuto-detected by Claude during /review

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