mirror of
https://github.com/aljazceru/bitfinex-api-py.git
synced 2025-12-20 15:24:21 +01:00
examples: add ws auth example
This commit is contained in:
committed by
Jacob Plaster
parent
4376c956b8
commit
f974268d7a
24
bfxapi/examples/ws/connect_auth.py
Normal file
24
bfxapi/examples/ws/connect_auth.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import os
|
||||
import sys
|
||||
sys.path.append('../')
|
||||
|
||||
from bfxapi import Client, Order
|
||||
|
||||
API_KEY=os.getenv("BFX_KEY")
|
||||
API_SECRET=os.getenv("BFX_SECRET")
|
||||
|
||||
bfx = Client(
|
||||
API_KEY=API_KEY,
|
||||
API_SECRET=API_SECRET,
|
||||
logLevel='DEBUG',
|
||||
dead_man_switch=true, # <-- kill all orders if this connection drops
|
||||
channel_filter=['wallet'] # <-- only receive wallet updates
|
||||
)
|
||||
|
||||
@bfx.ws.on('error')
|
||||
def log_error(msg):
|
||||
print ("Error: {}".format(msg))
|
||||
|
||||
@bfx.ws.on('authenticated')
|
||||
async def submit_order(auth_message):
|
||||
print ("Authenticated!!")
|
||||
Reference in New Issue
Block a user