|
|
|
@ -67,8 +67,8 @@ def get_futures_list(db: Session = Depends(get_db)):
|
|
|
|
"periods": _get_period_trends(all_candles),
|
|
|
|
"periods": _get_period_trends(all_candles),
|
|
|
|
"successRate": _calc_success_rate(all_candles),
|
|
|
|
"successRate": _calc_success_rate(all_candles),
|
|
|
|
"trendScore": _calc_trend_score(all_candles),
|
|
|
|
"trendScore": _calc_trend_score(all_candles),
|
|
|
|
"resistance": round(high_price * 1.02, 2),
|
|
|
|
"resistance": round(2 * ((high_price + low_price + close_price) / 3) - low_price, 2),
|
|
|
|
"support": round(low_price * 0.98, 2),
|
|
|
|
"support": round(2 * ((high_price + low_price + close_price) / 3) - high_price, 2),
|
|
|
|
"open": open_price,
|
|
|
|
"open": open_price,
|
|
|
|
"high": high_price,
|
|
|
|
"high": high_price,
|
|
|
|
"low": low_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 = close_price - open_price
|
|
|
|
change_pct = (change / open_price * 100) if open_price > 0 else 0
|
|
|
|
change_pct = (change / open_price * 100) if open_price > 0 else 0
|
|
|
|
|
|
|
|
|
|
|
|
resistance1 = round(high_price * 1.01, 2)
|
|
|
|
# Pivot Point 公式计算关键点位
|
|
|
|
resistance2 = round(high_price * 1.03, 2)
|
|
|
|
pp = (high_price + low_price + close_price) / 3
|
|
|
|
resistance3 = round(high_price * 1.05, 2)
|
|
|
|
r1 = round(2 * pp - low_price, 2)
|
|
|
|
support1 = round(low_price * 0.99, 2)
|
|
|
|
r2 = round(pp + (high_price - low_price), 2)
|
|
|
|
support2 = round(low_price * 0.97, 2)
|
|
|
|
s1 = round(2 * pp - high_price, 2)
|
|
|
|
support3 = round(low_price * 0.95, 2)
|
|
|
|
s2 = round(pp - (high_price - low_price), 2)
|
|
|
|
|
|
|
|
|
|
|
|
suggestion = _get_suggestion(close_price, open_price, change_pct)
|
|
|
|
suggestion = _get_suggestion(close_price, open_price, change_pct)
|
|
|
|
suggestion_type = "up" if change >= 0 else "down"
|
|
|
|
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,
|
|
|
|
"low": low_price,
|
|
|
|
"volume": sum(float(c.get("volume", 0)) for c in all_candles),
|
|
|
|
"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),
|
|
|
|
"entryPrice": round(close_price * 0.995, 2) if change >= 0 else round(close_price * 1.005, 2),
|
|
|
|
"targetPrice": resistance1 if change >= 0 else support1,
|
|
|
|
"targetPrice": r1 if change >= 0 else s1,
|
|
|
|
"stopLoss": support1 if change >= 0 else resistance1,
|
|
|
|
"stopLoss": s1 if change >= 0 else r1,
|
|
|
|
"riskLevel": "低" if trend_score >= 80 else "中" if trend_score >= 60 else "高",
|
|
|
|
"riskLevel": "低" if trend_score >= 80 else "中" if trend_score >= 60 else "高",
|
|
|
|
"macd": _calc_macd(all_candles),
|
|
|
|
"macd": _calc_macd(all_candles),
|
|
|
|
"rsi": _calc_rsi(all_candles),
|
|
|
|
"rsi": _calc_rsi(all_candles),
|
|
|
|
"boll": _calc_boll(all_candles),
|
|
|
|
"boll": _calc_boll(all_candles),
|
|
|
|
"kdj": _calc_kdj(all_candles),
|
|
|
|
"kdj": _calc_kdj(all_candles),
|
|
|
|
"resistances": [resistance1, resistance2, resistance3],
|
|
|
|
"resistances": [r1, r2],
|
|
|
|
"supports": [support1, support2, support3],
|
|
|
|
"supports": [s1, s2],
|
|
|
|
|
|
|
|
"pivotPoint": round(pp, 2),
|
|
|
|
"periodConsistency": _get_period_trends(all_candles)
|
|
|
|
"periodConsistency": _get_period_trends(all_candles)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|