This commit is contained in:
discountry
2026-01-16 22:59:38 +08:00
parent 12e8e3e064
commit 2ba3e80ad9
+5 -2
View File
@@ -169,6 +169,9 @@ export async function placeOrder(
lockOperating(locks, timers, pendings, type, log); lockOperating(locks, timers, pendings, type, log);
try { try {
const closePosition = reduceOnly ? true : undefined; const closePosition = reduceOnly ? true : undefined;
// StandX API: reduce-only 订单不能设置 tp/sl
const slPrice = reduceOnly ? undefined : opts?.slPrice;
const tpPrice = reduceOnly ? undefined : opts?.tpPrice;
const order = await routeLimitOrder({ const order = await routeLimitOrder({
adapter, adapter,
symbol, symbol,
@@ -178,8 +181,8 @@ export async function placeOrder(
timeInForce: reduceOnly ? "GTC" : "GTX", timeInForce: reduceOnly ? "GTC" : "GTX",
reduceOnly: reduceOnly ? true : undefined, reduceOnly: reduceOnly ? true : undefined,
closePosition, closePosition,
slPrice: opts?.slPrice, slPrice,
tpPrice: opts?.tpPrice, tpPrice,
}); });
pendings[type] = String(order.orderId); pendings[type] = String(order.orderId);
log("order", `挂限价单: ${side} @ ${priceNum} 数量 ${quantity} reduceOnly=${reduceOnly}${opts?.slPrice ? ` sl=${opts.slPrice}` : ""}`); log("order", `挂限价单: ${side} @ ${priceNum} 数量 ${quantity} reduceOnly=${reduceOnly}${opts?.slPrice ? ` sl=${opts.slPrice}` : ""}`);