agent0.core.hyperdrive.policies =============================== .. py:module:: agent0.core.hyperdrive.policies .. autoapi-nested-parse:: Policies for expert system trading bots. .. !! processed by numpydoc !! Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/agent0/core/hyperdrive/policies/deterministic/index /autoapi/agent0/core/hyperdrive/policies/hyperdrive_policy/index /autoapi/agent0/core/hyperdrive/policies/lpandarb/index /autoapi/agent0/core/hyperdrive/policies/lpandarb_test/index /autoapi/agent0/core/hyperdrive/policies/model_zoo_test/index /autoapi/agent0/core/hyperdrive/policies/random/index /autoapi/agent0/core/hyperdrive/policies/random_hold/index /autoapi/agent0/core/hyperdrive/policies/random_hold_test/index /autoapi/agent0/core/hyperdrive/policies/random_test/index /autoapi/agent0/core/hyperdrive/policies/simple_lp/index /autoapi/agent0/core/hyperdrive/policies/simple_lp_test/index /autoapi/agent0/core/hyperdrive/policies/smart_long/index /autoapi/agent0/core/hyperdrive/policies/zoo/index Classes ------- .. autoapisummary:: agent0.core.hyperdrive.policies.HyperdriveBasePolicy agent0.core.hyperdrive.policies.PolicyZoo Package Contents ---------------- .. py:class:: HyperdriveBasePolicy(policy_config: Config) Bases: :py:obj:`agent0.core.base.policies.BasePolicy`\ [\ :py:obj:`agent0.ethpy.hyperdrive.HyperdriveReadInterface`\ , :py:obj:`agent0.core.hyperdrive.agent.HyperdriveWallet`\ ] Hyperdrive policy. .. !! processed by numpydoc !! .. py:method:: close_matured_positions(wallet: agent0.core.hyperdrive.agent.HyperdriveWallet, pool_state: agent0.ethpy.hyperdrive.state.PoolState, minimum_trade_amount: fixedpointmath.FixedPoint = FixedPoint(0)) -> list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]] Generate actions to close longs and shorts that have matured. :param wallet: The agent's wallet. :type wallet: HyperdriveWallet :param pool_state: The current state of the Hyperdrive pool. :type pool_state: PoolState :param minimum_trade_amount: A mimimum amount to trade; if the matured position is smaller than this amount then it will not be closed. Defaults to 0. :type minimum_trade_amount: FixedPoint, optional :returns: Is a list of Hyperdrive trade actions for closing matured longs and shorts. :rtype: list[MarketAction] .. !! processed by numpydoc !! .. py:method:: action(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, wallet: agent0.core.hyperdrive.agent.HyperdriveWallet) -> tuple[list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]], bool] :abstractmethod: Return an empty list, indicating no action. :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 !! .. py:method:: post_action(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, trade_results: list[agent0.core.hyperdrive.TradeResult]) -> None Execute any behavior after after the actions specified by the `action` function have been executed. This allows the policy to e.g., do additional bookkeeping based on the results of the executed actions. :param interface: The trading market interface. :type interface: MarketInterface :param trade_results: A list of HyperdriveTradeResult objects, one for each trade made by the agent. The order of the list matches the original order of `agent.action`. HyperdriveTradeResult contains any information about the trade, as well as any errors that the trade resulted in. :type trade_results: list[HyperdriveTradeResult] .. !! processed by numpydoc !! .. py:class:: PolicyZoo Bases: :py:obj:`NamedTuple` All policies in agent0. .. !! processed by numpydoc !! .. py:attribute:: random .. py:attribute:: random_hold .. py:attribute:: smart_long .. py:attribute:: simple_lp .. py:attribute:: lp_and_arb .. py:attribute:: deterministic .. py:method:: describe(policies: list | str | None = None) -> str Describe policies, either specific ones provided, or all of them. :param policies: A policy name string or list of policy names to describe. If not provided, then all available policies are described. :type policies: list | str | None, optional :returns: A string containing the policy descriptions joined by new-lines. :rtype: str .. !! processed by numpydoc !!