Skip to content

Commit 3bb79ef

Browse files
Sync generated _endpoints.py with backend spec (#204)
* chore: sync generated _endpoints.py with backend spec * Drop deprecated include_source param from cex ticker Backend spec no longer lists include_source on the ticker endpoint; _dispatch rejected it as unknown. Remove it from sync+async ticker resources and their dedicated tests.
1 parent 7f82870 commit 3bb79ef

7 files changed

Lines changed: 1 addition & 57 deletions

File tree

datamaxi/_endpoints.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,13 +1355,6 @@
13551355
"enum": ["USD", "USDT"],
13561356
"description": "Specifies conversion base applied to price values",
13571357
},
1358-
"include_source": {
1359-
"required": False,
1360-
"in": "query",
1361-
"type": "bool",
1362-
"default": False,
1363-
"description": "When true, include the frame's transport source (ws|rest) in the response.",
1364-
},
13651358
},
13661359
},
13671360
"ticker_exchanges": {

datamaxi/_responses.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,16 +1253,13 @@ class TickerResponse:
12531253
currency: str = ""
12541254
data: Optional[TickerView] = None
12551255
market: str = ""
1256-
# Source is populated only when ?include_source=true; omitempty drops the key for default callers, preserving the pre-Phase-1 JSON byte shape (strict-decoder safe).
1257-
src: Any = None
12581256

12591257
@classmethod
12601258
def from_dict(cls, data: dict) -> TickerResponse:
12611259
return cls(
12621260
currency=data.get("currency", ""),
12631261
data=_as_model(TickerView, data.get("data")),
12641262
market=data.get("market", ""),
1265-
src=data.get("src"),
12661263
)
12671264

12681265

datamaxi/aio/_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ async def request_endpoint(self, op_id, **params):
7272

7373
async def send_request(self, method, url_path, payload=None):
7474
# str()-encode scalars so bools match the sync client's urlencode
75-
# output (e.g. include_source -> "True", not httpx's "true").
75+
# output (e.g. a bool param -> "True", not httpx's "true").
7676
params = {k: str(v) for k, v in (payload or {}).items() if v is not None}
7777
attempt = 0
7878
while True:

datamaxi/aio/cex.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ async def get(
9999
market: Market,
100100
currency: Optional[str] = None,
101101
conversion_base: Optional[str] = None,
102-
include_source: bool = False,
103102
pandas: bool = True,
104103
) -> Union[pd.DataFrame, TickerResponse]:
105104
"""Fetch ticker data (async). See ``datamaxi.Datamaxi.cex.ticker``."""
@@ -120,7 +119,6 @@ async def get(
120119
market=market,
121120
currency=currency,
122121
conversion_base=conversion_base,
123-
include_source=include_source,
124122
)
125123

126124
if pandas:

datamaxi/resources/cex_ticker.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def get(
3030
market: Market,
3131
currency: Optional[str] = None,
3232
conversion_base: Optional[str] = None,
33-
include_source: bool = False,
3433
pandas: bool = True,
3534
) -> Union[pd.DataFrame, TickerResponse]:
3635
"""Fetch ticker data
@@ -45,8 +44,6 @@ def get(
4544
market (str): Market type (spot/futures)
4645
currency (str): Price currency
4746
conversion_base (str): Conversion base currency
48-
include_source (bool): Include the frame's transport source
49-
(``ws``|``rest``) in the response
5047
pandas (bool): Return data as pandas DataFrame
5148
5249
Returns:
@@ -71,7 +68,6 @@ def get(
7168
market=market,
7269
currency=currency,
7370
conversion_base=conversion_base,
74-
include_source=include_source,
7571
)
7672

7773
if pandas:

tests/test_async.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,28 +59,6 @@ async def run():
5959
assert res == _CANDLE
6060

6161

62-
def test_async_ticker_forwards_bool_param_like_sync():
63-
seen = {}
64-
65-
def handler(request):
66-
seen.update(dict(request.url.params))
67-
return httpx.Response(200, json=_TICKER)
68-
69-
async def run():
70-
async with _client(handler) as c:
71-
return await c.cex.ticker.get(
72-
exchange="binance",
73-
market="spot",
74-
symbol="BTC-USDT",
75-
include_source=True,
76-
)
77-
78-
df = _run(run())
79-
assert isinstance(df, pd.DataFrame)
80-
# bool encoded as "True" (matches the sync urlencode output), not "true"
81-
assert seen["include_source"] == "True"
82-
83-
8462
def test_async_last_response_populated():
8563
headers = {"x-ratelimit-remaining": "42"}
8664

tests/test_cex_ticker.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,6 @@ def test_ticker_get_sends_query_params():
5252
assert qs["conversion_base"] == ["USDT"]
5353

5454

55-
@responses.activate
56-
def test_ticker_get_forwards_include_source():
57-
responses.add(
58-
responses.GET,
59-
re.compile(".*/api/v1/ticker.*"),
60-
json=_TICKER,
61-
status=200,
62-
)
63-
_client().get(
64-
exchange="binance",
65-
market="spot",
66-
symbol="BTC-USDT",
67-
include_source=True,
68-
)
69-
qs = _qs(responses.calls[0])
70-
assert qs["include_source"] == ["True"]
71-
72-
7355
def test_ticker_invalid_market_raises_value_error():
7456
with pytest.raises(ValueError):
7557
_client().get(exchange="binance", market="bogus", symbol="BTC-USDT")

0 commit comments

Comments
 (0)