fix: FR score 0~5 only, no negative scores

Direction is already decided. FR layer measures how favorable
the funding rate is for that direction. Unfavorable = 0, not negative.
This commit is contained in:
root 2026-03-02 02:30:56 +00:00
parent 318bcb99a3
commit 7dee6bffbd

View File

@ -522,13 +522,14 @@ class SymbolState:
fr_abs = abs(funding_rate)
# 线性映射: raw = (|当前FR| / 历史最大FR) × 5, clamp到5
raw_score = min(fr_abs / max_fr * 5.0, 5.0)
# 方向判断: 逆向操作加分,顺向操作减分
# 做多+FR负(空头付钱)=逆向=好 → 正分
# 做多+FR正(多头付钱)=顺向=坏 → 负分
# FR评估"资金费率对当前方向有多有利"0~5分不扣分
# 做多+FR负(空头付费给多头)=有利 → 给分
# 做空+FR正(多头付费给空头)=有利 → 给分
# 其他情况(FR方向不利) → 0分
if (direction == "LONG" and funding_rate < 0) or (direction == "SHORT" and funding_rate > 0):
fr_score = round(raw_score, 2) # 逆向操作,加
fr_score = round(raw_score, 2) # 有利,给
else:
fr_score = round(-raw_score, 2) # 顺向操作,减
fr_score = 0.0 # 不利,不给分也不扣
# 4) 确认层15分
confirmation_score = 15 if (