agent0.core.test_utils ====================== .. py:module:: agent0.core.test_utils .. autoapi-nested-parse:: Test fixtures for agent0 .. !! processed by numpydoc !! Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/agent0/core/test_utils/assert_never/index /autoapi/agent0/core/test_utils/cycle_trade_policy/index Classes ------- .. autoapisummary:: agent0.core.test_utils.CycleTradesPolicy Functions --------- .. autoapisummary:: agent0.core.test_utils.assert_never agent0.core.test_utils.cycle_trade_policy Package Contents ---------------- .. py:function:: assert_never(arg: NoReturn) -> NoReturn Helper function for exhaustive matching on ENUMS. .. note:: This ensures that all ENUM values are checked, via an exhaustive match: https://github.com/microsoft/pyright/issues/2569 :param arg: The enum value. :type arg: NoReturn .. !! processed by numpydoc !! .. py:class:: CycleTradesPolicy(policy_config: Config) Bases: :py:obj:`agent0.core.hyperdrive.policies.HyperdriveBasePolicy` A agent that simply cycles through all trades. .. !! processed by numpydoc !! .. py:class:: Config Bases: :py:obj:`agent0.core.hyperdrive.policies.HyperdriveBasePolicy.Config` Custom config arguments for this policy. .. !! processed by numpydoc !! .. py:attribute:: max_trades :type: int | None :value: None The maximum amount of trades to make before this policy is done trading. .. !! processed by numpydoc !! .. py:attribute:: counter :value: 0 .. py:attribute:: max_trades .. py:method:: action(interface: agent0.ethpy.hyperdrive.HyperdriveReadInterface, wallet: agent0.core.hyperdrive.HyperdriveWallet) -> tuple[list[agent0.core.base.Trade[agent0.core.hyperdrive.HyperdriveMarketAction]], bool] This agent simply opens all trades for a fixed amount and closes them after, one at a time :param interface: The trading market. :type interface: HyperdriveReadInterface :param wallet: 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:function:: cycle_trade_policy() -> Type[CycleTradesPolicy] Test fixture to build a policy that cycles through all trades. :returns: A policy that cycles through all trades. :rtype: CycleTradesPolicy .. !! processed by numpydoc !!