All five commands are accessed throughDocumentation 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.
wallet.walletPublicService, which wraps each call in a per-symbol serialized execution queue, validates arguments, clears internal caches after completion, and prints a structured audit log entry to console.log when a trading call resolves.
commitBuy
Places a guarded limit BUY foramountUSDT worth of the base coin. Returns 0 immediately — without touching the exchange — when the symbol already has open orders or when free USDT is below amountUSDT.
The Binance trading pair, e.g.
"SOLUSDT".The USDT amount to spend. Must be a positive finite number; the service throws on
NaN or negative values.Promise<number> — the average fill price, or 0 if the buy was skipped.
Order flow:
- Fetches the current average price.
- Checks for open orders on the symbol and checks free USDT balance — returns
0if either guard fails. - Places a limit BUY at
avgPrice × 1.001(slightly above market to improve fill speed). - Polls the order status every 10 seconds, up to 10 times (~100 seconds total).
- If the order is still not fully filled after the poll loop: cancels the limit order and market-buys the unfilled remainder — the entry is guaranteed to complete; no resting order is left on the book.
- Returns the average fill price.
commitSell
Places a limit SELL foramountUSDT worth of the base coin with the same poll-loop and market-sell fallback as commitBuy.
The Binance trading pair, e.g.
"SOLUSDT".The USDT-equivalent value of coin to sell. Must be a positive finite number.
Promise<number> — the average fill price.
Order flow:
- Fetches the current average price.
- Places a limit SELL at
avgPrice × 0.999(slightly below market to improve fill speed). - Polls every 10 seconds, up to 10 times.
- On timeout: cancels the limit order and market-sells the remainder — the exit is guaranteed.
- Returns the average fill price.
commitTrade
Entry + brackets in one call. Validates the price triangle, buys via thecommitBuy flow, then immediately protects the position with an OCO sell (TAKE_PROFIT_LIMIT + STOP_LOSS_LIMIT).
The Binance trading pair.
The USDT amount to spend on the entry buy.
The price at which the take-profit limit order will trigger. Must be strictly greater than the current average price.
The price at which the stop-loss limit order will trigger. Must be strictly less than the current average price and greater than zero.
Promise<0 | { status: string; content: string }> — 0 if the entry buy returned 0 (guard fired); otherwise a status report object from the OCO placement.
Validation (all checked before touching the exchange):
| Condition | Error thrown |
|---|---|
stopLossPrice > takeProfitPrice | "stop-loss price is greater than take-profit price" |
takeProfitPrice <= avgPrice | "take-profit price must be greater than average price" |
stopLossPrice >= avgPrice | "stop-loss price must be less than average price" |
stopLossPrice <= 0 | "stop-loss price must be greater than zero" |
takeProfitPrice <= 0 | "take-profit price must be greater than zero" |
Either price arg is NaN or non-number | Validation error |
commitBuy("SOLUSDT", 20)— fills at market-adjacent price.- Place OCO SELL at
takeProfitPrice(TAKE_PROFIT_LIMIT) andstopLossPrice(STOP_LOSS_LIMIT) for the quantity acquired.
commitCancel
Flatten the symbol — cancel everything and exit to cash. This is the emergency or planned exit command. It cancels all open orders on the symbol first, verifies the order book is clean, then sells the entire free coin balance to USDT.The Binance trading pair to flatten.
Promise<number> — the average fill price of the closing sell, or 0 if the free coin balance was below minQty (dust, nothing to sell).
REPL example:
Sweep open orders (up to 10 rounds)
Fetches all open orders for the symbol. Iterates through them, canceling one by one with a 1-second pause between each cancel. Individual cancel failures are tolerated — the sweep loop continues. Repeats up to 10 rounds until no open orders remain or all individual cancels succeed in a single pass.
Verify book is clean
Calls
openOrders(symbol) up to 10 times (1-second intervals). If any open orders still remain after all retries, throws a transient error — the operation does not proceed to the sell step.Check free coin balance
Reads the account balance for the base coin. If the free quantity (minus maker commission and
minQty buffer) is at or below minQty, returns 0 — dust is left untouched.Place limit SELL for entire free balance
Places a limit SELL at
avgPrice × 0.999 for the full free coin quantity (minus commission buffer). The limit price is slightly below market to maximise fill probability.Poll for fill (up to 10 × 10s)
Checks the order status every 10 seconds, up to 10 times. Returns the fill price as soon as the order is confirmed
FILLED.The “cancel everything first, then sell” sequence is not optional. On Binance spot, every resting order locks its quantity (base coin for a SELL, USDT for a BUY). Selling into a lock silently reduces the fill or fails with insufficient balance.
commitCancel always clears and verifies the order book before posting the closing sell.commitReload
Clears all internal caches for a symbol. This is a lightweight maintenance command — it does not touch the exchange and places no orders. It callswalletPrivateService.clear(), which resets the TTL caches for fetchOrders and fetchPnl so the next read for any symbol fetches fresh data from Binance.
Use commitReload when you want to force a fresh read without executing any trade. Under normal use this is unnecessary — all commit* trading commands automatically call clear() in their finally block — but it is useful if you modify external state outside the REPL or if you want to discard a stale cached PnL snapshot without running a trade.
The Binance trading pair context for the reload. The symbol is used to route the call through the per-symbol serialized queue; the underlying cache clear applies globally to all symbols.
Promise<void> — resolves with no value when the cache flush is complete.
REPL example:
commitReload does not produce an audit log entry. Unlike the other commit* commands, it does not call console.log with a { symbol, action, ... } record because no order or exchange interaction occurs.