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