mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-09 08:18:07 +00:00
feat: 移除不必要的数量参数,优化止损和市价平仓订单逻辑以确保精确处理
This commit is contained in:
@@ -247,7 +247,7 @@ export async function placeStopLossOrder(
|
||||
}
|
||||
}
|
||||
const priceTick = opts?.priceTick ?? 0.1;
|
||||
const qtyStep = opts?.qtyStep ?? 0.001;
|
||||
|
||||
const params: CreateOrderParams = {
|
||||
symbol,
|
||||
side,
|
||||
@@ -255,7 +255,6 @@ export async function placeStopLossOrder(
|
||||
stopPrice: roundDownToTick(stopPrice, priceTick),
|
||||
closePosition: "true",
|
||||
timeInForce: "GTC",
|
||||
quantity,
|
||||
triggerType: "STOP_LOSS",
|
||||
};
|
||||
|
||||
@@ -343,16 +342,14 @@ export async function marketClose(
|
||||
const type = "MARKET";
|
||||
if (isOperating(locks, type)) return;
|
||||
if (!enforceMarkPriceGuard(side, guard?.expectedPrice ?? null, guard, log, "市价平仓")) return;
|
||||
const qtyStep = opts?.qtyStep ?? 0.001;
|
||||
const roundedQty = roundQtyDownToStep(quantity, qtyStep);
|
||||
const safeQty = roundedQty > 0 ? roundedQty : quantity;
|
||||
|
||||
const params: CreateOrderParams = {
|
||||
symbol,
|
||||
side,
|
||||
type,
|
||||
quantity: safeQty,
|
||||
closePosition: "true",
|
||||
};
|
||||
|
||||
await deduplicateOrders(adapter, symbol, openOrders, locks, timers, pendings, type, side, log);
|
||||
lockOperating(locks, timers, pendings, type, log);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user