How to implement BinanceSocketManager on existing code?

I want to implement a websocket on this particular code because otherwise I am getting errors of too many requests in a minute. I can’t find a good example of someone using it (or just have other expectation of how the code would look like). Thanks in advance

def getCurrentPrice(symbol, timeFrame):
    currentPrice = float(client.get_historical_klines(symbol=symbol, interval=timeFrame, start_str="1 m ago")[0][4])  
    
    
    return currentPrice

while (True):
     currentPrice = getCurrentPrice("BTCUSDT", "1m")
     print(currentPrice)

     sleep(10)

Please direct this issue with the owner of the library. I suggest opening an issue on the respective github repository.

This forum is for Binance API related discussion.

1 Like