Skip to content

snake_case query params: send top_n / min_volume_usd#80

Merged
martinkersner merged 2 commits into
mainfrom
issue-7398-snake-case-query-params
Jun 30, 2026
Merged

snake_case query params: send top_n / min_volume_usd#80
martinkersner merged 2 commits into
mainfrom
issue-7398-snake-case-query-params

Conversation

@martinkersner

Copy link
Copy Markdown
Member

Summary

Aligns the Python SDK with the backend snake_case query-param migration (#7343 / PR #7356 / #7359, docs #7365). top_n / min_volume_usd are PERMANENT public params (data-api + MCP); the SDK was still sending the old camelCase keys.

Not an outage fix — backend dual-read still accepts camelCase. Canonical-alignment cleanup.

Changes

  • liquidation.py heatmap() wire key topNtop_n.
  • open_interest.py summary() wire key topNtop_n.
  • _endpoints.py metadata keys topNtop_n (×2), minVolumeUsdmin_volume_usd (×2).

Design choice — Option A (keep public kwarg, snake_case only the wire key)

Kept the user-facing topN kwarg as-is and changed only the query-string key sent to the server. Zero breaking change; the issue explicitly allows user-facing names to stay. Renaming the kwarg would break existing callers for no behavioral gain. No SDK method exposes a minVolumeUsd kwarg, so only its metadata key needed renaming.

_endpoints.py codegen finding

_endpoints.py is generated (make python from openapi.yaml) — the generator/spec live upstream in the backend repo, not in this repo, so there is no local regen path here. The backend OpenAPI source (cmd/data-api/docs/openapi.yaml) already emits top_n / min_volume_usd as of #7365; the committed _endpoints.py was simply regenerated before that update and went stale. This is a manual edit that catches the SDK up — the next make python run reconciles cleanly (it will reproduce these same snake_case keys). I did not fabricate a codegen run.

Test plan

  • Added tests/test_query_params.py — offline responses-mocked tests asserting heatmap/summary send top_n on the wire (and topN is absent).
  • python -m pytest tests/test_query_params.py tests/test_api.py -v → 10 passed.
  • flake8 datamaxi/datamaxi/liquidation.py datamaxi/datamaxi/open_interest.py datamaxi/_endpoints.py tests/test_query_params.py → clean.
  • (Live tests in test_call.py / test_integration.py skip without DATAMAXI_API_KEY.)

Closes Bisonai/datamaxi-backend#7398

…keys

Align public query params with backend snake_case canonical (dual-read).
Wire keys top_n + min_volume_usd; public topN kwarg kept (non-breaking).
@martinkersner martinkersner self-assigned this Jun 29, 2026
@martinkersner martinkersner merged commit 9b521ea into main Jun 30, 2026
6 of 7 checks passed
@martinkersner martinkersner deleted the issue-7398-snake-case-query-params branch June 30, 2026 03:50
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