dojo.runners

Simulation runners.

def backtest_run( env: Union[dojo.environments.UniswapV3Env, dojo.environments.AAVEv3Env, dojo.environments.GmxV2Env], *, output_file: Optional[str] = None, dashboard_server_port: Optional[int] = None, transaction_order: Literal['in_order', 'fee'] = 'in_order', auto_close: bool = True, simulation_status_bar: bool = False, simulation_title: str = 'no title', simulation_description: str = 'no description') -> 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.
  • output_file: The file to write the output to.
  • dashboard_server_port: The port on which the data is served for connection to the dashboard.
  • 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.
  • simulation_status_bar: Whether to show a status bar for the simulation.
  • simulation_title: The title of the simulation.
  • simulation_description: The description of the simulation.
Raises
  • ValueError: In case an invalid value for transaction_order is provided.
  • Exception: If the environment has an incompatible backend.
def monitor_run( env: Union[dojo.environments.UniswapV3Env, dojo.environments.AAVEv3Env, dojo.environments.GmxV2Env], *, output_file: Optional[str] = None, dashboard_server_port: Optional[int] = None, stop_after_n_blocks: Optional[int] = None, auto_close: bool = True, simulation_title: str = 'no title', simulation_description: str = 'no description') -> None:

Run a live monitoring session.

Parameters
  • env: The environment to run the backtest on.
  • output_file: The file to write the output to.
  • dashboard_server_port: The port on which the data is served for connection to the dashboard.
  • auto_close: Whether to automatically close the dashboard server once the simulation is finished.
  • simulation_title: The title of the simulation.
  • simulation_description: The description of the simulation.
Raises
  • Exception: If the environment has an incompatible backend.