agent0.core.hyperdrive.policies.random ====================================== .. py:module:: agent0.core.hyperdrive.policies.random .. autoapi-nested-parse:: User strategy that opens or closes a random position with a random allowed amount. .. !! processed by numpydoc !! Classes ------- .. autoapisummary:: agent0.core.hyperdrive.policies.random.Random Module Contents --------------- .. py:class:: Random(policy_config: Config) Bases: :py:obj:`agent0.core.hyperdrive.policies.hyperdrive_policy.HyperdriveBasePolicy` Random agent. .. !! processed by numpydoc !! .. py:method:: description() -> str :classmethod: Describe the policy in a user friendly manner that allows newcomers to decide whether to use it. :returns: A description of the policy. :rtype: str .. !! processed by numpydoc !! .. py:class:: Config Bases: :py:obj:`agent0.core.hyperdrive.policies.hyperdrive_policy.HyperdriveBasePolicy.Config` Custom config arguments for this policy. .. !! processed by numpydoc !! .. py:attribute:: trade_chance :type: fixedpointmath.FixedPoint The probability of this bot to make a trade on an action call. .. !! processed by numpydoc !! .. py:attribute:: randomly_ignore_slippage_tolerance :type: bool :value: False If we randomly ignore slippage tolerance. .. !! processed by numpydoc !! .. py:attribute:: allowable_actions :type: list[agent0.core.hyperdrive.agent.HyperdriveActionType] A list of Hyperdrive actions that are allowed. Defaults to all possible actions. .. !! processed by numpydoc !! .. py:attribute:: trade_chance .. py:attribute:: allowable_actions .. py:attribute:: randomly_ignore_slippage_tolerance .. py:attribute:: gas_limit .. py:method:: get_available_actions(wallet: agent0.core.hyperdrive.HyperdriveWallet, interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface) -> list[agent0.core.hyperdrive.agent.HyperdriveActionType] Get all available actions. :param wallet: The agent's wallet. :type wallet: HyperdriveWallet :param interface: The interface to the Hyperdrive contract. :type interface: HyperdriveReadInterface :returns: A list containing all of the available actions. :rtype: list[HyperdriveActionType] .. !! processed by numpydoc !! .. py:method:: open_short_with_random_amount(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, wallet: agent0.core.hyperdrive.HyperdriveWallet) -> list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]] Open a short with a random allowable amount. :param interface: Interface for the market on which this agent will be executing trades (MarketActions). :type interface: HyperdriveReadInterface :param wallet: The agent's wallet. :type wallet: HyperdriveWallet :returns: A list with a single Trade element for opening a Hyperdrive short. :rtype: list[Trade[HyperdriveMarketAction]] .. !! processed by numpydoc !! .. py:method:: close_random_short(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, wallet: agent0.core.hyperdrive.HyperdriveWallet) -> list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]] Fully close the short balance for a random mint time. :param interface: Interface for the market on which this agent will be executing trades (MarketActions). :type interface: HyperdriveReadInterface :param wallet: The agent's wallet. :type wallet: HyperdriveWallet :returns: A list with a single Trade element for closing a Hyperdrive short. :rtype: list[Trade[HyperdriveMarketAction]] .. !! processed by numpydoc !! .. py:method:: open_long_with_random_amount(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, wallet: agent0.core.hyperdrive.HyperdriveWallet) -> list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]] Open a long with a random allowable amount. :param interface: Interface for the market on which this agent will be executing trades (MarketActions). :type interface: HyperdriveReadInterface :param wallet: The agent's wallet. :type wallet: HyperdriveWallet :returns: A list with a single Trade element for opening a Hyperdrive long. :rtype: list[Trade[HyperdriveMarketAction]] .. !! processed by numpydoc !! .. py:method:: close_random_long(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, wallet: agent0.core.hyperdrive.HyperdriveWallet) -> list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]] Fully close the long balance for a random mint time. :param interface: Interface for the market on which this agent will be executing trades (MarketActions). :type interface: HyperdriveReadInterface :param wallet: The agent's wallet. :type wallet: HyperdriveWallet :returns: A list with a single Trade element for closing a Hyperdrive long. :rtype: list[Trade[HyperdriveMarketAction]] .. !! processed by numpydoc !! .. py:method:: add_liquidity_with_random_amount(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, wallet: agent0.core.hyperdrive.HyperdriveWallet) -> list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]] Add liquidity with a random allowable amount. :param interface: Interface for the market on which this agent will be executing trades (MarketActions). :type interface: HyperdriveReadInterface :param wallet: The agent's wallet. :type wallet: HyperdriveWallet :returns: A list with a single Trade element for adding liquidity to a Hyperdrive pool. :rtype: list[Trade[HyperdriveMarketAction]] .. !! processed by numpydoc !! .. py:method:: remove_liquidity_with_random_amount(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, wallet: agent0.core.hyperdrive.HyperdriveWallet) -> list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]] Remove liquidity with a random allowable amount. :param interface: Interface for the market on which this agent will be executing trades (MarketActions). :type interface: HyperdriveReadInterface :param wallet: The agent's wallet. :type wallet: HyperdriveWallet :returns: A list with a single Trade element for removing liquidity from a Hyperdrive pool. :rtype: list[Trade[HyperdriveMarketAction]] .. !! processed by numpydoc !! .. py:method:: redeem_withdraw_shares_with_random_amount(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, wallet: agent0.core.hyperdrive.HyperdriveWallet) -> list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]] Redeem withdraw shares with a random allowable amount. :param interface: Interface for the market on which this agent will be executing trades (MarketActions). :type interface: HyperdriveReadInterface :param wallet: The agent's wallet. :type wallet: HyperdriveWallet :returns: A list with a single Trade element for redeeming the LP withdraw shares. :rtype: list[Trade[HyperdriveMarketAction]] .. !! processed by numpydoc !! .. py:method:: action(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, wallet: agent0.core.hyperdrive.HyperdriveWallet) -> tuple[list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]], bool] Implement a random user strategy. The agent performs one of four possible trades: [OPEN_LONG, OPEN_SHORT, CLOSE_LONG, CLOSE_SHORT] with the condition that close actions can only be performed after open actions The amount opened and closed is random, within constraints given by agent budget & market reserve levels :param interface: Interface for the market on which this agent will be executing trades (MarketActions). :type interface: HyperdriveReadInterface :param wallet: The agent's wallet. :type wallet: HyperdriveWallet :returns: A tuple where the first element is a list of actions, and the second element defines if the agent is done trading. :rtype: tuple[list[MarketAction], bool] .. !! processed by numpydoc !!