Files
DinQuant/backend_api_python/env.example
T

188 lines
5.2 KiB
Plaintext
Raw Normal View History

2025-12-29 03:06:49 +08:00
# QuantDinger local configuration (copy to `.env` and edit)
# `run.py` will load `backend_api_python/.env` automatically if present.
# =========================
# Auth (local login)
# =========================
SECRET_KEY=quantdinger-secret-key-change-me
ADMIN_USER=quantdinger
ADMIN_PASSWORD=123456
# =========================
# Network / App
# =========================
PYTHON_API_HOST=0.0.0.0
PYTHON_API_PORT=5000
PYTHON_API_DEBUG=False
2025-12-30 21:02:38 +08:00
# =========================
# Database (SQLite)
# =========================
# 主库文件路径(可选)
# - 不设置时,默认使用:backend_api_python/data/quantdinger.db
# - Docker 推荐:/app/data/quantdinger.db
SQLITE_DATABASE_FILE=
2025-12-29 03:06:49 +08:00
# =========================
# Pending orders worker (optional)
# =========================
# Paper mode default: disabled. If enabled, it will consume `pending_orders` and dispatch signals via webhook.
# Poll and dispatch orders from `pending_orders` (live/signal).
# Local mode default is enabled in code, but you can override here.
ENABLE_PENDING_ORDER_WORKER=true
# Reclaim orders stuck in status=processing after worker crashes (seconds).
PENDING_ORDER_STALE_SEC=90
# =========================
# Strategy signal notifications (optional)
# =========================
# The frontend stores per-strategy notification_config.targets.*, but you can also set
# a global fallback webhook URL used when a strategy enables "webhook" channel but
# doesn't provide targets.webhook.
SIGNAL_WEBHOOK_URL=
SIGNAL_WEBHOOK_TOKEN=
# HTTP timeout for outbound notification requests (seconds).
SIGNAL_NOTIFY_TIMEOUT_SEC=6
# Telegram (required if you enable telegram channel)
TELEGRAM_BOT_TOKEN=
# Email / SMTP (required if you enable email channel)
SMTP_HOST=
SMTP_PORT=587
SMTP_USER=
SMTP_PASSWORD=
SMTP_FROM=
SMTP_USE_TLS=true
SMTP_USE_SSL=false
# Phone / SMS (optional; Twilio REST, required if you enable phone channel)
TWILIO_ACCOUNT_SID=
TWILIO_AUTH_TOKEN=
TWILIO_FROM_NUMBER=
# Restore strategies with status='running' on backend startup.
# Set to true to disable auto-restore.
DISABLE_RESTORE_RUNNING_STRATEGIES=false
# =========================
# Strategy execution loop (tick interval)
# =========================
# Default tick interval for strategy monitoring loop (seconds).
# The strategy thread will fetch current price and evaluate triggers once per tick.
STRATEGY_TICK_INTERVAL_SEC=10
# In-memory price cache TTL (seconds). Normally doesn't matter when tick interval is >= TTL.
PRICE_CACHE_TTL_SEC=10
# =========================
# Outbound Proxy (optional, recommended if your network blocks data providers)
# =========================
# If you use a local proxy (common ports: 7890/7891/10808), set PROXY_PORT only.
# Default scheme is socks5h and host is 127.0.0.1.
2026-01-03 20:25:58 +08:00
# For Docker deployment: set PROXY_HOST=host.docker.internal to access host's proxy
2025-12-29 03:06:49 +08:00
PROXY_PORT=
PROXY_HOST=127.0.0.1
PROXY_SCHEME=socks5h
PROXY_URL=
# You can also set standard variables directly (advanced):
# ALL_PROXY=socks5h://127.0.0.1:10808
# HTTP_PROXY=socks5h://127.0.0.1:10808
# HTTPS_PROXY=socks5h://127.0.0.1:10808
# Allow frontend dev server
CORS_ORIGINS=*
# Request rate limit (per minute)
RATE_LIMIT=100
ENABLE_CACHE=False
ENABLE_REQUEST_LOG=True
ENABLE_AI_ANALYSIS=True
2025-12-30 21:02:38 +08:00
# =========================
# Agent memory & reflection (optional)
# =========================
# Toggle agent memory usage in multi-agent analysis
ENABLE_AGENT_MEMORY=true
# Memory retrieval settings
AGENT_MEMORY_ENABLE_VECTOR=true
AGENT_MEMORY_EMBEDDING_DIM=256
AGENT_MEMORY_TOP_K=5
AGENT_MEMORY_CANDIDATE_LIMIT=500
AGENT_MEMORY_HALF_LIFE_DAYS=30
AGENT_MEMORY_W_SIM=0.75
AGENT_MEMORY_W_RECENCY=0.20
AGENT_MEMORY_W_RETURNS=0.05
# Automated verification loop (replaces cron)
ENABLE_REFLECTION_WORKER=false
REFLECTION_WORKER_INTERVAL_SEC=86400
2025-12-29 03:06:49 +08:00
# =========================
# OpenRouter / LLM
# =========================
OPENROUTER_API_KEY=
OPENROUTER_API_URL=https://openrouter.ai/api/v1/chat/completions
OPENROUTER_MODEL=openai/gpt-4o
OPENROUTER_TEMPERATURE=0.7
OPENROUTER_MAX_TOKENS=4000
OPENROUTER_TIMEOUT=300
OPENROUTER_CONNECT_TIMEOUT=30
# Optional: override model list shown in UI (JSON object: {"model_id":"Display Name", ...})
AI_MODELS_JSON={}
# =========================
# Market presets (optional)
# =========================
# Optional: override market types shown in UI (JSON array)
MARKET_TYPES_JSON=[]
# Optional: supported crypto symbols list (JSON array)
TRADING_SUPPORTED_SYMBOLS_JSON=[]
# =========================
# Data sources (Kline / pricing)
# =========================
DATA_SOURCE_TIMEOUT=30
DATA_SOURCE_RETRY=3
DATA_SOURCE_RETRY_BACKOFF=0.5
# Finnhub (US stocks / forex helpers depending on implementation)
FINNHUB_API_KEY=
FINNHUB_TIMEOUT=10
FINNHUB_RATE_LIMIT=60
# CCXT (crypto via Binance by default)
2025-12-30 17:03:22 +08:00
CCXT_DEFAULT_EXCHANGE=coinbase
2025-12-29 03:06:49 +08:00
CCXT_TIMEOUT=10000
CCXT_PROXY=
# Akshare (CN/HK stocks if enabled)
AKSHARE_TIMEOUT=30
# YFinance
YFINANCE_TIMEOUT=30
# Tiingo (optional)
TIINGO_API_KEY=
TIINGO_TIMEOUT=10
# =========================
# Web Search (optional)
# =========================
SEARCH_PROVIDER=google
SEARCH_MAX_RESULTS=10
SEARCH_GOOGLE_API_KEY=
SEARCH_GOOGLE_CX=
SEARCH_BING_API_KEY=
# Internal API key (optional, if you add internal-service auth later)
INTERNAL_API_KEY=