110 Commits

Author SHA1 Message Date
dienakdz 87f2845483 Refactor code for improved readability and consistency
- Cleaned up whitespace and formatting in various files including http.py, language.py, logger.py, safe_exec.py, and SQL migration scripts.
- Consolidated import statements and removed unnecessary blank lines.
- Updated logging configuration for better clarity.
- Enhanced the safe execution code with improved error handling and logging.
- Removed commented-out code and unnecessary variables in backfill_zero_trades.py and other scripts.
- Added a pyproject.toml for Ruff and Vulture configuration.
- Introduced requirements-dev.txt for development dependencies.
- Removed commented-out stock entries in init.sql for cleaner migration scripts.
2026-04-09 14:30:51 +07:00
dienakdz 68b296117b Merge branch 'main' of https://github.com/brokermr810/QuantDinger 2026-04-08 09:12:41 +07:00
dienakdz c3cf230104 feat(trading-assistant): refactor strategy creation and enhance script mode functionality
- Removed conditional rendering for the assistant guide bar.
- Simplified strategy overview and strategy list item components.
- Introduced a new modal for selecting strategy mode.
- Enhanced strategy creation modal to support script strategies with a dedicated editor.
- Updated form handling for script strategies, including validation and submission logic.
- Improved user experience with better messaging and streamlined UI components.
- Updated translations for better clarity in Chinese.
2026-04-08 07:27:26 +07:00
Dinger 8563e4ea53 v3.0.1
Signed-off-by: Dinger <quantdinger@gmail.com>
2026-04-07 22:47:07 +08:00
Dinger baa3182eca v3.0.1
Signed-off-by: Dinger <quantdinger@gmail.com>
2026-04-06 23:30:01 +08:00
Dinger de3fd0945b v3.0.1
Signed-off-by: Dinger <quantdinger@gmail.com>
2026-04-06 23:19:41 +08:00
dienakdz 11e2e5aaa6 Refactor and translate comments and docstrings in utility modules to English for better clarity and maintainability. Update Gunicorn and application startup messages for consistency in language. Enhance documentation with English translations for better accessibility. 2026-04-06 16:47:36 +07:00
Dinger 3ca291a346 v3.0.1
Signed-off-by: Dinger <quantdinger@gmail.com>
2026-04-06 01:39:25 +08:00
Dinger 15c901364b v3.0.1
Signed-off-by: Dinger <quantdinger@gmail.com>
2026-03-25 18:08:45 +08:00
Dinger c0cb332432 v2.2.3
Signed-off-by: Dinger <quantdinger@gmail.com>
2026-03-25 13:27:48 +08:00
Dinger 7626328c9c feat(backend): encrypt exchange credentials, remove IS_DEMO_MODE
- Fernet encrypt qd_exchange_credentials via SECRET_KEY (cryptography)

- Remove global read-only demo middleware; drop is_demo from auth payloads

- Egress whitelist: /api/credentials/egress-ip returns ipv4 + ipv6 (ipify)

- Exchange factory: demo/testnet URLs and OKX simulated-trading header

- Bitget spot connection test; misc route/service fixes

Made-with: Cursor
2026-03-24 19:10:18 +08:00
Dinger 2e9c7cd69e feat: AI analysis engine refactor, dark theme polish & virtual position management
Core changes:
- Refactor FastAnalysisService: single LLM multi-factor analysis replaces
  7-agent pipeline; add multi-timeframe consensus, threshold calibration,
  confidence calibration, multi-model ensemble voting
- Add RAG memory injection and reflection validation (analysis_memory +
  reflection worker)
- Simplify billing config: remove unused strategy_run/backtest/portfolio_monitor,
  add ai_code_gen separate billing (different token consumption scale)
- Settings hot-reload after save, no backend restart needed

Frontend:
- Global dark theme overhaul: pure black palette replacing blue-tinted colors
  across sidebar/header/dashboard/analysis/K-line/user-manage/profile/settings/billing
- Fix USDT payment modal dark theme (portal rendering broke CSS selectors)
- Refactor position modal: direction + quantity + entry price, remove add/reduce
  logic, show raw DB values on re-open, save exactly what user inputs
- Fix Polymarket prediction market dark text
- i18n for position modal title

Backend:
- Position management: one record per symbol (DELETE+INSERT replacing
  ON CONFLICT with side), fixes PnL showing 0 when switching long/short
- MarketDataCollector data fetching optimization
- portfolio_monitor scheduled monitoring improvements
- env.example reorganized: common config first, advanced config last

Documentation:
- README architecture diagram updated to FastAnalysisService flow
- Add virtual position, AI tuning config, billing items documentation
- Add INDICATOR_DEFINITIONS_CN.md, FRONTEND_FAST_ANALYSIS.md

