Problem
Endpoints return raw dict/list (or DataFrames), so users index by guessed keys (res["data"][0]["p"]) with no autocomplete or type checking on outputs. PR #136 gave Literal typing to inputs; outputs have none.
Proposal
Add lightweight typed models per response (start with the high-traffic ones: candle, ticker, premium):
TypedDict for the dict-return path (cheap, no runtime cost), or
- dataclasses if we want attribute access + validation.
- Keep
pandas=True DataFrame path as-is.
Notes
- Could be generated from the same OpenAPI spec that feeds
_endpoints.py (codegen upstream) to avoid drift.
- Incremental: type one endpoint family at a time.
Problem
Endpoints return raw
dict/list(or DataFrames), so users index by guessed keys (res["data"][0]["p"]) with no autocomplete or type checking on outputs. PR #136 gaveLiteraltyping to inputs; outputs have none.Proposal
Add lightweight typed models per response (start with the high-traffic ones: candle, ticker, premium):
TypedDictfor the dict-return path (cheap, no runtime cost), orpandas=TrueDataFrame path as-is.Notes
_endpoints.py(codegen upstream) to avoid drift.