Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions datamaxi/_ws_endpoints.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
"""
Auto-generated WebSocket channel registry from the datamaxi-backend WS surface.
DO NOT EDIT — regenerate with: make ws-python

Source: pkg/apiws/app.go route table + protobuf/*.proto + Go view structs.
The subscribe `param` formats come from overrides/ws_channels.json (the one
piece not derivable from those sources — see parse_ws.py).
"""

WS_BASE_PATH = "/ws/v1"
WS_AUTH_HEADER = "X-DTMX-APIKEY"

WS_CHANNELS = {
"/announcement/listing": {
"plan": "pro_plus",
"market": None,
"message": "ListingMessage",
"param": None,
"subscribe": True,
"unsubscribe": True,
},
"/announcement/listing/internal": {
"plan": "pro_plus",
"market": None,
"message": "InternalListingMessage",
"param": None,
"subscribe": True,
"unsubscribe": True,
},
"/forex": {
"plan": "basic",
"market": None,
"message": "ForexMessage",
"param": "SYMBOL",
"subscribe": True,
"unsubscribe": True,
"param_note": "fx pair e.g. USD-KRW, no exchange",
},
"/funding-rate": {
"plan": "basic",
"market": None,
"message": "FundingRateMessage",
"param": "SYMBOL@exchange",
"subscribe": True,
"unsubscribe": True,
"param_note": "UPPER symbol + lower exchange; verified live (handler.go doc comment is wrong — Bisonai/datamaxi-backend#7926)",
},
"/liquidation": {
"plan": "basic",
"market": None,
"message": "LiquidationMessage",
"param": "SYMBOL@exchange",
"subscribe": True,
"unsubscribe": False,
},
"/liquidation/feed": {
"plan": "basic",
"market": None,
"message": "LiquidationMessage",
"param": None,
"subscribe": False,
"unsubscribe": False,
},
"/open-interest": {
"plan": "basic",
"market": None,
"message": "OpenInterestMessage",
"param": "SYMBOL@exchange",
"subscribe": True,
"unsubscribe": False,
},
"/premium": {
"plan": "basic",
"market": None,
"message": "PremiumMessage",
"param": "src:tgt:tokenId:srcQuote:tgtQuote:srcMkt:tgtMkt",
"subscribe": True,
"unsubscribe": True,
},
"/ticker/futures": {
"plan": "basic",
"market": "futures",
"message": "TickerMessage",
"param": "SYMBOL@exchange[@currency@conversionBase]",
"subscribe": True,
"unsubscribe": True,
},
"/ticker/spot": {
"plan": "basic",
"market": "spot",
"message": "TickerMessage",
"param": "SYMBOL@exchange[@currency@conversionBase]",
"subscribe": True,
"unsubscribe": True,
},
}
161 changes: 161 additions & 0 deletions datamaxi/_ws_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
"""
Auto-generated WebSocket message models from the datamaxi-backend WS surface.
DO NOT EDIT — regenerate with: make ws-python

Source: pkg/apiws/app.go route table + protobuf/*.proto + Go view structs.
The subscribe `param` formats come from overrides/ws_channels.json (the one
piece not derivable from those sources — see parse_ws.py).
"""

from __future__ import annotations

from typing import Any, Dict, List, TypedDict # noqa: F401


# source: gostruct:pkg/apiforex/app.go::Forex
ForexMessage = TypedDict(
"ForexMessage",
{
"s": str,
"d": int,
"r": float,
},
total=False,
)


# source: gostruct:pkg/apifundingrate/types.go::Snapshot
FundingRateMessage = TypedDict(
"FundingRateMessage",
{
"f": float,
"i": int,
"e": str,
"id": str,
"s": str,
"b": str,
"q": str,
"d": int,
"p": int,
},
total=False,
)


# source: gostruct:pkg/apiannouncement/app.go::InternalListing
InternalListingMessage = TypedDict(
"InternalListingMessage",
{
"s": str,
"e": str,
"b": str,
"t": str,
"u": str,
"d": int,
},
total=False,
)


# source: proto:protobuf/liquidation.proto::liquidation
LiquidationMessage = TypedDict(
"LiquidationMessage",
{
"id": str,
"e": str,
"d": str,
"s": str,
"b": str,
"q": str,
"sd": str,
"p": float,
"pusd": float,
"pfiat": float,
"v": float,
"vusd": float,
"vfiat": float,
"pt": Dict[str, Any],
"pa": str,
"src": Any,
},
total=False,
)


# source: gostruct:pkg/apiannouncement/app.go::Listing
ListingMessage = TypedDict(
"ListingMessage",
{
"e": str,
"b": str,
"q": str,
"u": str,
"d": int,
},
total=False,
)


# source: proto:protobuf/open-interest.proto::open_interest
OpenInterestMessage = TypedDict(
"OpenInterestMessage",
{
"id": str,
"e": str,
"d": str,
"s": str,
"b": str,
"q": str,
"oi": float,
"oiusd": float,
"oifiat": float,
"pt": Dict[str, Any],
"pa": str,
},
total=False,
)


# source: gostruct:pkg/apipremium/handlers/dataapipremiumws/handler.go::PremiumOut
PremiumMessage = TypedDict(
"PremiumMessage",
{
"key": str,
"source_exchange": str,
"target_exchange": str,
"token_id": str,
"source_base": str,
"source_quote": str,
"target_quote": str,
"source_market": str,
"target_market": str,
"premium": float,
"source_price": float,
"target_price": float,
"timestamp": int,
},
total=False,
)


# source: gostruct:pkg/apiticker/app.go::View
TickerMessage = TypedDict(
"TickerMessage",
{
"p": float,
"v": float,
"p24h": float,
"pc": float,
"hb": float,
"la": float,
"ud": float,
"ld": float,
"e": str,
"s": str,
"b": str,
"q": str,
"d": int,
"m": str,
},
total=False,
)
Loading
Loading