Skip to main content

Config precedence

flags > env > config file > defaults Default config path:
${XDG_CONFIG_HOME:-~/.config}/defi/config.yaml
Minimal config example:
output: json
strict: false
timeout: 10s
retries: 2
cache:
  enabled: true
  max_stale: 5m

Useful env vars

VariablePurpose
DEFI_OUTPUTjson or plain
DEFI_TIMEOUTProvider/planner request timeout
DEFI_RETRIESRetries per request
DEFI_MAX_STALEStale fallback window
DEFI_NO_STALEDisable stale fallback
DEFI_NO_CACHEDisable cache
DEFI_CACHE_PATHCache DB path
DEFI_CACHE_LOCK_PATHCache lock path

Cache behavior

  • Fresh cache hits (age <= ttl) return immediately.
  • After TTL expires, CLI refetches providers.
  • Stale data is served only when providers fail temporarily (unavailable or rate_limited) and within max_stale.
  • Cache writes use SQLite WAL + busy timeout + lock/backoff retries to reduce lock contention in parallel runs.
  • If cache init fails (path/permissions), commands continue with cache disabled.
  • Metadata commands (version, schema, providers list, chains list) bypass cache initialization.

Command TTLs

CommandTTL
chains top, chains assets, protocols top, protocols categories, protocols fees, protocols revenue, dexes volume, stablecoins top, stablecoins chains5m
lend markets, yield opportunities, bridge list, bridge details60s
lend rates, lend positions, yield positions30s
yield history5m
bridge quote, swap quote15s
Execution commands (plan, run, submit, status) and action inspection (actions list|show|estimate) bypass cache reads/writes.

Strict mode

If any selected provider fails and partial results occur, --strict returns exit code 15 (partial_results).