mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 09:18:08 +00:00
feat: enhance close position handling in AsterRestClient to support STOP_MARKET and TAKE_PROFIT_MARKET types
This commit is contained in:
@@ -795,8 +795,11 @@ export class AsterRestClient {
|
|||||||
// Keep the behavior exchange-specific by stripping them here for Aster.
|
// Keep the behavior exchange-specific by stripping them here for Aster.
|
||||||
const type = String(params.type).toUpperCase();
|
const type = String(params.type).toUpperCase();
|
||||||
const isStopOrTrailing = type === "STOP_MARKET" || type === "TRAILING_STOP_MARKET";
|
const isStopOrTrailing = type === "STOP_MARKET" || type === "TRAILING_STOP_MARKET";
|
||||||
|
const supportsClosePosition = type === "STOP_MARKET" || type === "TAKE_PROFIT_MARKET";
|
||||||
if (!isStopOrTrailing) {
|
if (!isStopOrTrailing) {
|
||||||
if (params.reduceOnly !== undefined) payload.reduceOnly = params.reduceOnly;
|
if (params.reduceOnly !== undefined) payload.reduceOnly = params.reduceOnly;
|
||||||
|
}
|
||||||
|
if (supportsClosePosition) {
|
||||||
if (params.closePosition !== undefined) payload.closePosition = params.closePosition;
|
if (params.closePosition !== undefined) payload.closePosition = params.closePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user