dojo.actions package

This module contains all actions that can be executed by environments.

class dojo.actions.BaseAction(agent: BaseAgent)

Bases: object

Base action class for all environments.

Parameters:

agent – The agent executing the action.

agent: BaseAgent
encode(obs: BaseObs) Dict[str, Any]

Encode the action in a purely numerical dictionary format.

Parameters:

obs – The observation from the environment.

Raises:

NotImplementedError – Must be implemented by subclass.

Submodules

Base action classes for all environments.

class dojo.actions.base_action.BaseAction(agent: BaseAgent)

Bases: object

Base action class for all environments.

Parameters:

agent – The agent executing the action.

agent: BaseAgent
encode(obs: BaseObs) Dict[str, Any]

Encode the action in a purely numerical dictionary format.

Parameters:

obs – The observation from the environment.

Raises:

NotImplementedError – Must be implemented by subclass.

Actions for UniswapV3.

class dojo.actions.uniswapV3.UniV3Collect(agent: BaseAgent, pool: str, quantities: Tuple[Decimal, Decimal], tick_range: Tuple[int, int], gas: int | None = None, max_fee_per_gas: int | None = None, max_priority_fee_per_gas: int | None = None)

Bases: BaseAction

Collect action for UniswapV3.

Parameters:
  • agent – The agent executing the action.

  • pool – The pool name to trade on.

  • quantities – The quantities to trade.

  • tick_range – The tick range to quote.

  • gas – The gas price to use for the transaction.

  • max_fee_per_gas – The max fee per gas to use for the transaction.

  • max_priority_fee_per_gas – The max priority fee per gas to use for the transaction.

agent: BaseAgent
encode(obs: UniV3Obs) Dict[str, Any]

Encode the action in a purely numerical dictionary format.

Parameters:

obs – The observation from the environment.

gas: int | None = None
max_fee_per_gas: int | None = None
max_priority_fee_per_gas: int | None = None
pool: str
quantities: Tuple[Decimal, Decimal]
tick_range: Tuple[int, int]
class dojo.actions.uniswapV3.UniV3Quote(agent: BaseAgent, pool: str, quantities: Tuple[Decimal, Decimal], tick_range: Tuple[int, int], gas: int | None = None, max_fee_per_gas: int | None = None, max_priority_fee_per_gas: int | None = None, liquidity: int = -1, owner: str = '0x0000000000000000000000000000000000000000')

Bases: BaseAction

Quote action for UniswapV3.

Parameters:
  • agent – The agent executing the action.

  • pool – The pool name to trade on.

  • quantities – The quantities to trade.

  • tick_range – The tick range to quote.

  • gas – The gas price to use for the transaction.

  • max_fee_per_gas – The max fee per gas to use for the transaction.

  • max_priority_fee_per_gas – The max priority fee per gas to use for the transaction.

  • liquidity – Optional liquidity to use for the quote, needed for MarketAgent burns.

  • owner – Optional owner to use for the quote, needed for MarketAgent burns.

agent: BaseAgent
encode(obs: UniV3Obs) Dict[str, Any]

Encode the action in a purely numerical dictionary format.

Parameters:

obs – The observation from the environment.

gas: int | None = None
liquidity: int = -1
max_fee_per_gas: int | None = None
max_priority_fee_per_gas: int | None = None
owner: str = '0x0000000000000000000000000000000000000000'
pool: str
quantities: Tuple[Decimal, Decimal]
tick_range: Tuple[int, int]
class dojo.actions.uniswapV3.UniV3SetFeeProtocol(agent: BaseAgent, pool: str, quantities: Tuple[Decimal, Decimal], gas: int | None = None, max_fee_per_gas: int | None = None, max_priority_fee_per_gas: int | None = None)

Bases: BaseAction

SetFeeProtocol action for UniswapV3.

Parameters:
  • agent – The agent executing the action.

  • pool – The pool name to trade on.

  • quantities – The quantities to trade.

  • gas – The gas price to use for the transaction.

  • max_fee_per_gas – The max fee per gas to use for the transaction.

  • max_priority_fee_per_gas – The max priority fee per gas to use for the transaction.

agent: BaseAgent
encode(obs: UniV3Obs) Dict[str, Any]

Encode the action in a purely numerical dictionary format.

Parameters:

obs – The observation from the environment.

gas: int | None = None
max_fee_per_gas: int | None = None
max_priority_fee_per_gas: int | None = None
pool: str
quantities: Tuple[Decimal, Decimal]
class dojo.actions.uniswapV3.UniV3Trade(agent: BaseAgent, pool: str, quantities: Tuple[Decimal, Decimal], gas: int | None = None, max_fee_per_gas: int | None = None, max_priority_fee_per_gas: int | None = None)

Bases: BaseAction

Trade action for UniswapV3.

Parameters:
  • agent – The agent executing the action.

  • pool – The pool name to trade on.

  • quantities – The quantities to trade.

  • price_limit – The price limit for the trade (slippage).

  • gas – The gas price to use for the transaction.

  • max_fee_per_gas – The max fee per gas to use for the transaction.

  • max_priority_fee_per_gas – The max priority fee per gas to use for the transaction.

agent: BaseAgent
encode(obs: UniV3Obs) Dict[str, Any]

Encode the action in a purely numerical dictionary format.

Parameters:

obs – The observation from the environment.

gas: int | None = None
max_fee_per_gas: int | None = None
max_priority_fee_per_gas: int | None = None
pool: str
price_limit: Decimal | None = None
quantities: Tuple[Decimal, Decimal]