agent0.core.test_utils.cycle_trade_policy

Pytest fixture that creates an in memory db session and creates dummy db schemas

Classes

CycleTradesPolicy

A agent that simply cycles through all trades.

Functions

cycle_trade_policy(→ Type[CycleTradesPolicy])

Test fixture to build a policy that cycles through all trades.

Module Contents

class agent0.core.test_utils.cycle_trade_policy.CycleTradesPolicy(policy_config: Config)

Bases: agent0.core.hyperdrive.policies.HyperdriveBasePolicy

A agent that simply cycles through all trades.

class Config

Bases: agent0.core.hyperdrive.policies.HyperdriveBasePolicy.Config

Custom config arguments for this policy.

max_trades: int | None = None

The maximum amount of trades to make before this policy is done trading.

counter = 0
max_trades
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

Parameters:
Returns:

A tuple where the first element is a list of actions, and the second element defines if the agent is done trading

Return type:

tuple[list[MarketAction], bool]

agent0.core.test_utils.cycle_trade_policy.cycle_trade_policy() Type[CycleTradesPolicy]

Test fixture to build a policy that cycles through all trades.

Returns:

A policy that cycles through all trades.

Return type:

CycleTradesPolicy