| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||
Flask-based backend for QuantDinger: market data, indicators, AI analysis, backtesting, and a strategy runtime with multi-user support.
backend_api_python/
|-- app/
| |-- __init__.py # Flask app factory + startup hooks
| |-- config/ # Settings (env-driven)
| |-- data_sources/ # Data sources + factory
| |-- routes/ # REST endpoints
| |-- services/ # Analysis, agents, strategies, search, user_service
| |-- utils/ # PostgreSQL helpers, config loader, logging, HTTP utils
|-- migrations/
| |-- init.sql # PostgreSQL schema initialization
|-- env.example # Copy to .env for local config
|-- requirements.txt
|-- run.py # Entrypoint (loads .env, applies proxy env, starts Flask)
|-- gunicorn_config.py # Optional production config
|-- README.md
python scripts/backend_quality_check.pyExchange integrations should add offline fixtures and pass:
python scripts/exchange_smoke_test.py --offline-contractsCreate .env file in project root:
# Database
POSTGRES_USER=quantdinger
POSTGRES_PASSWORD=your_secure_password
POSTGRES_DB=quantdinger
# Admin account (created on first startup)
ADMIN_USER=admin
ADMIN_PASSWORD=your_admin_password
# Optional
OPENROUTER_API_KEY=your_api_keyAtlasCloud is supported as an OpenAI-compatible LLM provider. See the official AtlasCloud LLM API docs and API key guide, then set:
LLM_PROVIDER=atlascloud
ATLASCLOUD_API_KEY=your_api_key
ATLASCLOUD_MODEL=deepseek-v3
ATLASCLOUD_BASE_URL=https://api.atlascloud.ai/v1Release builds inject the backend app version from the Git tag (v3.0.23 -> 3.0.23). Local source runs fall back to git describe and then the repo-root VERSION file; local Docker builds can override with APP_VERSION.
docker-compose up -dThis will:
# Create database and user
sudo -u postgres psql
CREATE DATABASE quantdinger;
CREATE USER quantdinger WITH ENCRYPTED PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE quantdinger TO quantdinger;
\q
# Initialize schema
psql -U quantdinger -d quantdinger -f migrations/init.sqlcd backend_api_python
pip install -r requirements.txtWindows (CMD):
copy env.example .envWindows (PowerShell):
Copy-Item env.example .envThen edit .env and set:
# Required
DATABASE_URL=postgresql://quantdinger:your_password@localhost:5432/quantdinger
SECRET_KEY=your-secret-key-change-me
ADMIN_USER=admin
ADMIN_PASSWORD=your_admin_password
# Optional but recommended
OPENROUTER_API_KEY=your_api_keyFor AtlasCloud instead, use:
LLM_PROVIDER=atlascloud
ATLASCLOUD_API_KEY=your_api_key
ATLASCLOUD_MODEL=deepseek-v3
ATLASCLOUD_BASE_URL=https://api.atlascloud.ai/v1python run.pyDefault address: http://localhost:5000
| Role | Permissions |
|---|---|
| admin | Full access + user management |
| manager | Strategy, backtest, portfolio, settings |
| user | Strategy, backtest, portfolio (own data) |
| viewer | Dashboard view only |
POST /api/user/login - User login
POST /api/user/logout - User logout
GET /api/user/info - Get current user info
GET /api/users/list - List all users
POST /api/users/create - Create user
PUT /api/users/update?id= - Update user
DELETE /api/users/delete?id= - Delete user
POST /api/users/reset-password - Reset password
GET /api/users/profile - Get own profile
PUT /api/users/profile/update - Update own profile
POST /api/users/change-password - Change own password
GET /api/health
GET /api/indicator/kline
GET /api/global-market/adanos-sentiment?tickers=AAPL,TSLA
POST /api/fast-analysis/analyze - Fast AI analysis (main entry)
GET /api/fast-analysis/history - Analysis history
GET /api/fast-analysis/similar-patterns - RAG similar patterns
POST /api/fast-analysis/feedback - User feedback on analysis
Set ADANOS_API_KEY to enable optional US stock sentiment enrichment from the Adanos Market Sentiment API. If the key is not configured, the endpoint returns enabled=false and the rest of QuantDinger continues to work normally.
ADANOS_API_KEY=your_adanos_key
ADANOS_SENTIMENT_SOURCE=reddit # reddit, x, news, or polymarketExample:
GET /api/global-market/adanos-sentiment?tickers=AAPL,TSLA&source=reddit&days=7
The response normalizes common compare fields across sources, including sentiment_score, buzz_score, bullish_pct, bearish_pct, mentions, trend, trend_history, and source-specific activity metrics such as subreddit_count, unique_tweets, source_count, trade_count, market_count, and total_liquidity.
The global-market economic calendar is free-first. By default it uses the no-key AkShare/WallstreetCN calendar fallback. If you configure TRADING_ECONOMICS_CLIENT and TRADING_ECONOMICS_KEY, QuantDinger will try Trading Economics as the official international calendar provider before falling back. Finnhub paid-only calendar and social-sentiment endpoints are skipped by default through FINNHUB_FREE_ONLY=true.
Only set FINNHUB_FREE_ONLY=false if your Finnhub plan explicitly includes those paid endpoints.
Uses FastAnalysisService (single LLM call, multi-factor):
For local Vue dev (private frontend repo):
gunicorn -c gunicorn_config.py "run:app"Apache License 2.0. See repository root LICENSE.
| Back | FazBrowse Home | New Git URL |