Explorar o código

fix: 修正做多和做空交易的价格类型错误

做多时应使用bid价格而非ask价格,做空时应使用ask价格而非bid价格,修正交易策略中的价格类型逻辑
skyfffire hai 1 semana
pai
achega
d51e54e454
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      src/record/strategy.py

+ 2 - 2
src/record/strategy.py

@@ -194,12 +194,12 @@ class TradingStrategy:
         if self.position_side == 'long':
             # 做多:在Lighter买入(使用ask价格)
             price = binance_price
-            is_ask = True
+            is_ask = False
             side_desc = '做多'
         else:  # short
             # 做空:在Lighter卖出(使用bid价格)
             price = binance_price
-            is_ask = False
+            is_ask = True
             side_desc = '做空'
         
         logger.info(f"开始开仓:方向={side_desc},数量={self.trade_quantity},价格={price}")