dojo.actions package¶
This module contains all actions that can be executed by environments.
- class dojo.actions.BaseAction(*, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
Generic
[Observation
]Base action class for all environments.
- Parameters:
agent – The agent executing the action.
Submodules¶
Base action classes for all environments.
- class dojo.actions.base_action.BaseAction(*, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
Generic
[Observation
]Base action class for all environments.
- Parameters:
agent – The agent executing the action.
Actions for UniswapV3.
- class dojo.actions.uniswapV3.UniswapV3Action(*, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
BaseAction
[UniswapV3Observation
]Base Action for Aave.
- class dojo.actions.uniswapV3.UniswapV3BurnNew(position_id: str, *, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
Burn a position.
The position needs to be empty, or an error will be thrown
- position_id: str¶
- class dojo.actions.uniswapV3.UniswapV3Collect(pool: str, quantities: tuple[Decimal, Decimal], tick_range: tuple[int, int], *, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
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.
- pool: str¶
- quantities: tuple[Decimal, Decimal]¶
- tick_range: tuple[int, int]¶
- class dojo.actions.uniswapV3.UniswapV3CollectFull(pool: str, position_id: str, *, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
Collect all tokesn from a position.
- Parameters:
agent – TODO
- pool: str¶
- position_id: str¶
- class dojo.actions.uniswapV3.UniswapV3IncreaseLiquidity(pool: str, position_id: int, liquidity: int, owner: str = '0x0000000000000000000000000000000000000000', *, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
Increase Liquidity of an existing position.
Not yet supported.
- Parameters:
agent – Amount of token 0.
- liquidity: int¶
- owner: str = '0x0000000000000000000000000000000000000000'¶
- pool: str¶
- position_id: int¶
- class dojo.actions.uniswapV3.UniswapV3LiquidatePosition(position_id: int, *, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
Liquidating a Position.
This will withdraw all liquidity from the postion, send it to the liquidation agent and destroy the LP token. Not yet supported.
- Parameters:
id – ID of the position to liquidate.
- position_id: int¶
- class dojo.actions.uniswapV3.UniswapV3ProvideLiquidity(pool: str, tick_range: tuple[int, int], liquidity: int, *, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
Quote action for UniswapV3.
- Parameters:
agent – The agent executing the action.
pool – The pool name to trade on.
tick_range – The tick range to quote.
liquidity – The amount of liquidity that should be provided.
- liquidity: int¶
- pool: str¶
- tick_range: tuple[int, int]¶
- class dojo.actions.uniswapV3.UniswapV3ProvideQuantities(pool: str, tick_range: tuple[int, int], amount0: Decimal, amount1: Decimal, owner: str = '0x0000000000000000000000000000000000000000', auto_trade: bool = False, *, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
Provide a specific amount of quantities.
Will throw errors if the quantities are incompatible with the tick range.
- Parameters:
agent – The agent executing the action.
pool – The pool name to trade on.
tick_range – The tick range to quote.
amount0 – Amount of token 0.
amount1 – Amount of token 1.
- amount0: Decimal¶
- amount1: Decimal¶
- auto_trade: bool = False¶
- owner: str = '0x0000000000000000000000000000000000000000'¶
- pool: str¶
- tick_range: tuple[int, int]¶
- class dojo.actions.uniswapV3.UniswapV3Quote(pool: str, quantities: tuple[Decimal, Decimal], tick_range: tuple[int, int], liquidity: int = -1, owner: str = '0x0000000000000000000000000000000000000000', *, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
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 for the transaction.
gas_price – The gas price 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.
- liquidity: int = -1¶
- owner: str = '0x0000000000000000000000000000000000000000'¶
- pool: str¶
- quantities: tuple[Decimal, Decimal]¶
- tick_range: tuple[int, int]¶
- class dojo.actions.uniswapV3.UniswapV3SetFeeProtocol(agent: BaseAgent, pool: str, quantities: tuple[Decimal, Decimal], *, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
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 for the transaction.
gas_price – The gas price for the transaction.
- pool: str¶
- quantities: tuple[Decimal, Decimal]¶
- class dojo.actions.uniswapV3.UniswapV3Trade(pool: str, quantities: tuple[Decimal, Decimal], price_limit: Decimal | None = None, *, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
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 for the transaction.
gas_price – The gas price for the transaction.
- pool: str¶
- price_limit: Decimal | None = None¶
- quantities: tuple[Decimal, Decimal]¶
- class dojo.actions.uniswapV3.UniswapV3TradeToTickRange(pool: str, quantities: tuple[Decimal, Decimal], tick_range: tuple[int, int], *, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
Trade tokens for perfect ration to then provide in a tick range.
At the moment, it just trades to 50/50 in value, if the active tick is covered.
- Parameters:
agent – The agent executing the action.
pool – The pool name to trade on.
quantities – The quantities to trade.
gas – The gas for the transaction.
gas_price – The gas price for the transaction.
- pool: str¶
- quantities: tuple[Decimal, Decimal]¶
- tick_range: tuple[int, int]¶
- class dojo.actions.uniswapV3.UniswapV3WithdrawLiquidity(position_id: int, liquidity: int, owner: str = '0x0000000000000000000000000000000000000000', *, agent: BaseAgent, gas: int | None = None, gas_price: int | None = None)¶
Bases:
UniswapV3Action
Withdraw Liquidity from an existing position.
Tokens can then be collected from the position, or re-provided.
- Parameters:
position_id – ID fo the position to withdraw from.
liquidity – Amount of liquidity to withdraw (in wei).
owner – The owner of the position to withdraw from.
- liquidity: int¶
- owner: str = '0x0000000000000000000000000000000000000000'¶
- position_id: int¶