diff --git a/docs/storage.rst b/docs/storage.rst index d9c02c6d1..4f813ab21 100644 --- a/docs/storage.rst +++ b/docs/storage.rst @@ -40,16 +40,31 @@ Where ```` is ``dexbot`` and ```` is Simple example -------------- +.. code-block:: python -.. literalinclude:: ../dexbot/strategies/storagedemo.py - :language: python - :linenos: + from dexbot.basestrategy import BaseStrategy + + + class Strategy(BaseStrategy): + """ + Storage demo strategy + Strategy that prints all new blocks in the blockchain + """ + + def __init__(self, *args, **kwargs): + super().__init__(*args, **kwargs) + self.ontick += self.tick + + def tick(self, i): + print("previous block: %s" % self["block"]) + print("new block: %s" % i) + self["block"] = i **Example Output:** :: - Current Wallet Passphrase: + Current Wallet Passphrase: previous block: None new block: 008c4c2424e6394ad4bf5a9756ae2ee883b0e049 previous block: 008c4c2424e6394ad4bf5a9756ae2ee883b0e049