Fix 历史最高收益率(百分比), 盈亏金额 USDT, 最高收益率 没有传递给 AI 作决策,无法在 prompt 中使用 (#651)

This commit is contained in:
Lawrence Liu
2025-11-09 16:20:52 +08:00
committed by GitHub
parent 576dd26b8b
commit fd3fc654cb
2 changed files with 9 additions and 2 deletions

View File

@@ -647,6 +647,11 @@ func (at *AutoTrader) buildTradingContext() (*decision.Context, error) {
}
updateTime := at.positionFirstSeenTime[posKey]
// 获取该持仓的历史最高收益率
at.peakPnLCacheMutex.RLock()
peakPnlPct := at.peakPnLCache[symbol]
at.peakPnLCacheMutex.RUnlock()
positionInfos = append(positionInfos, decision.PositionInfo{
Symbol: symbol,
Side: side,
@@ -656,6 +661,7 @@ func (at *AutoTrader) buildTradingContext() (*decision.Context, error) {
Leverage: leverage,
UnrealizedPnL: unrealizedPnl,
UnrealizedPnLPct: pnlPct,
PeakPnLPct: peakPnlPct,
LiquidationPrice: liquidationPrice,
MarginUsed: marginUsed,
UpdateTime: updateTime,