haha
This commit is contained in:
@@ -76,7 +76,6 @@ class BitmartOneThirdStrategy:
|
||||
self.check_interval = 3
|
||||
self.last_trigger_kline_id = None
|
||||
self.last_trigger_direction = None
|
||||
self.last_trade_kline_id = None
|
||||
self.min_shadow_pct = 0.01 # 反手信号:上/下影线幅度需 > 0.01%
|
||||
|
||||
# ========================= 三分之一策略核心 =========================
|
||||
@@ -457,7 +456,7 @@ class BitmartOneThirdStrategy:
|
||||
# 有持仓时优先检测反手信号
|
||||
if self.start != 0:
|
||||
rev_dir, rev_prev = self.check_reverse_signal(kline_data)
|
||||
if rev_dir and self.last_trade_kline_id != curr_kline_id:
|
||||
if rev_dir:
|
||||
balance = self.get_available_balance()
|
||||
trade_size = (balance or 0) * self.risk_percent
|
||||
if rev_prev is not None:
|
||||
@@ -482,7 +481,6 @@ class BitmartOneThirdStrategy:
|
||||
self.平仓()
|
||||
time.sleep(1)
|
||||
self.开单(marketPriceLongOrder=-1, size=trade_size)
|
||||
self.last_trade_kline_id = curr_kline_id
|
||||
self.last_trigger_kline_id = curr_kline_id
|
||||
self.last_trigger_direction = rev_dir
|
||||
self.get_position_status()
|
||||
@@ -493,11 +491,6 @@ class BitmartOneThirdStrategy:
|
||||
|
||||
if direction:
|
||||
curr_kline_id = curr_kline['id']
|
||||
if self.last_trade_kline_id == curr_kline_id:
|
||||
self.last_trigger_kline_id = curr_kline_id
|
||||
self.last_trigger_direction = direction
|
||||
time.sleep(self.check_interval)
|
||||
continue
|
||||
|
||||
# 信号与持仓同向则不操作
|
||||
if (direction == "long" and self.start == 1) or (direction == "short" and self.start == -1):
|
||||
@@ -546,7 +539,6 @@ class BitmartOneThirdStrategy:
|
||||
self.last_trigger_kline_id = curr_kline_id
|
||||
self.last_trigger_direction = direction
|
||||
if executed:
|
||||
self.last_trade_kline_id = curr_kline_id
|
||||
self.get_position_status()
|
||||
logger.info(f"{'='*50}")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user