almanak_library.metrics.metrics_actions
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()
MetricActionType Objects
class MetricActionType(Enum)
GAS
FEES
WRAP
UNWRAP
APPROVE
SWAP
OPEN_POSITION
CLOSE_POSITION
MetricsActionTable Objects
class MetricsActionTable(SQLModel)
__tablename__
id
time
block_number
metric_type
strategy_id
action_id
bundle_id
wallet_address
details
agent_id
user_id
__table_args__
MetricsActionHandler Objects
class MetricsActionHandler()
__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: MetricsActionTable) -> None
get_metrics_action
@retry(tries=3, delay=2, backoff=2, jitter=(1, 3), exceptions=(Exception, ))
def get_metrics_action(strategy_id: Optional[str] = None,
metric_type: Optional[MetricActionType] = None,
wallet_address: Optional[str] = None)
metric_exists
def metric_exists(metric_type: str, action_id: str) -> bool