Base Strategy

All strategies should inherit stakemachine.basestrategy.BaseStrategy which simplifies and unifies the development of new strategies.


class stakemachine.basestrategy.BaseStrategy(config, name, onAccount=None, onOrderMatched=None, onOrderPlaced=None, onMarketUpdate=None, onUpdateCallOrder=None, ontick=None, bitshares_instance=None, *args, **kwargs)

Base Strategy and methods available in all Sub Classes that inherit this BaseStrategy.

BaseStrategy inherits:

Available attributes:

  • basestrategy.bitshares: instance of ´`bitshares.BitShares()``
  • basestrategy.add_state: Add a specific state
  • basestrategy.set_state: Set finite state machine
  • basestrategy.get_state: Change state of state machine
  • basestrategy.account: The Account object of this bot
  • The market used by this bot
  • basestrategy.orders: List of open orders of the bot’s account in the bot’s market
  • basestrategy.balance: List of assets and amounts available in the bot’s account

Also, Base Strategy inherits which allows to permanently store data in a sqlite database using:

basestrategy["key"] = "value"


This applies a json.loads(json.dumps(value))!


Return the full account as bitshares.account.Account object!

Can be refreshed by using x.refresh()


Return the balance of your bot’s account for a specific asset


Return the balances of your bot’s account


Cancel all orders of this bot


Execute a bundle of operations


Return the market object as


Return the bot’s open accounts in the current market