This commit is contained in:
zhangkun9038@dingtalk.com 2025-11-27 15:48:55 +08:00
parent 97f1a7ce2e
commit 658db450ec

View File

@ -264,7 +264,13 @@ class StaticGrid(IStrategy):
grid_manager = self.grid_managers[pair]
# 同步 Trade 对象的信息到 GridManager用于加仓决策
grid_manager.sync_from_trade_object(trade, self.dp.current_candle().get('candle_index', 0))
# 使用 trade.open_date_utc 的时间戳作为 candle_index
try:
candle_index = int(trade.open_date_utc.timestamp() / 3600) if trade.open_date_utc else 0
except:
candle_index = 0
grid_manager.sync_from_trade_object(trade, candle_index)
# 询问网格管理器是否应该加仓
adjustment = grid_manager.decide_adjustment()