mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 17:28:08 +00:00
feat: 更新止损订单逻辑,添加数量步进和触发类型处理以符合交易所要求
This commit is contained in:
@@ -247,15 +247,21 @@ export async function placeStopLossOrder(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const priceTick = opts?.priceTick ?? 0.1;
|
const priceTick = opts?.priceTick ?? 0.1;
|
||||||
|
const qtyStep = opts?.qtyStep ?? 0.001;
|
||||||
|
|
||||||
const params: CreateOrderParams = {
|
const params: CreateOrderParams = {
|
||||||
symbol,
|
symbol,
|
||||||
side,
|
side,
|
||||||
type,
|
type,
|
||||||
|
quantity: roundQtyDownToStep(quantity, qtyStep),
|
||||||
stopPrice: roundDownToTick(stopPrice, priceTick),
|
stopPrice: roundDownToTick(stopPrice, priceTick),
|
||||||
|
// Always mark reduce-only semantics; some exchanges (e.g. Aster) ignore this on STOP
|
||||||
|
reduceOnly: "true",
|
||||||
|
// Some exchanges prefer explicit close-position semantics; gateways will normalize
|
||||||
closePosition: "true",
|
closePosition: "true",
|
||||||
timeInForce: "GTC",
|
timeInForce: "GTC",
|
||||||
triggerType: "STOP_LOSS",
|
// GRVT requires triggerType to match side semantics: BUY -> TAKE_PROFIT, SELL -> STOP_LOSS
|
||||||
|
triggerType: side === "BUY" ? "TAKE_PROFIT" : "STOP_LOSS",
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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
|
||||||
|
|||||||
Reference in New Issue
Block a user