feat(place_order): a 0.5% price impact in LIMIT orders to guarantee filling

This commit is contained in:
2025-07-17 22:29:30 +08:00
parent cbecb3703f
commit f86cce3af0

View File

@@ -27,6 +27,7 @@ import logging
import os
import time
import json
from pathlib import Path
from datetime import datetime, date
from typing import Dict, Any, Optional, Tuple, List
@@ -306,8 +307,12 @@ class MexcSpotTrade:
if current_price is None:
logger.error("无法获取实时价格,交易取消")
return None
processed_kwargs["price"] = current_price
logger.info("使用实时价格作为限价: %f", current_price)
# 防止挂单不成交
if side == "BUY":
processed_kwargs["price"] = current_price * 1.01 # 买入加价0.5%
elif side == "SELL":
processed_kwargs["price"] = current_price * 0.91 # 卖出减价0.5%
logger.info("使用调整0.5%%后价格作为限价: %f", processed_kwargs["price"])
# 处理LIMIT订单只有quoteOrderQty没有quantity的情况
if (