diff --git a/app/api/__pycache__/futures_analysis.cpython-311.pyc b/app/api/__pycache__/futures_analysis.cpython-311.pyc index 8c155c0..0050bd3 100644 Binary files a/app/api/__pycache__/futures_analysis.cpython-311.pyc and b/app/api/__pycache__/futures_analysis.cpython-311.pyc differ diff --git a/app/api/futures_analysis.py b/app/api/futures_analysis.py index 6e9653a..1de767e 100644 --- a/app/api/futures_analysis.py +++ b/app/api/futures_analysis.py @@ -67,8 +67,8 @@ def get_futures_list(db: Session = Depends(get_db)): "periods": _get_period_trends(all_candles), "successRate": _calc_success_rate(all_candles), "trendScore": _calc_trend_score(all_candles), - "resistance": round(high_price * 1.02, 2), - "support": round(low_price * 0.98, 2), + "resistance": round(2 * ((high_price + low_price + close_price) / 3) - low_price, 2), + "support": round(2 * ((high_price + low_price + close_price) / 3) - high_price, 2), "open": open_price, "high": high_price, "low": low_price, @@ -120,12 +120,12 @@ def get_futures_detail(symbol: str, db: Session = Depends(get_db)): change = close_price - open_price change_pct = (change / open_price * 100) if open_price > 0 else 0 - resistance1 = round(high_price * 1.01, 2) - resistance2 = round(high_price * 1.03, 2) - resistance3 = round(high_price * 1.05, 2) - support1 = round(low_price * 0.99, 2) - support2 = round(low_price * 0.97, 2) - support3 = round(low_price * 0.95, 2) + # Pivot Point 公式计算关键点位 + pp = (high_price + low_price + close_price) / 3 + r1 = round(2 * pp - low_price, 2) + r2 = round(pp + (high_price - low_price), 2) + s1 = round(2 * pp - high_price, 2) + s2 = round(pp - (high_price - low_price), 2) suggestion = _get_suggestion(close_price, open_price, change_pct) suggestion_type = "up" if change >= 0 else "down" @@ -145,15 +145,16 @@ def get_futures_detail(symbol: str, db: Session = Depends(get_db)): "low": low_price, "volume": sum(float(c.get("volume", 0)) for c in all_candles), "entryPrice": round(close_price * 0.995, 2) if change >= 0 else round(close_price * 1.005, 2), - "targetPrice": resistance1 if change >= 0 else support1, - "stopLoss": support1 if change >= 0 else resistance1, + "targetPrice": r1 if change >= 0 else s1, + "stopLoss": s1 if change >= 0 else r1, "riskLevel": "低" if trend_score >= 80 else "中" if trend_score >= 60 else "高", "macd": _calc_macd(all_candles), "rsi": _calc_rsi(all_candles), "boll": _calc_boll(all_candles), "kdj": _calc_kdj(all_candles), - "resistances": [resistance1, resistance2, resistance3], - "supports": [support1, support2, support3], + "resistances": [r1, r2], + "supports": [s1, s2], + "pivotPoint": round(pp, 2), "periodConsistency": _get_period_trends(all_candles) } diff --git a/app/static/futures_analysis.css b/app/static/futures_analysis.css index ebe543c..b07bfe5 100644 --- a/app/static/futures_analysis.css +++ b/app/static/futures_analysis.css @@ -1117,6 +1117,24 @@ body { font-variant-numeric: tabular-nums; } +.level-item.pivot-point { + background: rgba(139, 92, 246, 0.1); + border: 1px solid rgba(139, 92, 246, 0.2); + border-radius: 8px; + padding: 8px 12px; + margin: 4px 0; +} + +.level-item.pivot-point span:first-child { + color: var(--purple); + font-weight: 600; +} + +.level-item.pivot-point span:last-child { + color: var(--purple); + font-size: 14px; +} + .level-divider { height: 1px; background: var(--border-color); @@ -1517,6 +1535,11 @@ body.theme-minimal .level-item { border-radius: 9999px; } +body.theme-minimal .level-item.pivot-point { + background: rgba(124, 58, 237, 0.08); + border-color: rgba(124, 58, 237, 0.2); +} + body.theme-minimal .trend-row { background: var(--bg-card); border-radius: 9999px; diff --git a/app/static/futures_analysis.html b/app/static/futures_analysis.html index d0d1628..4a33e53 100644 --- a/app/static/futures_analysis.html +++ b/app/static/futures_analysis.html @@ -321,14 +321,17 @@ 压力