Rewrite all websocket examples according to v3.0.0b3's changes.

This commit is contained in:
Davide Casale
2023-10-26 17:59:44 +02:00
parent 1ec6c49428
commit 1accf92c57
7 changed files with 111 additions and 84 deletions

View File

@@ -1,19 +1,18 @@
# python -c "import examples.websocket.auth.wallets"
import os
from typing import List
from bfxapi import Client
from bfxapi.enums import Error
from bfxapi.types import Wallet
bfx = Client(
api_key=os.getenv("BFX_API_KEY"),
api_secret=os.getenv("BFX_API_SECRET"),
filters=["wallet"]
filters=["wallet"],
)
@bfx.wss.on("wallet_snapshot")
def on_wallet_snapshot(wallets: List[Wallet]):
for wallet in wallets:
@@ -21,8 +20,10 @@ def on_wallet_snapshot(wallets: List[Wallet]):
print(f"Available balance: {wallet.available_balance}")
print(f"Wallet trade details: {wallet.trade_details}")
@bfx.wss.on("wallet_update")
def on_wallet_update(wallet: Wallet):
print(f"Wallet update: {wallet}")
bfx.wss.run()