PyLance giving "Code is unreachable"
for BinanceSocketManager
Websocket Usage
Is this a bug or this code is really not working?
async def main(coin):
bm = BinanceSocketManager(client)
ts = bm.trade_socket(coin)
async with ts as tscm:
while True:
res = await tscm.recv()
if res:
frame = createframe(res)
if frame.Price[0] < buyprice * 0.97 or frame.Price[0] > 1.005 * buyprice:
order = client.create_order(symbol=coin,
side='SELL',
type='MARKET',
quantity=buy_quantity)
print(order)
loop.stop()
await client.close_connection() #This is the unreachable code
thanks for help.