LUCIT-Systems-and-Development / unicorn-binance-websocket-api

A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
678 stars 166 forks source link

How to use api1 or api2 or api3 ? #180

Closed TKR-US closed 3 years ago

TKR-US commented 3 years ago

Hello,

i'm new comer on Binance and new comer unicorn library (since 2 days) (come from python-binance, but i've found a random PONG bug).

i've a little problem about latency on api.binance.com (300 ms), but 6 ms on ap1, ap2 or api3.binance.com On python-binance, i can change url with client.API_URL = 'https://api1.binance.{}/api'

Is there a way to have same feature ?

Regards

TKR-US commented 3 years ago

I tried something as : binance_websocket_api_manager = BinanceWebSocketApiManager(exchange="binance.com") binance_websocket_api_manager.restful_base_uri="https://api1.binance.com"

but this is not the right way... :)

oliver-zehentleitner commented 3 years ago

Isnt this just working with REST API?

The only thing we use REST for is managing listenKeys... thats not blocking or speed relevant.

I wanted to write an method for pinging the different endpoints and choosing the fastest one, but i think thats only really usefull for rest api not for websockets...

TKR-US commented 3 years ago

mhhh you are right

stream.binance.com for websocket, and there is only this url (and 300 ms for me :( ) I am not sure that there is a huge interest in making an improvement in this direction

oliver-zehentleitner commented 3 years ago

most people i know compensate this with servers localy close to binance dc. on telegram channel was some discussions about this in the past and sharing experience about this topic...

TKR-US commented 3 years ago

Mhh they use Amazon DC, as binance? I am on German DC (physical servers)