Made-with: Cursor
2026-03-23 23:01:04 +08:00
Dinger 05f07ee544 refactor deployment config and exchange integrations
Simplify runtime configuration and remove legacy database and settings surface so new installs are easier to operate.
Refresh deployment assets, docs, and order execution behavior to keep the packaged app aligned with the current backend.

Made-with: Cursor
2026-03-21 18:32:04 +08:00
dinger 9473e50d59 feat: AI 即时分析计费/共识/校准与 Docker 前端构建
- 即时分析:先扣费、防重入(429)、失败退款;记忆库与离线校准 worker
- 多周期共识、客观分与设置项 AI_ANALYSIS_CONSENSUS_TIMEFRAMES
- Docker:前端多阶段构建(QuantDinger-Vue-src)、根目录 .dockerignore、compose 调整
- 同步 frontend/dist 静态资源

Made-with: Cursor
2026-03-20 21:08:26 +08:00
Jinyu Xu b91cfcc7fa chore(release): update social links and v2.2.3
- Update X/Discord links in docs and frontend dist
- Dashboard: report all-time total trades
- Notifications: add unread-count endpoint for badge

Made-with: Cursor
2026-03-17 20:30:04 +08:00
TIANHE ecc44ade59 fix: Fix max drawdown calculation and pandas fillna compatibility
- Fix max drawdown calculation in dashboard to use equity curve instead of cumulative profit
- Add pandas fillna(method=...) compatibility fix for older indicator code
- Cap drawdown percentage at 10000% to avoid display issues
2026-03-12 00:56:29 +08:00
TIANHE b7451c63fb fix: Fix trading precision issues and improve error handling
- Fix quantity precision calculation for Binance, OKX, Bybit, Bitget, Deepcoin exchanges
- Improve OpenRouter API error handling with detailed error messages
- Add SECRET_KEY validation in Docker deployment entrypoint
- Fix K-line chart measurement tool click issue
- Adapt billing page text colors for dark theme
- Update frontend build files
2026-03-12 00:02:53 +08:00
TIANHE db91fa4580 v2.2.2
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
2026-03-01 17:20:37 +08:00
TIANHE d60409f7f8 v2.2.2
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
2026-03-01 03:59:55 +08:00
TIANHE a6ea4d967c v2.2.2
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
2026-03-01 03:42:10 +08:00
TIANHE 7c067fe61c v2.2.1
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
2026-02-28 20:34:33 +08:00
TIANHE 3db3bb2a9a v2.2.1
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
2026-02-28 00:15:58 +08:00
TIANHE cf58ff40fa v2.2.1
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
2026-02-27 23:34:13 +08:00
TIANHE d92d4c53dc v2.2.1
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
2026-02-27 22:28:01 +08:00
TIANHE abbad97bdd v2.2.1: frontend closed-source + Docker one-click deploy
- Remove frontend source code (now in private repo)
- Add pre-built frontend/dist/ with Nginx serving
- Simplify docker-compose.yml (no Node.js build needed)
- Update README with docs index and Docker deploy guide
- Add admin order list and AI analysis stats tabs
- Add quick trade API routes
- Clean up redundant files (package-lock.json, yarn.lock, .iml)
- Add GitHub Actions workflow for frontend update automation
2026-02-27 19:57:23 +08:00
TIANHE ffdd2ffbae V2.2.1: Membership & Billing, USDT TRC20 payment, VIP free indicators, AI Trading Radar, simplified strategy creation, system settings simplification, bug fixes and UI improvements 2026-02-27 01:57:04 +08:00
TIANHE 4c73439bd6 feat: Add System Overview tab to User Management page (admin only)
- Add backend API endpoint /api/users/system-strategies for system-wide strategy data
- Query all strategies across all users with positions, PnL, trade stats
- Add summary statistics (total strategies, running count, total capital, total PnL/ROI)
- Support filtering by status (running/stopped) and search by strategy/symbol/user
- Add System Overview tab with summary cards and detailed strategy table
- Display user, strategy name, status, symbol, capital, PnL/ROI, positions, trades, indicator, exchange, timeframe, leverage
- Add i18n translations for zh-CN and en-US
- Lazy-load strategy data when tab is first accessed
2026-02-13 02:46:59 +08:00
TIANHE f0a5af595d fix: Fix indicator parameter configuration and Docker build issues
- Fix indicator parameter values being reset after modification in indicator-analysis page
- Fix Docker build nginx image pull failure (use specific version tag)
- Add Docker build scripts (PowerShell and Bash versions)
- Revert call_indicator feature (temporarily removed to avoid affecting existing indicator execution)
2026-02-13 02:33:00 +08:00
TIANHE e5bb37bcbb fix: Improve decimal precision handling across all exchange clients
- Add strict_precision parameter to _dec_str methods
- Modify quantity normalization methods to return (Decimal, precision) tuple
- Infer precision from stepSize/lotSz/qtyStep for accurate formatting
- Update all order placement methods to use precision information
- Fix LOT_SIZE filter errors by strictly limiting decimal places

