mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-22 08:14:20 +01:00
examples: adds wallet_balance example
This commit is contained in:
28
bfxapi/examples/wallet_balance.py
Normal file
28
bfxapi/examples/wallet_balance.py
Normal file
@@ -0,0 +1,28 @@
|
||||
import os
|
||||
import sys
|
||||
sys.path.append('../')
|
||||
|
||||
from bfxapi.websockets.LiveWebsocket import LiveBfxWebsocket
|
||||
|
||||
API_KEY=os.getenv("BFX_KEY")
|
||||
API_SECRET=os.getenv("BFX_SECRET")
|
||||
|
||||
ws = LiveBfxWebsocket(
|
||||
API_KEY=API_KEY,
|
||||
API_SECRET=API_SECRET,
|
||||
logLevel='INFO'
|
||||
)
|
||||
|
||||
@ws.on('wallet_snapshot')
|
||||
def log_snapshot(data):
|
||||
print ("Opening balance: {}".format(data))
|
||||
|
||||
@ws.on('wallet_update')
|
||||
def log_update(data):
|
||||
print ("Balance updates: {}".format(data))
|
||||
|
||||
ws.on('error')
|
||||
def log_error(msg):
|
||||
print ("Error: {}".format(msg))
|
||||
|
||||
ws.run()
|
||||
Reference in New Issue
Block a user