Skip to content

[Exchange] Consolidate to a single combined WebSocket stream + IExchangeClientFactory #3

@jackby03

Description

@jackby03

Summary

BinanceClient manually builds three separate WebSocket streams (kline, depth, trades). Binance supports combined streams via a single connection which reduces overhead and simplifies reconnect logic.

What needs to be done

  • Replace individual stream connections with a single combined stream:
    wss://stream.binance.com:9443/stream?streams=btcusdt@kline_1m/btcusdt@depth20/btcusdt@trade
  • Route each message by stream field to the correct handler
  • Support dynamic stream subscription updates (change symbol/interval without full reconnect)
  • Implement IExchangeClientFactory to create and manage named client instances

Acceptance criteria

  • Single WebSocket handles kline + depth + trade streams
  • Stream key routing dispatches to correct handler
  • Symbol/interval change reuses existing connection (resubscribe)
  • IExchangeClientFactory.Create(clientId) returns an isolated client instance
  • No regressions on candle / orderbook / trade data feeds

References

  • src/Omnijure.Core/Entities/Exchange/BinanceClient.cs
  • src/Omnijure.Core/Entities/Exchange/IExchangeClientFactory.cs
  • Binance combined stream docs: wss://stream.binance.com:9443/stream

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions