dojo.runners

Simulation runners.

def backtest_run( env: Union[dojo.environments.UniswapV3Env, dojo.environments.AAVEv3Env, dojo.environments.GmxV2Env], policies: list[dojo.policies.BasePolicy[typing.Any, typing.Any, typing.Any]], *, dashboard_server_port: Optional[int] = None, output_dir: str = './', transaction_order: Literal['market_first', 'agent_first', 'fee'] = 'market_first', auto_close: bool = True, simulation_status_bar: bool = False) -> None:

Run a backtest on a given environment.

NB: This runner is in beta and is not yet fully supported. Currently, it only supports UniswapV3Env and the demo UniswapV3WealthAgent which can be found here https://github.com/CompassLabs/dojo_examples/blob/main/agents/UniswapV3_pool_wealth.py

Parameters
  • env: The environment to run the backtest on.
  • policies: The policies to use for the backtest.
  • dashboard_server_port: The port on which the data is served for connection to the dashboard.
  • output_dir: The directory to write the output to.
  • transaction_order: The order in which actions are executed within a block. By default, market actions are executed first ('market_first'), followed by the policy actions in the order of the policies. You can also choose to first execute the agent actions or to have the order randomized.
  • auto_close: Whether to automatically close the dashboard server once the simulation is finished.
Raises
  • ValueError: In case an invalid value for transaction_order is provided.