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.
WalletPublicService is the recommended entry point for all exchange operations. It wraps the lower-level WalletPrivateService with three key guarantees: per-symbol serialized execution via a queued runner (so concurrent calls on the same symbol are never interleaved), up-front argument validation that throws descriptive errors before anything reaches the exchange, and a structured console.log audit record emitted in a finally block after every commit — whether the operation succeeds or fails.
Accessing the singleton
Thewallet export exposes both service layers as a single container object. Always use walletPublicService unless you are debugging the raw exchange adapter directly.
npm start) injects wallet as a global, so you can call any method directly:
Per-symbol execution queue
Internally,WalletPublicService maintains one EventListener instance per symbol, keyed by a memoized runner (getRunner). Each EventListener wraps its execute method with queued from functools-kit, which serializes all calls on that runner. This means two concurrent commitBuy("SOLUSDT", …) calls will run strictly one after the other — the second waits for the first to fully resolve, including its full poll loop and any market-fallback order.
Symbols are independent: a commitBuy("SOLUSDT", …) and a commitBuy("BTCUSDT", …) running at the same time do not block each other.
Audit log format
After everycommit* call (commitBuy, commitSell, commitTrade, commitCancel), the service emits a structured record via console.log inside the finally block, regardless of whether the operation succeeded or threw:
walletPrivateService.clear() is also called to invalidate the order and PnL caches, ensuring the next fetchOrders or fetchPnl call reflects the latest state.
Methods
commitBuy
Guarded limit BUY at avg×1.001 with poll loop and market fallback. Returns 0 if guards fail.
commitSell
Limit SELL at avg×0.999 with poll loop and market fallback. Returns average fill price.
commitTrade
Buy via commitBuy flow then immediately place an OCO take-profit and stop-loss.
commitCancel
Cancel all open orders, verify clean book, sell entire free coin balance to USDT.
fetchPrice
Current Binance average price for a symbol, formatted to tick size. 30s cache.
fetchBalance
Coin quantity and USDT equivalent, including amounts locked in open orders.
fetchFiat
Total USDT balance (free + locked) from the Binance account.
fetchOrders
Recent FILLED, CANCELED, and NEW orders. 10-minute TTL cache.
fetchPnl
Daily PnL reconstructed from trade history using partial fill matching and VWAP.
commitReload
Clears the WalletPrivateService cache for a symbol, forcing fresh data on the next fetch call.
Full method signatures
Usage example
commitReload
commitReload clears the WalletPrivateService internal cache for a symbol. It calls walletPrivateService.clear(), which invalidates the fetchOrders and fetchPnl TTL caches. After a reload, the next call to fetchOrders or fetchPnl for any symbol will fetch fresh data from the exchange.
Signature
Parameters
Binance trading pair symbol, e.g.
"SOLUSDT". Used for queue routing — the cache clear applies globally across all symbols, not just the one passed.Return value
Promise<void> — resolves when the cache has been cleared. Does not interact with the exchange.
Usage example
commitReload is called automatically by all commit* operations (commitBuy, commitSell, commitTrade, commitCancel) in their finally block, so you rarely need to call it manually. Use it when you want to force a cache refresh without placing an order — for example, after an external trade or manual intervention on the exchange.