刚运行时10分钟内不允许交易
This commit is contained in:
parent
5f7b8295b0
commit
6f5dca5b83
@ -1336,6 +1336,15 @@ class FreqaiPrimer(IStrategy):
|
||||
logger.info(f"[{pair}] confirm_trade_entry called with rate={rate}, type(rate)={type(rate)}, "
|
||||
f"amount={amount}, order_type={order_type}, time_in_force={time_in_force}")
|
||||
|
||||
# 🔒 策略启动保护:运行未满10分钟禁止交易
|
||||
if not hasattr(self, 'strategy_start_time'):
|
||||
self.strategy_start_time = current_time
|
||||
|
||||
strategy_run_time = (current_time - self.strategy_start_time).total_seconds() / 60
|
||||
if strategy_run_time < 10: # 10分钟启动保护
|
||||
logger.info(f"[{pair}] 策略启动保护中,运行{strategy_run_time:.1f}分钟 < 10分钟,禁止交易")
|
||||
return False
|
||||
|
||||
# 检查 rate 是否有效
|
||||
if not isinstance(rate, (float, int)) or rate is None:
|
||||
logger.error(f"[{pair}] Invalid rate value: {rate} (type: {type(rate)}). Skipping trade entry.")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user