# Sample environment file. Copy to .env and fill in values.
# All variables use the MT_ prefix (loaded by pydantic-settings).

# --- Required ---

# TimescaleDB connection URL (PostgreSQL with TimescaleDB extension).
# This is the *application* credential: DML only. The daemon, API server, and
# every CLI read path use it. A leak of this URL cannot TRUNCATE, DROP, or
# write the migration ledger.
MT_TIMESCALE_DB_URL=postgresql://user:password@host:5432/trading

# Migration/maintenance credential — DDL rights. Needed ONLY by schema and
# maintenance commands: `mt data migrate apply`, `mt data init`,
# `mt data rechunk`, `mt data caggs repair`, `mt data caggs refresh`, and
# `mt data restore run`. Leave unset for normal operation; those commands fail
# loudly naming this variable rather than silently falling back to the
# application URL. Provision both roles with scripts/provision_roles.sql.
# MT_TIMESCALE_MAINTENANCE_URL=postgresql://trading_migrate:password@host:5432/trading

# EODHD API token — used for all data acquisition and universe rebuild.
MT_EODHD_API_KEY=your-eodhd-api-key

# --- Recommended ---

# Finnhub API token — used for IPO-date enrichment during instruments rebuild.
# Without this, first_listing_date will not be populated.
MT_FINNHUB_API_KEY=your-finnhub-api-key

# --- Optional ---

# Log level: DEBUG, INFO (default), WARNING, ERROR
# MT_LOG_LEVEL=INFO

# Minute data provider (default: eodhd)
# MT_MINUTE_PROVIDER=eodhd

# Daily data provider (default: eodhd)
# MT_DAILY_PROVIDER=eodhd

# Daily API credit cap for EODHD (default: 100000)
# MT_EODHD_DAILY_LIMIT=100000

# --- Test / CI ---

# Admin connection URL for the integration and load tiers. The ephemeral_db /
# migrated_db fixtures use it to CREATE and DROP throwaway databases, so it
# points at the `postgres` maintenance database, never the application database.
#
# Use `trading_test_admin` — a role holding LOGIN CREATEDB and nothing else —
# not a superuser. The fixtures need only database create/drop; a superuser here
# can reach production by swapping the database name in this URL, which is
# precisely what `swap_dbname` does. Provision the role with
# scripts/provision_roles.sql; test/integration/data/test_test_admin_role.py
# fails if this is repointed at a superuser.
# MT_TIMESCALE_TEST_URL=postgresql://trading_test_admin:password@host:5432/postgres
