mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 09:18:08 +00:00
feat: 更新止损订单逻辑,针对Aster期货调整reduceOnly参数处理以符合交易所要求
This commit is contained in:
@@ -241,18 +241,22 @@ export async function placeStopLossOrder(
|
|||||||
}
|
}
|
||||||
const priceTick = opts?.priceTick ?? 0.1;
|
const priceTick = opts?.priceTick ?? 0.1;
|
||||||
const qtyStep = opts?.qtyStep ?? 0.001;
|
const qtyStep = opts?.qtyStep ?? 0.001;
|
||||||
|
const isAster = String((adapter as any).id ?? "").toLowerCase() === "aster";
|
||||||
const params: CreateOrderParams = {
|
const params: CreateOrderParams = {
|
||||||
symbol,
|
symbol,
|
||||||
side,
|
side,
|
||||||
type,
|
type,
|
||||||
stopPrice: roundDownToTick(stopPrice, priceTick),
|
stopPrice: roundDownToTick(stopPrice, priceTick),
|
||||||
reduceOnly: "true",
|
|
||||||
closePosition: "true",
|
closePosition: "true",
|
||||||
timeInForce: "GTC",
|
timeInForce: "GTC",
|
||||||
// Do not round down stop quantity here to avoid underflow to exchange min; gateway will quantize precisely
|
// Do not round down stop quantity here to avoid underflow to exchange min; gateway will quantize precisely
|
||||||
quantity,
|
quantity,
|
||||||
triggerType: "STOP_LOSS",
|
triggerType: "STOP_LOSS",
|
||||||
};
|
};
|
||||||
|
// For Aster futures, STOP orders must not include reduceOnly; omit it specifically.
|
||||||
|
if (!isAster) {
|
||||||
|
params.reduceOnly = "true";
|
||||||
|
}
|
||||||
// Avoid forcing price for STOP_MARKET globally; keep this exchange-specific in gateways
|
// Avoid forcing price for STOP_MARKET globally; keep this exchange-specific in gateways
|
||||||
await deduplicateOrders(adapter, symbol, openOrders, locks, timers, pendings, type, side, log);
|
await deduplicateOrders(adapter, symbol, openOrders, locks, timers, pendings, type, side, log);
|
||||||
lockOperating(locks, timers, pendings, type, log);
|
lockOperating(locks, timers, pendings, type, log);
|
||||||
|
|||||||
Reference in New Issue
Block a user