bitshares.notify module¶
-
class
bitshares.notify.Notify(accounts=None, markets=None, objects=None, on_tx=None, on_object=None, on_block=None, on_account=None, on_market=None, keep_alive=25, **kwargs)[source]¶ Bases:
events.events.Events,bitshares.instance.BlockchainInstanceNotifications on Blockchain events.
Parameters: - accounts (list) – Account names/ids to be notified about when changing
- markets (list) – Instances of
bitshares.market.Marketthat 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
- blockchain_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()
-
bitshares¶ Alias for the specific blockchain.
-
blockchain¶
-
chain¶ Short form for blockchain (for the lazy)
-
define_classes()¶ Needs to define instance variables that provide classes
-
get_instance_class()¶ Should return the Chain instance class, e.g. bitshares.BitShares
-
classmethod
inject(cls)¶
-
listen()[source]¶ This call initiates the listening/notification process.
It behaves similar to
run_forever().
-
process_account(message)[source]¶ This is used for processing of account Updates.
It will return instances of :class:bitshares.account.AccountUpdate`
-
process_market(data)[source]¶ This method is used for post processing of market notifications. It will return instances of either.
Also possible are limit order updates (margin calls)
-
reset_subscriptions(accounts=None, markets=None, objects=None)[source]¶ Change the subscriptions of a running Notify instance.
-
classmethod
set_shared_blockchain_instance(instance)¶ This method allows us to override default instance for all users of
SharedInstance.instance.Parameters: instance (chaininstance) – Chain instance
-
classmethod
set_shared_config(config)¶ This allows to set a config that will be used when calling
shared_blockchain_instanceand allows to define the configuration without requiring to actually create an instance
-
set_shared_instance()¶ This method allows to set the current instance as default
-
shared_blockchain_instance()¶ This method will initialize
SharedInstance.instanceand return it. The purpose of this method is to have offer single default instance that can be reused by multiple classes.