Wallet Manager is an internal Binance spot wallet toolkit: a small DI-wired service layer overDocumentation 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.
node-binance-api paired with an interactive REPL. It encodes the correct order-management sequence — cancel pending orders, verify the book is clean, then sell — and exposes that logic both as a live trading tool and as the reference implementation for the exchange side of a backtest-kit broker adapter.
The problem it solves
The most common broker-adapter implementation mistake is trying to sell an asset while its funds are still frozen in a pending order. On Binance spot, every resting order locks its quantity — the base coin for aSELL, USDT for a BUY. A sell placed on top of that lock either fails with an insufficient-balance error, or silently trades only the unlocked remainder while TP/SL/stale entry orders keep holding the rest.
The correct sequence is always:
- Cancel all pending orders on the symbol.
- Verify the book is clean — zero open orders remain.
- Sell the entire free coin balance to USDT with a new order.
commitCancel (and the onOrderCloseCommit example in the broker-adapter section) implements. Every mutating commit in WalletPublicService is built around this discipline.
Two jobs
Wallet Manager serves two distinct purposes: 1. Manual exchange control via REPL Drive the exchange by hand — buy, sell, or flatten a symbol; inspect balances, open orders, and daily PnL — without touching any trading engine. The REPL evaluates raw JavaScript (await is allowed), pretty-prints object results as JSON, and gives you full access to the service layer through the wallet global.
2. Reference implementation for backtest-kit broker adapters
The commit_* functions under src/function/ are the exact order-management flows — limit-post → poll-for-fill → cancel-on-timeout → market-order fallback — that a production broker adapter is built from. Reading the Wallet Manager source and the annotated adapter example in the Broker Adapter guide gives you a ready-to-adapt blueprint that already handles the three hard problems: transient-throw cleanup, idempotent reconcile by clientOrderId, and terminal rejection on the fifth attempt.
Order-management sequence
The three-step sequence above also sweeps any orphan tranches — coin
bought outside the engine (e.g. a manual REPL purchase) — because it sells
the entire free balance rather than just the engine’s tracked position size.
Architecture overview
The service layer has two tiers:| Service | Role |
|---|---|
WalletPublicService | Use this one. Per-symbol serialized execution queue, argument validation, and a structured console.log audit record after every commit: { symbol, action, amountUSDT, averagePrice, date, status }. |
WalletPrivateService | Raw layer with no queueing or validation. Useful for debugging or building custom flows, but all production paths should go through WalletPublicService. |
di-kit. The wallet export from src/index.ts is both the default export and is assigned to globalThis so the REPL can use it without an import statement.
Utility helpers (queue serialization, memoization, sleep, singleshot guards) come from functools-kit.
Key dependencies
| Package | Purpose |
|---|---|
node-binance-api | Binance REST + WebSocket client |
di-kit | Dependency-injection container |
functools-kit | TTL memoize, serialized queues, singleshot guards, sleep |
pinolog | Structured console logging |
get-moment-stamp | Human-readable timestamps for audit records |
Where to go next
Quickstart
Configure your API keys, build the ESM bundle, and run your first REPL
commands in under 5 minutes.
REPL Guide
Full reference for every read-only and mutating command available in the
interactive REPL.
Broker Adapter
Annotated backtest-kit adapter example built on the Wallet Manager
commit flows.
API Reference
TypeScript type signatures for WalletPublicService, WalletPrivateService,
IOrderData, and IDailyPnL.