Wallet Manager ships with an interactive REPL that evaluates raw JavaScript against a live Binance spot account — no server to start, no REST client to configure. The steps below take you from a fresh clone to your first balance check and price fetch in under five minutes.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/backtest-kit/wallet-manager/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
Before you begin, make sure you have the following:
- Node.js 18 or later — the REPL relies on
readlineand native ESM. - A Binance account with a Spot API key and secret. To create one, go to API Management in your Binance account settings and generate a new key.
When creating the API key, enable Spot & Margin Trading permission. Read-only keys can run the
fetch* commands but will fail on any commit* call. IP restriction is strongly recommended for production keys.Clone and install
Clone the repository and install dependencies:The project uses Rollup to bundle
src/index.ts into build/index.mjs. The npm start script runs the build automatically before launching the REPL, so no separate build step is needed.Configure credentials
Create a
.env file in the project root with your Binance API credentials:npm start loads this file via dotenv before the REPL process starts. The variable names CC_BINANCE_API_KEY and CC_BINANCE_API_SECRET are read directly by WalletPrivateService when it initializes the node-binance-api client.Start the REPL
Launch the REPL with:This runs The prompt accepts raw JavaScript expressions.
npm run build (Rollup) first, then starts the interactive prompt:await is supported at the top level — no async wrapper needed. Objects are pretty-printed as JSON; primitives are printed as-is. Type exit to quit.First commands
Try these read-only commands to confirm your credentials work and inspect your account:
| Command | What it returns |
|---|---|
fetchPrice("SOLUSDT") | Current market price as a number |
fetchFiat("SOLUSDT") | Total account USDT balance (free + locked) |
fetchBalance("SOLUSDT") | { quantity, usdt } — coin holdings (including amounts locked in open orders) and their USDT value |
fetchOrders("SOLUSDT", N) | Last N orders (FILLED / CANCELED / NEW) with side, price, quantities, and timestamps |
If the REPL prints a credentials error on the first
await, double-check
that the .env file is in the project root (the same directory as
package.json) and that both variable names are spelled correctly.Two globals available
The REPL injects two globals into every expression you type:This is handy for capturing large order histories or PnL arrays for offline analysis.
wallet — the service container, identical to the exported wallet object from src/index.ts. It has two properties:wallet.walletPublicService— the recommended interface. Validates arguments, serializes calls per symbol via an execution queue, and emits a structured audit log record after everycommit*call. Use this for all order placement and inspection.wallet.walletPrivateService— the raw layer underneath. No validation, no queueing. Useful for inspecting TTL cache state or callingclear()to flush cached order and PnL data. Not recommended for order placement.
fs — Node’s built-in fs module, injected so you can dump results to disk without importing anything:Next Steps
REPL Guide
Explore all read and mutating commands —
commitBuy, commitSell,
commitTrade, commitCancel — with full examples and expected outputs.Order Management
Understand the cancel-verify-sell pattern, poll-with-timeout loop, and
market fallback so you can build a correct broker adapter from scratch.