Files
DinQuant/docs/INDICATOR_DEFINITIONS_CN.md
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

19 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 技术指标计算口径(与代码一致)
本文档与 `backend_api_python/app/services/market_data_collector.py``_calculate_indicators` 及子函数实现**严格对应**。
| 指标 | 实现要点 |
|------|-----------|
| **RSI(14)** | **Wilder RSI**:前 14 期涨跌分别取简单算术平均作为初始均幅;自第 15 期起 `avg = (avg_prev×13 + 当期) / 14`。RS = 均涨幅/均跌幅,RSI = 100 100/(1+RS)。 |
| **MACD(12,26,9)** | 收盘 **EMA12、EMA26**(首值=各自前 N 根 **SMA**,再按 α=2/(N+1) 递推)。**DIF** 从第 26 根 K 起有定义;对 DIF 子序列再算 **EMA9****DEA**;柱 = DIF − DEA。至少需要 **34** 根收盘才能稳定给出信号线(子序列长度≥9)。 |
| **MA5/10/20** | 最近 N 根收盘价的 **SMA**。 |
| **枢轴 Pivot** | **上一根 K** 的高、低、收:P=(H+L+C)/3R1/S1/R2/S2 标准式。 |
| **摆动高/低** | 最近 **20 根 K**`max(high)``min(low)`。 |
| **布林(20,2)** | 中轨 = 最近 20 收盘 **SMA**;方差 = Σ(x−μ)²/**20**(总体方差);σ=√方差;上下轨 = 中轨 ± 2σ;带宽% = (上轨−下轨)/中轨×100。合成支撑/阻力使用 **`BB_upper` / `BB_lower`** 字段。 |
| **ATR(14)** | **Wilder ATR**:TR 定义同经典;首 ATR = 前 14 个 TR 的简单平均;之后 `ATR_t = (ATR_{t-1}×13 + TR_t) / 14`,递推至**最后一根 K**(全序列,非仅尾窗)。 |
| **量比** | 当前根成交量 / 近 **20** 根成交量算术平均。 |
| **区间位置 %** | (当前收盘 − 近20低) / (近20高 − 近20低) × 100;高=低 时为 50。 |
| **合成支撑/阻力** | `(R1 + swing_high + BB_upper) / 3``(S1 + swing_low + BB_lower) / 3`,见 `levels.method`。 |
前端说明文案键:`fastAnalysis.indicatorsProSubtitle`(应与上表同步维护)。