Skip to content

Commit

Permalink
Add position and execution.fast subscriptions for Bybit (#2104)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunlei authored Dec 13, 2024
1 parent 8c181ad commit ab0fa18
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions nautilus_trader/adapters/bybit/websocket/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,11 +270,15 @@ async def unsubscribe_klines(self, symbol: str, interval: str) -> None:
################################################################################
# Private
################################################################################
# async def subscribe_account_position_update(self) -> None:
# subscription = "position"
# msg = {"op": "subscribe", "args": [subscription]}
# await self._send(msg)
# self._subscriptions.append(subscription)

async def subscribe_account_position_update(self) -> None:
subscription = "position"
if subscription in self._subscriptions:
return

self._subscriptions.append(subscription)
msg = {"op": "subscribe", "args": [subscription]}
await self._send(msg)

async def subscribe_orders_update(self) -> None:
subscription = "order"
Expand All @@ -294,6 +298,15 @@ async def subscribe_executions_update(self) -> None:
msg = {"op": "subscribe", "args": [subscription]}
await self._send(msg)

async def subscribe_executions_update_fast(self) -> None:
subscription = "execution.fast"
if subscription in self._subscriptions:
return

self._subscriptions.append(subscription)
msg = {"op": "subscribe", "args": [subscription]}
await self._send(msg)

async def subscribe_wallet_update(self) -> None:
subscription = "wallet"
if subscription in self._subscriptions:
Expand Down

0 comments on commit ab0fa18

Please sign in to comment.