diff --git a/bfxapi/examples/wallet_balance.py b/bfxapi/examples/wallet_balance.py new file mode 100644 index 0000000..d5ced1e --- /dev/null +++ b/bfxapi/examples/wallet_balance.py @@ -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()