In the previous module we submitted predictions to a single data stream.
Now, we show how to retrieve historical data (lagged values) using the Python client, or the api directly, or CSV links.
Here are the steps, also shown in a notebook.
Unlike Modules 1 and 2, we don't need a write key as we can instead instantiate a "mere" MicroReader
pip install microprediction
Then we import
from microprediction import MicroReader
and instantiate
reader = MicroReader()
Getting lagged values is as easy as
reader.get_lagged_values('die.json')
so long as you remember the .json (thus, not so easy :-).
As an alternative, you can download CSV data as shown here or use the API directly (for example try clicking on https://api.microprediction.org/lagged/die.json.
Use methods like get_lagged_values or get_lagged_times to retrieve historical data.
The microprediction/reader.py code lists the get methods you can use to retrieve data of various kinds.
If you are using a MicroWriter or MicroCrawler, or perhaps a fancier version like FitCrawler, you will have access to the same reader get methods because they all inherit from MicroReader.