Skip to content

Commit

Permalink
Add storagedemo example from previously removed strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
bitphage committed Apr 3, 2019
1 parent 59ea13b commit 54c303b
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions docs/storage.rst
Expand Up @@ -40,16 +40,31 @@ Where ``<AppName>`` is ``dexbot`` and ``<AppAuthor>`` 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
Expand Down

0 comments on commit 54c303b

Please sign in to comment.