agent0.core.base.policies

Policies for expert system trading agents

Submodules

Classes

BasePolicy

Base class policy.

NoActionPolicy

NoOp class policy

Package Contents

class agent0.core.base.policies.BasePolicy(policy_config: Config)

Bases: Generic[MarketInterface, Wallet]

Base class policy.

class Config

Bases: agent0.core.base.types.Freezable

Config data class for policy specific configuration.

rng_seed: int | None = None

The seed for the random number generator. Defaults to None.

rng: numpy.random.Generator | None = None

The experiment’s stateful random number generator. Defaults to a spawn of the global rng.

slippage_tolerance: fixedpointmath.FixedPoint | None = None

The slippage tolerance for trades. Defaults to None.

base_fee_multiple: float | None = None

The base fee multiple for transactions. Defaults to None.

priority_fee_multiple: float | None = None

The priority fee multiple for transactions. Defaults to None.

gas_limit: int | None = None

Maximum gas to spend per trade.

config: Any
slippage_tolerance
property name: str

Return the class name.

Returns:

The class name.

Return type:

str

abstract action(interface: MarketInterface, wallet: Wallet) tuple[list[agent0.core.base.types.Trade], bool]

Specify actions.

Parameters:
  • interface (MarketInterface) – The trading market interface.

  • wallet (Wallet) – The agent’s wallet.

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[Trade], bool]

classmethod describe(raw_description: str) str

Describe the policy in a user friendly manner that allows newcomers to decide whether to use it.

Parameters:

raw_description (str) – The description of the policy’s action plan.

Returns:

A description of the policy.

Return type:

str

class agent0.core.base.policies.NoActionPolicy(policy_config: Config)

Bases: agent0.core.base.policies.base.BasePolicy[agent0.core.base.policies.base.MarketInterface, agent0.core.base.policies.base.Wallet]

NoOp class policy

action(interface: agent0.core.base.policies.base.MarketInterface, wallet: agent0.core.base.policies.base.Wallet) tuple[list[agent0.core.base.types.Trade], bool]

Returns an empty list, indicating no action

Parameters:
  • interface (MarketInterface) – The trading market interface.

  • wallet (Wallet) – The agent’s wallet.

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]

classmethod description() str

Describe the policy in a user friendly manner that allows newcomers to decide whether to use it.

Returns:

A description of the policy.

Return type:

str