Websockets
Websocket Endpoints
/upnl-ws
async def send_upnl_data(websocket: WebSocket, address: str, q: asyncio.Queue):
"""
Fetch user's uPnL and send it to the client.
If there's new data in the queue (new address?), switch to that on next iteration.
"""
if q.empty():
content = UpnlCalculator.get_party_a_upnl(address) if address else {}
await safe_send_data(websocket, content)
await asyncio.sleep(2)
return address
else:
return await q.get()uPnL Calculation Flow
/position-state-ws
initialize_listeners()
send_position_data()
get_data_and_send()
/funding-rate-ws
Fetching Symbol Funding Details
Calculating Funding Details
Applying Funding Rates
Last updated

