Executes partial close at profit level by absolute dollar amount (moving toward TP).
Convenience wrapper around commitPartialProfit that converts a dollar amount
to a percentage of the invested position cost automatically.
Price must be moving toward take profit (in profit 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. 150 closes $150 worth)
Returns Promise<boolean>
Promise - true if partial close executed, false if skipped or no position
// Close $150 of a $300 position (50%) at profit constsuccess = awaitcommitPartialProfitCost("BTCUSDT", 150); if (success) { console.log('Partial profit executed'); }
Executes partial close at profit level by absolute dollar amount (moving toward TP).
Convenience wrapper around commitPartialProfit that converts a dollar amount to a percentage of the invested position cost automatically. Price must be moving toward take profit (in profit direction).
Automatically detects backtest/live mode from execution context. Automatically fetches current price via getAveragePrice.