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.
commitTrade combines a guarded entry with an automatic bracket in one atomic sequence. It runs the full commitBuy flow (limit order, poll loop, market-fallback), measures the quantity delta in the coin balance to determine exactly how many coins were acquired net of fees, and then immediately places an OCO (One-Cancels-the-Other) sell order with a take-profit leg above the fill price and a stop-loss leg below. The call returns only after the OCO is confirmed live on the exchange.
Signature
Parameters
Binance trading pair symbol, e.g.
"SOLUSDT".Amount in USDT to spend on the entry buy. Subject to the same guards as
commitBuy — open orders or insufficient balance cause an early return of 0.The target price at which to take profit. Must be a valid finite number
> 0 and strictly greater than the current average price at call time. The OCO above leg is placed at takeProfitPrice × 1.001 (limit price) with takeProfitPrice as the stop trigger price.The price at which to cut the loss. Must be a valid finite number
> 0 and strictly less than the current average price at call time. The OCO below leg is placed at stopLossPrice × 0.999 (limit price) with stopLossPrice as the stop trigger price.Return value
Promise<0 | { status: string; content: string }>
0— guards prevented the buy (open orders exist on symbol, or free USDT <amountUSDT).{ status: "ok", content: string }— the full trade was entered and the OCO is live.contentis a human-readable report string.
Validation
WalletPublicService.commitTrade performs strict pre-flight validation before enqueuing the operation:
takeProfitPrice > currentPrice > stopLossPrice > 0.
Execution flow
Pre-flight guards
Calls
binance.openOrders(symbol) — returns 0 if any open order exists. Reads free USDT balance — returns 0 if balance < amountUSDT.Snapshot balance before buy
Calls
FETCH_BALANCE_FN to record the coin balance before entry. This baseline is used to compute the actual quantity acquired.Enter via commitBuy flow
Runs
COMMIT_BUY_FN with the validated amountUSDT and averagePrice. This places a limit BUY at averagePrice × 1.001, polls up to 100s, and market-buys any unfilled remainder on timeout.Measure quantity delta
Snapshots the balance again after the buy. Net quantity =
balanceAfter.quantity - balanceBefore.quantity. Subtracts the maker fee percentage and minQty dust:Place OCO sell order
Places the OCO via All prices are formatted to the symbol’s
binance.ocoOrder("SELL", symbol, qty, params) with the following parameters:PRICE_FILTER tickSize.Success report
On a successful trade,content contains a multi-line summary:
Audit log
After completion,WalletPublicService emits: