Skip to main content

almanak_library.metrics.metrics_agg

datetime

timezone

Enum

Path

Optional

retry

JSON

Column

UniqueConstraint

sessionmaker

Field

Session

SQLModel

select

get_metrics_engine

Config

STORAGE_DIR

LOCAL_DB_PATH

READ_ONLY_MODE

IS_AGENT_DEPLOYMENT

METRICS_DB_CONNECTION_STRING

default_agent_id

def default_agent_id()

default_user_id

def default_user_id()

MetricAggType Objects

class MetricAggType(Enum)

INITIALIZATION

TEARDOWN

STRATEGY_BALANCE

WALLET_BALANCE

SNAPSHOT

Deprecated - to be replaced WALLET_BALANCE

REBALANCE_TRIGGER

MetricsAggTable Objects

class MetricsAggTable(SQLModel)

__tablename__

id

time

block_number

metric_type

strategy_id

action_id

bundle_id

wallet_address

details

agent_id

user_id

__table_args__

MetricsAggHandler Objects

class MetricsAggHandler()

__init__

def __init__(db_connection_string)

create_tables

def create_tables()

add_metric

@retry(tries=3, delay=2, backoff=2, jitter=(1, 3), exceptions=(Exception, ))
def add_metric(metric: MetricsAggTable) -> None

get_metrics_agg

@retry(tries=3, delay=2, backoff=2, jitter=(1, 3), exceptions=(Exception, ))
def get_metrics_agg(strategy_id: Optional[str] = None,
metric_type: Optional[MetricAggType | str] = None,
wallet_address: Optional[str] = None)

IS_SQL_PROXY

SQL_PROXY_ADDRESS

USE_SQL_PROXY