Monitoring a live position on AAVE.
Dojo makes is very easy to change from a backtest simulation to a live monitoring seamlessly.
Specifying the Agents
As described in Runners, monitoring follows much the same patterns as backtesting.
In monitoring, dojo is connecting to a live RPC node. Your agent works much the same as in backtesting. There still is a predict
function that runs on every new block.
The only difference is that an agent in a monitoring run will never execute any actions on chain.
In this example, we are using ImpersonationAgents to directly track the positions of 3 agents:
Instantiating a live environment
When we instantiate the environment, we need to set the backend type to live
, so we can use monitor_run
after.
Note that we are not passing in any market agents. We are connecting to the live chain here. The world is our market agent.
Running monitoring
Then, we can finally call monitor_run
. Note that the function signature is nearly identical to backtest_run
.
This should make it incredibly easy to switch your simulation from backtesting to monitor running.
Instead of specifying a start_block
and end_block
like in backtest_run
, for monitor_run
the start_block is implicitly defined by whenever to kick of the run.
We then run for a specified number of n
blocks.
The advantage of having defined 3 separate agents as opposed to one agent that exports 3 signals is that we can take full advantage of the dashboards agents tab. Replace this with ScreenshotLive of http://localhost:3000/dashboard?example=live_monitor_aave&menu=Agents