Affected exchanges:
- Binance Spot & Futures
- OKX
- Bybit
- Bitget Spot & Futures
- Deepcoin

This ensures order quantities are formatted with correct precision matching exchange requirements.
2026-02-11 18:28:06 +08:00
TIANHE a51184497d feat: Add cross-sectional strategy support
- Add cross-sectional strategy type (single vs cross-sectional)
- Support multi-symbol portfolio management with automatic ranking
- Add portfolio size, long ratio, and rebalance frequency configuration
- Implement parallel order execution for cross-sectional strategies
- Add frontend UI for strategy type selection and configuration
- Add i18n support (Chinese and English) for cross-sectional features
- Fix decimal precision issues in exchange order quantities
- Add last_rebalance_at field to database schema
- Add comprehensive documentation and examples

Database migration required: Add last_rebalance_at column to qd_strategies_trading table
2026-02-10 15:19:20 +08:00
TIANHE af8e46011e sss
Signed-off-by: TsssIANHE <TIANHE@GMAIL.COM>
2026-02-05 00:28:08 +08:00
TIANHE 8eb38bc6f8 feat: indicator parameterization support for kline chart 2026-02-01 15:02:14 +08:00
TIANHE 5818fbe725 fix: dashboard improvements - remove AI strategy count, fix pie chart, fix position user_id 2026-02-01 12:58:00 +08:00
TIANHE 8a8717a81f chore: merge user_id migration into init.sql 2026-01-31 22:40:41 +08:00
TIANHE 70269c40c9 fix: AI analysis history user isolation & password change Turnstile bypass 2026-01-31 22:34:36 +08:00
guopengfa fbd18851ef qd_indicator_codes add column. 2026-01-31 20:32:52 +08:00
guopengfa 15e5e380e9 qd_indicator_codes add column. 2026-01-31 20:31:43 +08:00
guopengfa 978e562009 qd_indicator_codes add column. 2026-01-31 20:13:24 +08:00
PengfaGuo 6b1158fb9b Merge branch 'brokermr810:main' into main 2026-01-31 10:26:27 +08:00
TIANHE 0b37aa4a67 V2.1.1
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
2026-01-31 02:59:49 +08:00
PengfaGuo f04e4f697d Merge branch 'brokermr810:main' into main 2026-01-28 15:01:05 +08:00
XSX-Milan 2bfbb88d74 feat: 持仓同步优化 + Binance 平仓/减仓安全增强
## 核心功能
1. **持仓自动同步与插入**
   - 修复策略状态查询条件 (active -> running)
   - 移除阻塞空持仓同步的早期返回逻辑
   - 自动检测交易所存在但本地不存在的持仓并插入数据库
   - 修复 INSERT 语句列匹配 (移除 created_at,添加 user_id)

2. **Binance 平仓/减仓优化**
   - 订单执行前强制同步持仓 (Pre-execution Sync)
   - Close/Reduce 订单自动数量修正:防止超额平仓
   - 当请求平仓数量 > 实际持仓时,自动调整为实际持有量
   - 当数据库无持仓记录时,强制设置 amount=0 阻止错误订单

3. **日志增强**
   - 每10秒输出实际持仓详情 (symbol, size, entry_price)
   - 常规同步日志降级为 debug,保留关键操作为 info
   - 同步失败日志升级为 ERROR 并附带 traceback
2026-01-28 14:15:04 +08:00
PengfaGuo bafc00245a Merge branch 'brokermr810:main' into main 2026-01-28 08:24:02 +08:00
XSX-Milan 9faf48e53f 修复:Google搜索使用模糊匹配以避免无结果 2026-01-28 00:46:45 +08:00
PengfaGuo d2889af044 Merge branch 'brokermr810:main' into main 2026-01-27 20:20:19 +08:00
XSX-Milan bc1c991645 feat: 添加 Binance 模拟交易支持
在 BinanceFuturesClient 和 BinanceSpotClient 中添加 enable_demo_trading 参数

根据 enable_demo_trading 自动设置正确的 demo base_url

Futures: https://demo-fapi.binance.com

Spot: https://demo-api.binance.com

在 factory.py 中从 exchange_config 读取 enable_demo_trading 配置并传递给客户端
2026-01-27 19:28:34 +08:00
PengfaGuo db6ef2eecf Merge branch 'brokermr810:main' into main 2026-01-27 08:34:04 +08:00
TIANHE 53cadb5ab5 add deepcoin
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
2026-01-26 20:32:34 +08:00
PengfaGuo 092bc4fbe6 Merge branch 'brokermr810:main' into main 2026-01-25 11:32:44 +08:00
TIANHE 5df11e2491 new
Signed-off-by: TIANHE <TIANHE@GMAIL.COM>
2026-01-25 01:14:54 +08:00