agent0.core.base

The agent0 base module exports some types here.

Submodules

Attributes

WEI

Classes

BaseMarketAction

Market action specification

EthWallet

Stateful variable for storing what is in the agent's wallet.

Freezable

Config object with frozen attributes.

MarketType

A type of market.

Quantity

An amount with a unit.

TokenType

A type of token.

Trade

A trade for a market.

Package Contents

class agent0.core.base.BaseMarketAction

Bases: Generic[T]

Market action specification

action_type: T
class agent0.core.base.EthWallet

Stateful variable for storing what is in the agent’s wallet.

address: hexbytes.HexBytes

The associated agent’s eth address.

balance: agent0.core.base.types.Quantity

The base assets that held by the trader.

copy() EthWallet

Return a new copy of self.

Returns:

A deepcopy of the wallet.

Return type:

EthWallet

check_valid_wallet_state(dictionary: dict | None = None) None

Test that all wallet state variables are greater than zero.

Parameters:

dictionary (dict | None, optional) – The dictionary to check. If not provided, it will use self.__dict__.

agent0.core.base.WEI
class agent0.core.base.Freezable

Config object with frozen attributes.

freeze() None

Disallows changing existing members.

disable_new_attribs() None

Disallows adding new members.

astype(new_type)

Cast all member attributes to a new type.

Parameters:

new_type (Any) – The type to cast to.

property dtypes: dict[str, type]

Return a dict listing name & type of each member variable.

Returns:

The named types of the class.

Return type:

dict[str, type]

class agent0.core.base.MarketType

Bases: enum.Enum

A type of market.

HYPERDRIVE = 'hyperdrive'
BORROW = 'borrow'
class agent0.core.base.Quantity

An amount with a unit.

amount: fixedpointmath.FixedPoint
unit: TokenType
class agent0.core.base.TokenType

Bases: enum.Enum

A type of token.

BASE = 'base'
class agent0.core.base.Trade

Bases: Generic[MarketAction]

A trade for a market.

market_type: MarketType
market_action: MarketAction