|
@@ -261,9 +261,6 @@ class TradingStrategy:
|
|
|
# 如果不是目标交易对,直接返回
|
|
# 如果不是目标交易对,直接返回
|
|
|
if symbol != self.target_symbol:
|
|
if symbol != self.target_symbol:
|
|
|
return
|
|
return
|
|
|
-
|
|
|
|
|
- # 记录价格数据到数据库
|
|
|
|
|
- await self._record_price_data(market_data)
|
|
|
|
|
|
|
|
|
|
# 基于账户信息更新 current_position 和状态
|
|
# 基于账户信息更新 current_position 和状态
|
|
|
await self._update_position_and_state(market_data)
|
|
await self._update_position_and_state(market_data)
|
|
@@ -273,6 +270,9 @@ class TradingStrategy:
|
|
|
await self._handle_idle_monitoring(market_data)
|
|
await self._handle_idle_monitoring(market_data)
|
|
|
elif self.state == StrategyState.CLOSING_WITH_LIMIT_ORDER:
|
|
elif self.state == StrategyState.CLOSING_WITH_LIMIT_ORDER:
|
|
|
await self._handle_closing_with_limit_order(market_data)
|
|
await self._handle_closing_with_limit_order(market_data)
|
|
|
|
|
+
|
|
|
|
|
+ # 记录价格数据到数据库
|
|
|
|
|
+ await self._record_price_data(market_data)
|
|
|
|
|
|
|
|
# 更新账户信息,但至少间隔1秒
|
|
# 更新账户信息,但至少间隔1秒
|
|
|
current_time = time.time()
|
|
current_time = time.time()
|
|
@@ -405,7 +405,6 @@ class TradingStrategy:
|
|
|
|
|
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
logger.error(f"记录价格数据失败: {e}")
|
|
logger.error(f"记录价格数据失败: {e}")
|
|
|
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async def _handle_idle_monitoring(self, market_data):
|
|
async def _handle_idle_monitoring(self, market_data):
|