hahahaha
This commit is contained in:
@@ -31,6 +31,7 @@ class BitmartFuturesTransaction:
|
||||
# 反手频率控制
|
||||
self.reverse_cooldown_seconds = 1.5 * 60 # 反手冷却时间(秒)
|
||||
self.last_reverse_time = None # 上次反手时间
|
||||
self.last_reverse_kline_id = None # 已反手过的 K 线 id,该 K 线内不再操作仓位
|
||||
|
||||
# 开仓频率控制
|
||||
self.open_cooldown_seconds = 60 # 开仓冷却时间(秒),两次开仓至少间隔此时长
|
||||
@@ -609,10 +610,17 @@ class BitmartFuturesTransaction:
|
||||
else:
|
||||
self._current_kline_id_for_open = current_kline_time # 供 execute_trade 成功后记录
|
||||
|
||||
# 5.6 当前 K 线已反手过则本 K 线内不再操作仓位
|
||||
if signal and self.last_reverse_kline_id == current_kline_time:
|
||||
logger.info(f"本 K 线({current_kline_time})已反手过,本 K 线内不再操作仓位")
|
||||
signal = None
|
||||
|
||||
# 6. 有信号则执行交易
|
||||
if signal:
|
||||
trade_success = self.execute_trade(signal)
|
||||
if trade_success:
|
||||
if signal[0] in ('reverse_long', 'reverse_short'):
|
||||
self.last_reverse_kline_id = current_kline_time # 本 K 线已反手,本 K 线内不再操作
|
||||
logger.success(f"交易执行完成: {signal[0]}, 当前持仓状态: {self.start}")
|
||||
page_start = True
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user