Skip to content
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

Connecting websockets to Binance.US #120

Open
hodlerhacks opened this issue Jul 10, 2021 · 3 comments
Open

Connecting websockets to Binance.US #120

hodlerhacks opened this issue Jul 10, 2021 · 3 comments

Comments

@hodlerhacks
Copy link

I see that on the REST API, the endpoint can be set to Binance.US. What about the WebSockets API, can it be used on Binance.US as well?

@tiagosiebler
Copy link
Owner

This should be possible using the new client implementations in #122. The websockets API exposes a method to connect to a full websocket URL, or you could look at expanding support for the US servers in the existing implementation.

Take a look at how getWsBaseUrl is hooked up in these utility methods:
https://github.com/tiagosiebler/binance/blob/v2.0.0/beta/src/websocket-client.ts#L774-L781

@hodlerhacks
Copy link
Author

Sorry, late response (I was on vacation). Thanks for confirming this is now possible. So the following is the recommended way of doing this, right?

wsClient = new WebsocketClient({
        api_key: apiKey,
        api_secret: apiSecret,
        beautify: true,
        wsUrl: <Binance US ws URL goes here>,
    }, logger);

@kenchambers
Copy link

@hodlerhacks

Yup, i am able to get it to work using binance us:

 let client = new WebsocketClient({
      wsUrl: 'wss://stream.binance.us:9443',
      api_key: process.env.BINANCE_REAL_KEY,
      api_secret: process.env.BINANCE_REAL_SECRET,
      beautify: true
    })

@tiagosiebler tiagosiebler changed the title Question: is Binance.US supported on WebSockets? Connecting websockets to Binance.US Mar 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants