Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Conversation

@alicanalbayrak
Copy link

Binance provides to access multiple symbols at single websocket connection by combining stream names.

Combined streams are accessed at /stream?streams<streamName1>/<streamName2>/<streamName3>

Here, I added trivial method to listen candlestick events on multiple symbols.

@mcourteaux
Copy link

Have you actually tested this? Because the documentation states that you need to use

  • Combined streams are accessed at /stream?streams=<streamName1>/<streamName2>/<streamName3>

Whereas you seem to be using this:

public static final String WS_API_BASE_URL = "wss://stream.binance.com:9443/ws";

The documentation also states that the combined streams are wrapped:

Combined stream events are wrapped as follows: {"stream":"<streamName>","data":<rawPayload>}

You also don't seem to do any unwrapping. I'd be surprised if your proposed changes would work, given that they are so non-conform the documentation.

Copy link

@mcourteaux mcourteaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Unwrapping not done.
  • Wrong API WSS endpoint.

@alicanalbayrak
Copy link
Author

I'm suprised too, I have tested and its working. You are right, I wasn't aware that I'm using this "wss://stream.binance.com:9443/ws"; endpoint.

@alicanalbayrak
Copy link
Author

@mcourteaux I have added methods to consume (aggregated trade, depth and candlestick events ) from "wss://stream.binance.com:9443/stream?streams="

@mcourteaux
Copy link

I'll review your changes soon. We also implemented working combined streams. I'll compare your changes to ours. Still working on something else now.

@joaopsilva
Copy link
Member

Hi @alicanalbayrak , thanks for your contribution, could you please resolve the conflicts?

@alicanalbayrak
Copy link
Author

alicanalbayrak commented Mar 12, 2018

Hi @joaopsilva , sorry for the late reply. I resolved conflicting files. Can you please review?

Copy link
Member

@joaopsilva joaopsilva left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @alicanalbayrak , this is looking good, I'll need to test a bit further, and I'll most likely merge it afterwards.

@hsinhunglee
Copy link

Hi, it looks doesn't work. I find the bug at
main.java.com.binance.api.client.impl/BinanceApiWebSocketClientImpl.java
correct:
String streamingUrl = String.format("%s%s", streamUrl, channel);
wrong:
String streamingUrl = String.format("%s/%s", streamUrl, channel);
I corrected it, then it work!

@Gilianp
Copy link

Gilianp commented Jul 9, 2018

As mensioned by @hsinhunglee, when remove "/" from format the problem is fixed :)

@joaopsilva
Copy link
Member

Fixed in #178.

@joaopsilva joaopsilva closed this Sep 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants