dojo.actions

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

@dataclass
class AAVEv3Supply(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Supply funds to AAVEv3 pool. You can earn interest for supplying funds.

Parameters
  • token: Symbol of the token you want to supply.
  • amount: Amount of tokens being supplied, in human-readable format. (e.g. Decimal('1.5') ETH).
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class AAVEv3Withdraw(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Witdraw funds from AAVEv3 pool.

Parameters
  • token: Symbol of the token you want to withdraw.
  • amount: Amount to withdraw, in human-readable format. (e.g. Decimal('1.5') ETH).
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class AAVEv3WithdrawAll(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Witdraw all funds from AAVEv3 pool.

Parameters
  • token: Symbol of the token you want to withdraw.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class AAVEv3Borrow(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Borrow tokens from AAVEv3 pool.

Parameters
  • token: Symbol of the token you want to borrow.
  • amount: Amount to borrow, in human-readable format. (e.g. Decimal('1.5') ETH).
  • mode: Type of borrow debt - stable or variable.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class AAVEv3BorrowToHealthFactor(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Borrow tokens from AAVEv3 pool to a specific health factor.

Parameters
  • token: Symbol of the token you want to borrow.
  • factor: Health factor to borrow to.
  • mode: Type of borrow debt - stable or variable.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class AAVEv3Repay(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Repay borrowed tokens.

Parameters
  • token: Symbol of the token you want to repay.
  • amount: Amount to repay, in human-readable format. (e.g. Decimal('1.5') ETH).
  • mode: Type of borrow debt - stable or variable.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class AAVEv3RepayAll(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Repay all borrowed tokens.

Parameters
  • token: Symbol of the token you want to repay.
  • mode: Type of borrow debt - stable or variable.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class AAVEv3RepayToHealthFactor(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Repay tokens to a specific health factor.

Parameters
  • token: Symbol of the token you want to repay.
  • factor: Health factor to repay to.
  • mode: Type of borrow debt - stable or variable.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class AAVEv3Liquidation(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Liquidate a users collateral, if their health factor has dropped below 1.0.

Parameters
  • collateral: Symbol of the token used as collateral.
  • debt: Symbol of the token used as debt.
  • user: Address of the borrower.
  • debtToCover: Amount of asset debt that the liquidator will repay in human- readable format.
  • receiveAToken: Whether to receive the liquidated asset as aTokens. Default is False.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class AAVEv3FullLiquidation(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Liquidate the maximum amount of a user's collateral.

Parameters
  • collateral: Symbol of the token used as collateral.
  • debt: Symbol of the token used as debt.
  • user: Address of the borrower.
  • receiveAToken: Whether to receive the liquidated asset as aTokens. Default is False.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class AAVEv3FlashLoanSimple(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Take a simple flash loan - access the liquidity of one reserve.

Parameters
  • token: Symbol of the token you want to flash borrow.
  • amount: Amount to flash borrow, in human-readable format. (e.g. Decimal('1.5') ETH).
  • receiver: Address of the contract receiving the flash loan.
  • params: Arbitrary bytes-encoded params that will be passed to executeOperation() method of the receiver contract.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class AAVEv3FlashLoan(dojo.actions.base_action.BaseAction[dojo.observations.aaveV3.AAVEv3Observation]):

Take a flash loan - access the liquidity of multiple reserves.

Parameters
  • tokens: List of symbols of the token you want to flash borrow.
  • amounts: List of amounts to flash borrow, in human-readable format. (e.g. Decimal('1.5') ETH).
  • modes: List of borrow debt types - none, stable, or variable.
  • receiver: Address of the contract receiving the flash loan.
  • params: Arbitrary bytes-encoded params that will be passed to executeOperation() method of the receiver contract.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class UniswapV3Trade(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

Trade action for UniswapV3.

quantities = (q0, q1) where q0 is the amount of token0 and q1 is the amount of token1. Check the pool to see which is token0 and token1 using UniswapV3Observation.pool_tokens(). A negative value represents _buying_ a token, a positive value represents _selling_.

For example, UniswapV3Trade(pool="WETH/USDC-0.05", quantities=(-1,1)) would represent buying 1 token0 and selling 1 token1. If that exact trade cannot be performed at the current price, then one of the values will be rounded down to perform the trade! For example, you might buy 1 token0 and only sell 0.01 token1.

Errors:

  • STF: This indicates that the amount you are trying to trade is more than you have available (or, less likely, that the pool does not have enough tokens available.) Try reducing the quantities or increasing your agent's initial portfolio.
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: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class UniswapV3TradeToTickRange(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

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.
  • tick_range: The tick range to provide in.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class UniswapV3Quote(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

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.
  • liquidity: Optional liquidity to use for the quote, needed for MarketAgent burns.
  • owner: Optional owner to use for the quote, needed for MarketAgent burns.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class UniswapV3ProvideLiquidity(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

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.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class UniswapV3ProvideQuantities(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

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.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class UniswapV3IncreaseLiquidity(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

Increase Liquidity of an existing position.

Not yet supported.

Parameters
  • agent: Amount of token 0.
  • pool: The pool name to trade on.
  • position_id: ID of the position to increase.
  • liquidity: Amount of liquidity to increase (in wei).
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class UniswapV3WithdrawLiquidity(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

Withdraw Liquidity from an existing position.

Tokens can then be collected from the position, or re-provided.

Parameters
  • agent: The agent executing the action.
  • 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.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class UniswapV3LiquidatePosition(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

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
  • agent: The agent executing the action.
  • position_id: ID of the position to liquidate.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class UniswapV3Collect(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

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: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class UniswapV3SetFeeProtocol(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

SetFeeProtocol action for UniswapV3.

Parameters
  • agent: The agent executing the action.
  • pool: The pool name to trade on.
  • quantities: The quantities to trade.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class UniswapV3CollectFull(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

Collect all tokesn from a position.

Parameters
  • agent: TODO
@dataclass
class UniswapV3BurnNew(dojo.actions.base_action.BaseAction[dojo.observations.uniswapV3.UniswapV3Observation]):

Burn a position.

The position needs to be empty, or an error will be thrown

@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class GmxIncreaseLongMarketOrder(dataclasses_json.api.DataClassJsonMixin, dojo.actions.base_action.BaseAction[dojo.observations.gmxV2.GmxV2Observation]):

Action representing an increase long market order on GMX v2.

Parameters
  • agent: The agent executing the action.
  • size_delta_usd: The size delta in USD.
  • market_key: The market key.
  • token_in_symbol: The token in symbol.
  • collateral_token_symbol: The collateral token symbol.
  • observations: The observations.
  • leverage: The leverage.
  • slippage: The slippage.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class GmxDecreaseLongMarketOrder(dataclasses_json.api.DataClassJsonMixin, dojo.actions.base_action.BaseAction[dojo.observations.gmxV2.GmxV2Observation]):

Action representing an decrease long market order on GMX v2.

Parameters
  • agent: The agent executing the action.
  • size_delta_usd: The size delta in USD.
  • market_key: The market key.
  • token_in_symbol: The token in symbol.
  • collateral_token_symbol: The collateral token symbol.
  • observations: The observations.
  • leverage: The leverage.
  • slippage: The slippage.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class GmxIncreaseShortMarketOrder(dataclasses_json.api.DataClassJsonMixin, dojo.actions.base_action.BaseAction[dojo.observations.gmxV2.GmxV2Observation]):

Action representing an increase short market order on GMX v2.

Parameters
  • agent: The agent executing the action.
  • size_delta_usd: The size delta in USD.
  • market_key: The market key.
  • token_in_symbol: The token in symbol.
  • collateral_token_symbol: The collateral token symbol.
  • observations: The observations.
  • leverage: The leverage.
  • slippage: The slippage.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class GmxDecreaseShortMarketOrder(dataclasses_json.api.DataClassJsonMixin, dojo.actions.base_action.BaseAction[dojo.observations.gmxV2.GmxV2Observation]):

Action representing an decrease short market order on GMX v2.

Parameters
  • agent: The agent executing the action.
  • size_delta_usd: The size delta in USD.
  • market_key: The market key.
  • token_in_symbol: The token in symbol.
  • collateral_token_symbol: The collateral token symbol.
  • observations: The observations.
  • leverage: The leverage.
  • slippage: The slippage.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class GmxIncreaseLongLimitOrder(dataclasses_json.api.DataClassJsonMixin, dojo.actions.base_action.BaseAction[dojo.observations.gmxV2.GmxV2Observation]):

Action representing an increase long limit order on GMX v2.

Parameters
  • agent: The agent executing the action.
  • size_delta_usd: The size delta in USD.
  • market_key: The market key.
  • token_in_symbol: The token in symbol.
  • collateral_token_symbol: The collateral token symbol.
  • observations: The observations.
  • leverage: The leverage.
  • slippage: The slippage.
  • trigger_price: The trigger price.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class GmxDecreaseLongLimitOrder(dataclasses_json.api.DataClassJsonMixin, dojo.actions.base_action.BaseAction[dojo.observations.gmxV2.GmxV2Observation]):

Action representing an decrease long limit order on GMX v2.

Parameters
  • agent: The agent executing the action.
  • size_delta_usd: The size delta in USD.
  • market_key: The market key.
  • token_in_symbol: The token in symbol.
  • collateral_token_symbol: The collateral token symbol.
  • observations: The observations.
  • leverage: The leverage.
  • slippage: The slippage.
  • trigger_price: The trigger price.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class GmxIncreaseShortLimitOrder(dataclasses_json.api.DataClassJsonMixin, dojo.actions.base_action.BaseAction[dojo.observations.gmxV2.GmxV2Observation]):

Action representing an increase short limit order on GMX v2.

Parameters
  • agent: The agent executing the action.
  • size_delta_usd: The size delta in USD.
  • market_key: The market key.
  • token_in_symbol: The token in symbol.
  • collateral_token_symbol: The collateral token symbol.
  • observations: The observations.
  • leverage: The leverage.
  • slippage: The slippage.
  • trigger_price: The trigger price.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class GmxDecreaseShortLimitOrder(dataclasses_json.api.DataClassJsonMixin, dojo.actions.base_action.BaseAction[dojo.observations.gmxV2.GmxV2Observation]):

Action representing a decrease short limit order on GMX v2.

Parameters
  • agent: The agent executing the action.
  • size_delta_usd: The size delta in USD.
  • market_key: The market key.
  • token_in_symbol: The token in symbol.
  • collateral_token_symbol: The collateral token symbol.
  • observations: The observations.
  • leverage: The leverage.
  • slippage: The slippage.
  • trigger_price: The trigger price.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class GmxSwapOrder(dataclasses_json.api.DataClassJsonMixin, dojo.actions.base_action.BaseAction[dojo.observations.gmxV2.GmxV2Observation]):

Action representing a swap order on GMX v2.

Parameters
  • agent: The agent executing the action.
  • in_token: The input token.
  • out_token: The output token.
  • in_token_amount: The input token amount.
  • slippage: The slippage.
  • observations: The observations.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass(kw_only=True)
class GmxDeposit(dataclasses_json.api.DataClassJsonMixin, dojo.actions.base_action.BaseAction[dojo.observations.gmxV2.GmxV2Observation]):

Data class for creating a LP deposit on GMX v2.

Parameters
  • agent: The agent creating the deposit.
  • market_key: The market key for the deposit.
  • initial_long_token_symbol: The initial long token symbol.
  • initial_short_token_symbol: The initial short token symbol.
  • long_token_usd: The amount of long token in USD.
  • short_token_usd: The amount of short token in USD.
  • observations: The observations object.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass_json(letter_case=LetterCase.CAMEL)
@dataclass
class GmxWithdrawal(dataclasses_json.api.DataClassJsonMixin, dojo.actions.base_action.BaseAction[dojo.observations.gmxV2.GmxV2Observation]):

Action representing a withdrawal on GMX v2.

Parameters
  • agent: The agent executing the action.
  • market_key: The market key.
  • gm_token_amount: The GM token amount.
  • gas: Optional gas units.
  • gas_price: Optional gas price in wei.
@dataclass
class SleepAction(dojo.actions.base_action.BaseAction[~Observation], typing.Generic[~Observation]):

Action for sleeping for a specified number of blocks.