Notify

This modules allows yout to be notified of events taking place on the blockchain.

class bitshares.notify.Notify(accounts=[], markets=[], objects=[], on_tx=None, on_object=None, on_block=None, on_account=None, on_market=None, bitshares_instance=None)

Notifications on Blockchain events.

Parameters:
  • accounts (list) – Account names/ids to be notified about when changing
  • markets (list) – Instances of bitshares.market.Market that identify markets to be monitored
  • objects (list) – Object ids to be notified about when changed
  • on_tx (fnt) – Callback that will be called for each transaction received
  • on_block (fnt) – Callback that will be called for each block received
  • on_account (fnt) – Callback that will be called for changes of the listed accounts
  • on_market (fnt) – Callback that will be called for changes of the listed markets
  • bitshares_instance (bitshares.bitshares.BitShares) – BitShares instance

Example

from pprint import pprint
from bitshares.notify import Notify
from bitshares.market import Market

notify = Notify(
    markets=["TEST:GOLD"],
    accounts=["xeroc"],
    on_market=print,
    on_account=print,
    on_block=print,
    on_tx=print
)
notify.listen()
listen()

This call initiates the listening/notification process. It behaves similar to run_forever().

process_account(message)

This is used for processing of account Updates. It will return instances of :class:bitshares.account.AccountUpdate`

process_market(data)

This method is used for post processing of market notifications. It will return instances of either

  • bitshares.price.Order or
  • bitshares.price.FilledOrder or
  • bitshares.price.UpdateCallOrder

Also possible are limit order updates (margin calls)