learning_ai_invt_trdg/backend/.env.example
Saravana Achu Mac 1377bf2453 fix(C6): require explicit FMP API key
Remove the silent shared demo-key fallback for FMP-backed research and screener routes, document the required key, and make backend/.env.example trackable so setup guidance has one source of truth.

Refs: docs/AUDIT_REDESIGN.md item C6.

Co-Authored-By: GPT-5 Codex <noreply@openai.com>
2026-05-04 17:01:00 -07:00

129 lines
4.1 KiB
Plaintext

# =============================================================================
# ByteLyst Trading — Backend Environment Configuration
# Copy this file to .env and fill in your values.
# Production: pull secrets from Azure Key Vault (see docs/AZURE_INFRASTRUCTURE.md)
# =============================================================================
# --- Server ---
API_PORT=4018
CORS_ALLOWED_ORIGINS=http://localhost:5173
# --- Platform Auth (required for production) ---
# Set PLATFORM_AUTH_ENABLED=true to require platform JWT (RS256) verification.
# For local dev with legacy Supabase JWTs, set false and provide JWT_SECRET.
PLATFORM_AUTH_ENABLED=false
PLATFORM_API_URL=http://localhost:4003/api
PLATFORM_JWT_ISSUER=bytelyst-platform
PLATFORM_JWT_PUBLIC_KEY=
PLATFORM_JWT_JWKS_URL=
JWT_SECRET=change-me-for-local-dev
# --- Azure Key Vault (optional — skipped if unset) ---
# Set to trigger automatic secret resolution at startup via DefaultAzureCredential.
# Pulls invttrdg-* secrets into the env vars below before the app starts.
AZURE_KEYVAULT_URL=
# --- Cosmos DB (primary data store) ---
# Pulled from Key Vault in production (invttrdg-cosmos-*).
COSMOS_ENDPOINT=https://cosmos-mywisprai.documents.azure.com:443/
COSMOS_KEY=your_cosmos_key
COSMOS_DATABASE=invttrdg
# --- Azure OpenAI (AI Foundry — preferred over direct OpenAI in production) ---
# Pulled from Key Vault in production (invttrdg-azure-openai-*).
# When set, LLM_PROVIDER is auto-detected as 'azure'.
AZURE_OPENAI_ENDPOINT=
AZURE_OPENAI_KEY=
AZURE_OPENAI_DEPLOYMENT=gpt-4o
# --- Plug-and-Play Configuration ---
PROVIDER=alpaca # Options: 'alpaca' or 'ccxt'
# Asset Details
SYMBOL=BTC/USD
TIMEFRAME=1Min
POLLING_INTERVAL=60000
# --- Alpaca Settings ---
ALPACA_API_KEY=your_key
ALPACA_API_SECRET=your_secret
PAPER_TRADING=true
ASSET_CLASS=crypto # 'crypto' or 'us_equity'
# --- Research Data (Financial Modeling Prep) ---
# Required for /api/research/* and /api/screener. Free tier: 250 req/day.
# Register at https://financialmodelingprep.com/developer/docs; do not use the
# shared "demo" key outside ad-hoc manual experiments.
FMP_API_KEY=your_fmp_key
# --- CCXT Settings ---
EXCHANGE=binance
CCXT_API_KEY=your_key
CCXT_API_SECRET=your_secret
# --- Notifications ---
WEBHOOK_URL=https://discord.com/api/webhooks/your/url
# --- AI Configuration ---
AI_PROVIDER=perplexity
PERPLEXITY_API_KEY=your_perplexity_key
OPENAI_API_KEY=your_openai_key
GEMINI_API_KEY=your_gemini_key
AI_FALLBACK_LIST=perplexity,openai,gemini
AI_MODEL=sonar
AI_CONFIDENCE_THRESHOLD=70
AI_CACHE_HOURS=4
# --- Features ---
LOW_STRESS_MODE=false
ENABLE_TREND_ALERTS=true
ENABLE_PULSE_ALERTS=true
ENABLE_TRADING=true
TOTAL_CAPITAL=1000
MAX_OPEN_TRADES=3
# Feature flags (opt-out: omit or true = enabled, false = disabled)
ENABLE_BACKTEST=false
BACKTEST_CUSTOMER_ENABLED=false
TAB_MARKETPLACE_ENABLED=true
TAB_MEMBERSHIP_ENABLED=true
ENABLE_STRICT_CAPITAL_GUARD=true
STRICT_CAPITAL_SLIPPAGE_BUFFER_PCT=1.0
STRICT_CAPITAL_FEE_BUFFER_PCT=0.15
STRICT_CAPITAL_MIN_RESERVE_USD=0
# --- Alpaca Omnibus Sub-tagging ---
ENABLE_ALPACA_SUBTAG=false
SUBTAG_OMNIBUS_ONLY=true
ALPACA_SUBTAG_ENV=paper
ALPACA_SUBTAG_MAX_LENGTH=48
ALPACA_SUBTAG_DISABLE_FOR_EXCHANGE=
ALPACA_OMNIBUS_PROFILE_ALLOWLIST=
# --- Reconciliation EXIT Backfill Safety ---
ENABLE_RECON_EXIT_BACKFILL=true
RECON_EXIT_BACKFILL_DRY_RUN=true
RECON_EXIT_BACKFILL_REQUIRE_PAUSE=true
RECON_EXIT_BACKFILL_DUST_ABS_QTY=0.001
RECON_EXIT_BACKFILL_DUST_REL_PCT=0.002
RECON_EXIT_BACKFILL_LOOKBACK_HOURS=72
RECON_EXIT_BACKFILL_REQUIRE_STRONG_ATTRIBUTION=true
RECON_EXIT_BACKFILL_ALLOW_HEURISTIC_MATCH=false
RECON_EXIT_BACKFILL_FILL_AFTER_TRADE_GRACE_MINUTES=5
# --- Reconciliation Parity Watchdog Auto-Resume ---
ENABLE_RECON_WATCHDOG_AUTO_RESUME=true
RECON_WATCHDOG_AUTO_RESUME_MIN_PAUSE_MS=900000
RECON_WATCHDOG_AUTO_RESUME_CLEAN_CYCLES=2
RECON_WATCHDOG_AUTO_RESUME_COOLDOWN_MS=1800000
# --- Supabase (legacy fallback — Cosmos DB is primary) ---
# Required only if Cosmos DB is not configured or for legacy auth fallback.
SUPABASE_URL=your_supabase_url
SUPABASE_KEY=your_supabase_key
# --- Product Identity ---
# Auto-set from Key Vault (invttrdg-product-id) in production; default is fine for local dev.
PRODUCT_ID=invttrdg