The CexCandle pilot (#113) landed API.request_endpoint(op_id, **params) and the generated datamaxi/_endpoints.py. This issue tracks converting the remaining client classes off hardcoded paths onto the registry, so endpoint paths / methods / path-query split / required params / defaults are single-sourced from the backend spec via datamaxi-codegen.
Scope
~13 modules still hardcode ~41 /api/v… paths. Convert each (follow CexCandle as the template):
Pattern (per method)
Replace the hardcoded url_path + manual param-dict assembly with self.request_endpoint("<op_id>", **wire_params). Keep hand-written: method signatures, doc-link docstrings, semantic checks (enum-vs-constant like market ∈ [spot, futures], custom error messages), and response shaping (DataFrame conversion). Map Pythonic kwargs to wire names at the call site (e.g. **{"from": from_unix}).
Op_ids: see keys in datamaxi/_endpoints.py (derived from the path, e.g. /api/v1/cex/candle → cex_candle).
Decision to settle first
Whether request_endpoint should own required/enum validation (currently the classes still do their own). Owning it in the helper trims more hand code but changes some error messages/behavior (e.g. currency=None would fill the default instead of raising). Pick one policy and apply consistently across the rollout.
Watch out for
- Reserved-word / renamed params (
from→from_unix, to→to_unix) — map at the call site.
- Endpoints with
in: path params (none in the current spec, but request_endpoint already interpolates them).
- Keep the existing mocked tests passing unmodified per class — they pin the wire contract (public interface must not change).
Done when
- No client module hardcodes an
/api/v… path (all go through request_endpoint); grep is clean except _endpoints.py.
- Full suite green (
pytest), black/flake8 clean.
- Public interface unchanged (existing tests pass unmodified).
Related: #113 (pilot), datamaxi-codegen PR #19 (pipeline) and issues #20 (drift-guard automation) / #21 (black-clean emitter).
The CexCandle pilot (#113) landed
API.request_endpoint(op_id, **params)and the generateddatamaxi/_endpoints.py. This issue tracks converting the remaining client classes off hardcoded paths onto the registry, so endpoint paths / methods / path-query split / required params / defaults are single-sourced from the backend spec via datamaxi-codegen.Scope
~13 modules still hardcode ~41
/api/v…paths. Convert each (follow CexCandle as the template):Pattern (per method)
Replace the hardcoded
url_path+ manual param-dict assembly withself.request_endpoint("<op_id>", **wire_params). Keep hand-written: method signatures, doc-link docstrings, semantic checks (enum-vs-constant likemarket ∈ [spot, futures], custom error messages), and response shaping (DataFrame conversion). Map Pythonic kwargs to wire names at the call site (e.g.**{"from": from_unix}).Op_ids: see keys in
datamaxi/_endpoints.py(derived from the path, e.g./api/v1/cex/candle→cex_candle).Decision to settle first
Whether
request_endpointshould ownrequired/enumvalidation (currently the classes still do their own). Owning it in the helper trims more hand code but changes some error messages/behavior (e.g.currency=Nonewould fill the default instead of raising). Pick one policy and apply consistently across the rollout.Watch out for
from→from_unix,to→to_unix) — map at the call site.in: pathparams (none in the current spec, but request_endpoint already interpolates them).Done when
/api/v…path (all go throughrequest_endpoint); grep is clean except_endpoints.py.pytest),black/flake8clean.Related: #113 (pilot), datamaxi-codegen PR #19 (pipeline) and issues #20 (drift-guard automation) / #21 (black-clean emitter).