apex.config

Documentation for eth_defi.apex.config Python module.

Environment configuration for the ApeX vault reader.

Functions

parse_apex_duration(value)

Parse a strictly positive ApeX scheduling duration.

Classes

ApexReaderConfig

Validated standalone ApeX reader configuration.

parse_apex_duration(value)

Parse a strictly positive ApeX scheduling duration.

The parser accepts decimal seconds, minutes, hours and days. Scheduling cadence is deliberately independent of the database timestamp schema.

Parameters

value (str) – Duration such as 30s, 30m, 1.5h or 2d.

Returns

Parsed positive duration.

Raises

ValueError – The value is malformed, unsupported or non-positive.

Return type

datetime.timedelta

class ApexReaderConfig

Bases: object

Validated standalone ApeX reader configuration.

log_level: str

Console log level.

db_path: pathlib.Path

DuckDB database path.

vault_ids: Optional[tuple[str, ...]]

Optional targeted vault IDs.

max_workers: int

History HTTP worker count.

requests_per_second: float

Process-wide public API request rate.

connect_timeout: float

TCP connection timeout in seconds.

read_timeout: float

Socket inactivity timeout in seconds.

request_deadline: float

Per-request monotonic operation budget in seconds.

ranking_deadline: float

Whole-ranking monotonic operation budget in seconds.

history_deadline: float

Per-vault history monotonic operation budget in seconds.

max_retry_delay: float

Maximum retry sleep in seconds.

max_response_bytes: int

Maximum JSON response size.

history_mode: Literal['incremental', 'refresh', 'none']

History scan mode.

history_refresh_interval: datetime.timedelta

History maintenance cadence.

loop: bool

Whether the standalone command repeats.

scan_interval: datetime.timedelta

Ranking scan cadence owned by the command.

classmethod from_environment(environ=None)

Build configuration from environment variables.

Parameters

environ (Optional[collections.abc.Mapping[str, str]]) – Environment mapping. Defaults to os.environ.

Returns

Fully validated reader configuration.

Return type

eth_defi.apex.config.ApexReaderConfig

__init__(log_level, db_path, vault_ids, max_workers, requests_per_second, connect_timeout, read_timeout, request_deadline, ranking_deadline, history_deadline, max_retry_delay, max_response_bytes, history_mode, history_refresh_interval, loop, scan_interval)
Parameters
Return type

None