Merge pull request #386 from zhouyongyou/feat/configurable-oi-threshold

feat(decision): configurable OI threshold + relaxed trading template
This commit is contained in:
Icyoung
2025-11-05 15:46:25 +08:00
committed by GitHub
2 changed files with 201 additions and 4 deletions

View File

@@ -169,17 +169,20 @@ func fetchMarketDataForContext(ctx *Context) error {
continue
}
// ⚠️ 流动性过滤:持仓价值低于15M USD的币种不做(多空都不做)
// ⚠️ 流动性过滤:持仓价值低于阈值的币种不做(多空都不做)
// 持仓价值 = 持仓量 × 当前价格
// 但现有持仓必须保留(需要决策是否平仓)
// 💡 OI 門檻配置:用戶可根據風險偏好調整
const minOIThresholdMillions = 15.0 // 可調整15M(保守) / 10M(平衡) / 8M(寬鬆) / 5M(激進)
isExistingPosition := positionSymbols[symbol]
if !isExistingPosition && data.OpenInterest != nil && data.CurrentPrice > 0 {
// 计算持仓价值USD= 持仓量 × 当前价格
oiValue := data.OpenInterest.Latest * data.CurrentPrice
oiValueInMillions := oiValue / 1_000_000 // 转换为百万美元单位
if oiValueInMillions < 15 {
log.Printf("⚠️ %s 持仓价值过低(%.2fM USD < 15M),跳过此币种 [持仓量:%.0f × 价格:%.4f]",
symbol, oiValueInMillions, data.OpenInterest.Latest, data.CurrentPrice)
if oiValueInMillions < minOIThresholdMillions {
log.Printf("⚠️ %s 持仓价值过低(%.2fM USD < %.1fM),跳过此币种 [持仓量:%.0f × 价格:%.4f]",
symbol, oiValueInMillions, minOIThresholdMillions, data.OpenInterest.Latest, data.CurrentPrice)
continue
}
}