Python-binance: add support for binance.us

Created on 14 Nov 2019  路  10Comments  路  Source: sammchardy/python-binance

Add support for binance.us.
binance-python currently doesn't provide a way to configure API endpoints. I don't know if it is just a matter of making that configurable or there is more to it to start supporting binance.US

All 10 comments

I totally agree. any support for binance.us?

Do we need to change more than this file (https://github.com/sammchardy/python-binance/blob/master/binance/client.py)?

i have made some changes and got it working. I will raise a PR soon.

Joshith lets see it!

@joshith @NSSmithPortfolio @jiwoongim
Looks like #470 resolves this if/when it gets merged.

A workaround is to update the client's API URLs for each client instance or directly editing the file as @jiwoongim suggested :

binance_conn = Client(API_KEY, API_SECRET)
binance_conn.API_URL = 'https://api.binance.us/api'
binance_conn.WITHDRAW_API_URL = 'https://api.binance.us/wapi'
binance_conn.MARGIN_API_URL = 'https://api.binance.us/sapi'
binance_conn.WEBSITE_URL = 'https://www.binance.us'

@joshith @NSSmithPortfolio @jiwoongim
Looks like #470 resolves this if/when it gets merged.

A workaround is to update the client's API URLs for each client instance or directly editing the file as @jiwoongim suggested :

binance_conn = Client(API_KEY, API_SECRET)
binance_conn.API_URL = 'https://api.binance.us/api'
binance_conn.WITHDRAW_API_URL = 'https://api.binance.us/wapi'
binance_conn.MARGIN_API_URL = 'https://api.binance.us/sapi'
binance_conn.WEBSITE_URL = 'https://www.binance.us'

This resets only the urls for REST API!
If you guys need websockets on binanace.us you can use:
https://github.com/oliver-zehentleitner/unicorn-binance-websocket-api

you update the initialization parameter as follows
client = Client("key", "secret",tld="us")

you update the initialization parameter as follows
client = Client("key", "secret",tld="us")

This does not work. You get multiple errors when looking up ticker prices or retrieving account status.

@ZENALC I dunno, worked for me. Sure you got the latest version of code? And need a space in the above quoted text if you directly copy/pasted.

Mine: client = Client(pub, sec, tld='us')

@ZENALC I dunno, worked for me. Sure you got the latest version of code? And need a space in the above quoted text if you directly copy/pasted.

Mine: client = Client(pub, sec, tld='us')

The space does not matter. I am running the latest version of the code, but if you try to get the latest price ticker or retrieve account status, the code will not work.

Tested ->
client = Client(MB_TAPI_ID, MB_TAPI_SECRET, tld="us")
info = client.get_account()
<- now and it works, I guess it got fixed?

@ZENALC I dunno, worked for me. Sure you got the latest version of code? And need a space in the above quoted text if you directly copy/pasted.
Mine: client = Client(pub, sec, tld='us')

The space does not matter. I am running the latest version of the code, but if you try to get the latest price ticker or retrieve account status, the code will not work.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

echel0n picture echel0n  路  4Comments

ohsnapitsjojo picture ohsnapitsjojo  路  3Comments

terenceljz picture terenceljz  路  3Comments

noahwoodin picture noahwoodin  路  8Comments

iamveritas picture iamveritas  路  3Comments