Hello,
This part of my code is working fine and I am able to print the data as and when it comes.
class InterfaceWS:
def __init__(self, exchange_name="BINANCE") -> None:
self.exchange_name = exchange_name
def connect(self):
self.ws = websockets.connect(END_POINTS[self.exchange_name]["SPOT"]["TEST"]["ws"])
def subscribe(self, symbol="btcusdt"):
self.ws.send(
json.dumps({"method": "SUBSCRIBE", "params": [f"{symbol}@bookTicker"],"id": 1,}))
while True:
response = self.ws.recv()
print("tick\n", response)
However now i need to fetch user data and am unable to understand
#1 what is the purpose of a listenkey and
#2 how to get a listenkey from the api.
If you could kindly help me with some code that uses requests and not python-binance
or python-binance-connector
it would be very grateful.
Update: when i am trying to get new listenkey using Postman I am getting this error.
{"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}