Events¶
The websocket endpoint of BitShares has notifications that are
subscribed to and dispatched by dexbot. This uses python’s
native Events. The following events are available in your
strategies and depend on the configuration of your bot/strategy:
onOrderMatched: Called when orders in your market are matchedonOrderPlaced: Called when a new order in your market is placedonUpdateCallOrder: Called if one of the assets in your market is a market-pegged asset and someone updates his call positiononMarketUpdate: Called whenever something happens in your market (includes matched orders, placed orders and call order updates!)ontick: Called when a new block is receivedonAccount: Called when your account’s statistics is updated (changes to2.6.xxxxwithxxxxbeing your account id number)error_ontick: Is called when an error happend when processingontickerror_onMarketUpdate: Is called when an error happend when processingonMarketUpdateerror_onAccount: Is called when an error happend when processingonAccount
Simple Example¶
class Simple(BaseStrategy):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
""" set call backs for events
"""
self.onOrderMatched += print
self.onOrderPlaced += print
self.onUpdateCallOrder += print
self.onMarketUpdate += print
self.ontick += print
self.onAccount += print