|
@@ -41,9 +41,9 @@ class TradingStrategy:
|
|
|
def __init__(self):
|
|
def __init__(self):
|
|
|
"""初始化策略"""
|
|
"""初始化策略"""
|
|
|
self.state = StrategyState.WAITING_INIT
|
|
self.state = StrategyState.WAITING_INIT
|
|
|
- self.current_position = None # 当前持仓信息
|
|
|
|
|
- self.entry_price_diff = None # 入场时的价差
|
|
|
|
|
- self.target_symbol = "DOGE" # 目标交易对
|
|
|
|
|
|
|
+ self.current_position = None # 当前持仓信息
|
|
|
|
|
+ self.entry_price_bps = 5 # 入场时的价差
|
|
|
|
|
+ self.target_symbol = "DOGE" # 目标交易对
|
|
|
|
|
|
|
|
logger.info("策略初始化完成,当前状态: WAITING_INIT")
|
|
logger.info("策略初始化完成,当前状态: WAITING_INIT")
|
|
|
|
|
|
|
@@ -88,9 +88,9 @@ class TradingStrategy:
|
|
|
def _print_market_data(self, market_data):
|
|
def _print_market_data(self, market_data):
|
|
|
"""打印市场数据"""
|
|
"""打印市场数据"""
|
|
|
symbol = market_data.get('symbol')
|
|
symbol = market_data.get('symbol')
|
|
|
- binance_mark = market_data.get('binance_mark_price')
|
|
|
|
|
|
|
+ # binance_mark = market_data.get('binance_mark_price')
|
|
|
binance_price = market_data.get('binance_price')
|
|
binance_price = market_data.get('binance_price')
|
|
|
- lighter_mark = market_data.get('lighter_mark_price')
|
|
|
|
|
|
|
+ # lighter_mark = market_data.get('lighter_mark_price')
|
|
|
lighter_price = market_data.get('lighter_price')
|
|
lighter_price = market_data.get('lighter_price')
|
|
|
|
|
|
|
|
# 计算价差,转换为bps单位
|
|
# 计算价差,转换为bps单位
|
|
@@ -100,7 +100,7 @@ class TradingStrategy:
|
|
|
lighter_price_float = float(lighter_price) if isinstance(lighter_price, str) else lighter_price
|
|
lighter_price_float = float(lighter_price) if isinstance(lighter_price, str) else lighter_price
|
|
|
|
|
|
|
|
# 计算价差并转换为bps (1bps = 0.01%)
|
|
# 计算价差并转换为bps (1bps = 0.01%)
|
|
|
- price_diff_bps = int((binance_price_float - lighter_price_float) / binance_price_float * 10000) if binance_price_float else 0
|
|
|
|
|
|
|
+ price_diff_bps = int((lighter_price_float - binance_price_float) / binance_price_float * 10000) if binance_price_float else 0
|
|
|
else:
|
|
else:
|
|
|
price_diff_bps = None
|
|
price_diff_bps = None
|
|
|
|
|
|