Executes partial close at loss level by absolute dollar amount (moving toward SL).
Convenience wrapper around commitPartialLoss that converts a dollar amount
to a percentage of the invested position cost automatically.
Price must be moving toward stop loss (in loss direction).
Automatically detects backtest/live mode from execution context.
Automatically fetches current price via getAveragePrice.
Parameters
symbol: string
Trading pair symbol
dollarAmount: number
Dollar value of position to close (e.g. 100 closes $100 worth)
Returns Promise<boolean>
Promise - true if partial close executed, false if skipped or no position
// Close $100 of a $300 position (~33%) at loss constsuccess = awaitcommitPartialLossCost("BTCUSDT", 100); if (success) { console.log('Partial loss executed'); }
Executes partial close at loss level by absolute dollar amount (moving toward SL).
Convenience wrapper around commitPartialLoss that converts a dollar amount to a percentage of the invested position cost automatically. Price must be moving toward stop loss (in loss direction).
Automatically detects backtest/live mode from execution context. Automatically fetches current price via getAveragePrice.