-
-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for futures WS API #444
Comments
Hi @Luke-Rogerson - yes, the current one is still valid. There's actually two difference concepts here and the naming of the "new" one isn't the most obvious thing. There's the traditional websockets (event emitters, binance is a producer, you're a consumer) where you subscribe to topics/channels and receive data (one-way), then there's a newer websocket that can be used a bit like a REST API. This is what binance has called WebSocket API. This nifty new system allows you to send orders and other commands over a websocket connection, shaving off some of the latency you would see from a traditional REST API. If you're looking to consume events (market data, account events, etc), that's fully supported as is with the current WebSocket client. That's either the WebSocket Market Streams, listed here for USDM futures: Or the user data stream (for account events), listed here: I have some minimal examples for both types of events: All consumer websockets are wrapped up in convenience functions in the ws client, you can see them here: If you're not sure which you need, I'd suggest to check the docs to see which websocket topic/channel has what you want, then search in the websocket-client to see if there's a function mapped to it. We're still in the process of adding some of the newer ones, so if you see anything you're missing - let us know or submit a PR. Otherwise we'll get to updating it all eventually. |
Also the WebSocket API is a curious one. While it's not supported in this SDK for binance yet, I will be adding support for it soon. My gate.io SDK is actually the first one to see an implementation of a WS API and I'm likely to bring the same design over to the binance SDK (as well as my other SDKs for exchanges that have a WS API). So if you'd like to see how that can work in practice, take a look at the gate SDK. Some docs here: Also an example here where you can see a minimal implementation in action: It's a great time for feedback/concerns, if you'd like to influence how the final implementation will look/work, so if this is something you will use in future please do take a look and ideally try it out. |
The new Binance API documentation specifies a different websocket endpoint to the one specified in your base URLs.
wss://fstream.binance.com
wss://ws-fapi.binance.com/ws-fapi/v1
Do you know if your one is still valid? If not, is there a planned cutover time? Binance certainly don't write the clearest documentation!
The text was updated successfully, but these errors were encountered: