Documentation Index
Fetch the complete documentation index at: https://mintlify.com/tripolskypetr/wallet-manager/llms.txt
Use this file to discover all available pages before exploring further.
commitSell sells a specified USDT-denominated amount of a coin back to USDT. Unlike commitBuy, it has no open-order guard — you can call it while other orders are live on the symbol. It places a limit SELL order priced slightly below the current average to improve fill speed, then polls for up to 100 seconds. On timeout it cancels the resting limit and market-sells the unfilled remainder, so the sell is always completed.
Signature
Parameters
Binance trading pair symbol, e.g.
"SOLUSDT". Must be a valid spot symbol listed on Binance.The USDT-denominated amount to sell. The coin quantity is computed as
amountUSDT / averagePrice via usdToCoins(). Validated in WalletPublicService — must be a finite number and ≥ 0. Throws if the value is NaN, not a number, or negative.Return value
Promise<number> — average fill price from the order’s fills array (arithmetic mean over fill prices). Returns the fallback orderPrice if the fills array is empty.
Order logic
- Limit price —
averagePrice × 0.999(0.1% below the 5-minute weighted average), formatted to the symbol’sPRICE_FILTERtickSize. Pricing slightly below market makes the order more likely to fill quickly as a maker order. - Quantity —
usdToCoins(amountUSDT, averagePrice)converted to a string viaformatQuantity()using theLOT_SIZEstepSize. - A
LIMIT SELLorder is placed viabinance.order("LIMIT", "SELL", symbol, quantity, averagePrice).
Poll loop
If the order is not instantlyFILLED, commitSell enters the same poll loop as commitBuy:
- 10 iterations × 10-second sleep = up to 100 seconds total wait.
- Each iteration calls
binance.orderStatus(symbol, orderId)and exits immediately onstatus === "FILLED".
Timeout fallback
If all 10 iterations complete without a fill:- The limit order is cancelled via
binance.cancel(symbol, orderId). - The unfilled remainder (
quantity - lastStatus.executedQty) is market-sold viabinance.marketSell(symbol, remainderQty). - Average fill price from the market order is returned.
Validation in WalletPublicService
Audit log
After completion,WalletPublicService emits: