Skip to content

feat: migrate USDⓈ-M futures WS to /public /market /private endpoints#985

Open
pcriadoperez wants to merge 5 commits intoccxt:masterfrom
pcriadoperez:ws-endpoints
Open

feat: migrate USDⓈ-M futures WS to /public /market /private endpoints#985
pcriadoperez wants to merge 5 commits intoccxt:masterfrom
pcriadoperez:ws-endpoints

Conversation

@pcriadoperez
Copy link
Copy Markdown
Contributor

Route futures WebSocket streams to Binance's new category-based URLs (public/market/private) per the 2026-03-06 upgrade notice.
Auto-classifies streams: bookTicker/depth → /public/, aggTrade/kline/ticker/etc → /market/, listenKey → /private/.
Demo/test environments keep legacy URLs. Legacy production URLs retire 2026-04-23.

Route futures WebSocket streams to Binance's new category-based URLs
per the 2026-03-06 upgrade notice. Legacy URLs retire 2026-04-23.
The new /private/ endpoint requires ?listenKey=<key> format
instead of the legacy path-based /<key> format.
@pcriadoperez pcriadoperez marked this pull request as ready for review April 6, 2026 01:28
@pcriadoperez
Copy link
Copy Markdown
Contributor Author

Test Results — 35 passing (11s)

New migration tests (30 tests):

  classifyFuturesStream
    ✔ classifies bookTicker as public
    ✔ classifies depth streams as public
    ✔ classifies aggTrade as market
    ✔ classifies markPrice as market
    ✔ classifies kline as market
    ✔ classifies ticker as market
    ✔ classifies miniTicker as market
    ✔ classifies forceOrder as market
    ✔ classifies compositeIndex as market
    ✔ classifies contractInfo as market
    ✔ classifies assetIndex as market
    ✔ classifies listenKey as private

  getFStreamSingleUrl with category
    ✔ returns public ws URL
    ✔ returns market ws URL
    ✔ returns private ws URL
    ✔ returns legacy URL without category

  getFStreamUrl with category
    ✔ returns public stream URL
    ✔ returns market stream URL
    ✔ returns private stream URL
    ✔ returns legacy URL without category

  Demo mode uses category-based URLs
    ✔ getFStreamSingleUrl returns demo URL with category
    ✔ getFStreamUrl returns demo URL with category
    ✔ getFStreamSingleUrl returns legacy demo URL without category
    ✔ getFStreamUrl returns legacy demo URL without category

  Private stream URL uses query params for listenKey
    ✔ constructs ?listenKey= URL instead of path-based
    ✔ constructs query-param URL for demo too

  Live: production market stream (aggTrade via /market/)
    ✔ receives aggTrade data from /market/ endpoint

  Live: production public stream (bookTicker via /public/)
    ✔ receives bookTicker data from /public/ endpoint

  Live: demo private stream (userFutureData via /private/)
    ✔ connects to private user data stream successfully

  Live: production combined market stream (kline via /market/)
    ✔ receives kline data from /market/ combined stream

Existing futures WS tests (5 tests, regression check):

  Websockets candlesticks
    ✔ Calls spot candlesticks websocket
  Websockets futures ticker stream
    ✔ Calls prevDay websocket for symbol
  Websockets miniticker
    ✔ check miniticker websocket
  Websockets chart
    ✔ Calls chart websocket
  Websockets aggregated trades
    ✔ Calls trades websocket

Live tests verified against:

  • Production /public/ws/, /market/ws/, /market/stream?streams=
  • Demo /private/ws?listenKey= (userFutureData)

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