Monitoring a live position on AAVE.
In this examples, we are tracking 3 actual addresses live. We are monitoring their health factor on AAVEv3.
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. There still is a predict
function that runs on every new block.
The only difference is that an agent in a monitoring will never execute any actions on-chain.
In this example, we are using ImpersonationAgents to directly track the positions of 3 agents:
Alice 0x9c1d67674dE93b71ea16893C95dDA6f4D266a2bC
Bob 0xE6ad0f991Ddc8630Cc03c972Fd5eA62DB8828525
Claire 0x23A5e45f9556Dc7ffB507DB8a3CFb2589bC8aDAD
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.