mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-19 14:54:21 +01:00
Rewrite all websocket examples according to v3.0.0b3's changes.
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user