bybit-exchange/pybit

Position Stream

Opened this issue · 2 comments

Hi,

I tried just the example in the doc to stream the positions, but doesn't work.
I waited for 5min. but I didn't receive any message, neither error, nor information about the positions.
Any help?
Thanks

from pybit.unified_trading import WebSocket
from time import sleep
ws = WebSocket(
    testnet=True,
    channel_type="private",
    api_key="XXXXX",
    api_secret="XXXXX",
)
def handle_message(message):
    print(message)
ws.position_stream(callback=handle_message)
while True:
    sleep(1)

from pybit.unified_trading import WebSocket
from time import sleep
ws = WebSocket(
testnet=True,
channel_type="private",
api_key="XXXXX",
api_secret="XXXXX",
)
def handle_message(message):
print(message)
ws.position_stream(callback=handle_message)
while True:
handle_message(message)
sleep(1)

maybe ;) but where is your message to print :p

maybe here?

def handle_message(message):
    print(message)