feat: enhance close position handling in AsterRestClient to support STOP_MARKET and TAKE_PROFIT_MARKET types

This commit is contained in:
discountry
2025-10-28 12:50:31 +08:00
parent 5bba8169b5
commit 265cb6df50
+3
View File
@@ -795,8 +795,11 @@ export class AsterRestClient {
// Keep the behavior exchange-specific by stripping them here for Aster.
const type = String(params.type).toUpperCase();
const isStopOrTrailing = type === "STOP_MARKET" || type === "TRAILING_STOP_MARKET";
const supportsClosePosition = type === "STOP_MARKET" || type === "TAKE_PROFIT_MARKET";
if (!isStopOrTrailing) {
if (params.reduceOnly !== undefined) payload.reduceOnly = params.reduceOnly;
}
if (supportsClosePosition) {
if (params.closePosition !== undefined) payload.closePosition = params.closePosition;
}