Skip to main content

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.

This guide walks you from a fresh checkout to a live REPL session where you can inspect prices, balances, and orders against your Binance spot account.
Live keys, real money. Once you supply real API credentials and call any commit* method, Wallet Manager places actual orders on Binance spot. There is no dry-run mode. Complete the read-only commands in Step 5 before attempting any mutating calls.

Prerequisites

  • Node.js 18 or later (ESM + top-level await support required)
  • A Binance spot account with funds you are comfortable testing with
  • A Binance API key and secret with Spot Trading permission enabled
    • Withdraw permission is not needed and should be left disabled

1

Clone and install

git clone https://github.com/tripolskypetr/wallet-manager.git
cd wallet-manager
npm install
The package is private ("private": true in package.json) and not published to npm, so it must be cloned directly. All runtime dependencies — node-binance-api, di-kit, functools-kit, and friends — are installed by npm install.
2

Configure your API keys

Create a .env file in the project root. Wallet Manager reads exactly two variables (from src/config/params.ts):
CC_BINANCE_API_KEY=your_api_key_here
CC_BINANCE_API_SECRET=your_api_secret_here
The .env file is loaded automatically by dotenv when you run npm start — you never need to source it or set the variables in your shell environment.
3

Build and start the REPL

npm start
The start script runs two things in sequence (from package.json):
package.json
{
  "scripts": {
    "start": "npm run build && dotenv -e .env -- node ./scripts/repl.mjs",
    "build": "rollup -c"
  }
}
  1. npm run build — Rollup compiles src/index.ts to build/index.mjs (ESM bundle).
  2. dotenv -e .env -- node ./scripts/repl.mjs — loads .env into the process environment, then starts the REPL.
When the build succeeds you will see the repl => prompt:
repl =>
The REPL evaluates raw JavaScript. await is supported at the top level. Objects are pretty-printed as JSON. Type exit to quit.

First commands in the REPL

All read-only commands go through wallet.walletPublicService. Start here — nothing below modifies your account.

Fetch current price

repl => await wallet.walletPublicService.fetchPrice("SOLUSDT")
77.56
Returns the current price as a number. Results are cached for 30 seconds per symbol.

Fetch USDT balance

repl => await wallet.walletPublicService.fetchFiat("SOLUSDT")
142.30
Returns your total USDT balance (free + locked in open orders) as a number.

Fetch coin balance

repl => await wallet.walletPublicService.fetchBalance("SOLUSDT")
{
  "quantity": 1.85,
  "usdt": 143.49
}
Returns a { quantity, usdt } object for the coin associated with the symbol. quantity includes any amounts currently locked in open orders (onOrder).

Fetch recent orders

repl => await wallet.walletPublicService.fetchOrders("SOLUSDT", 25)
Returns up to 25 recent orders (FILLED, CANCELED, or NEW) with side, price, quantities, and timestamps.

Fetch daily PnL

repl => await wallet.walletPublicService.fetchPnl("SOLUSDT", 25)
Returns a daily PnL estimate reconstructed from trade history and 1-hour candles.

Dump results to a file

The fs global (Node’s built-in fs module) is injected by scripts/repl.mjs so you can save any result without leaving the REPL:
repl => const result = await wallet.walletPublicService.fetchOrders("SOLUSDT", 50)
repl => fs.writeFileSync("orders.json", JSON.stringify(result, null, 2))

REPL globals

Two globals are available in every REPL session:
GlobalDescription
walletThe service container — holds walletPublicService and walletPrivateService.
fsNode’s built-in fs module — useful for writing results to disk.
wallet is also assigned to globalThis by src/index.ts, so it is accessible from any imported module loaded into the same process.

Using Wallet Manager as a library

After building (npm run build), import from build/index.mjs in your own scripts:
import { wallet } from "./build/index.mjs";

// wallet.walletPublicService — queued, validated, audited
const price = await wallet.walletPublicService.fetchPrice("SOLUSDT");
const balance = await wallet.walletPublicService.fetchBalance("SOLUSDT");
// balance: { quantity: number; usdt: number }

// wallet.walletPrivateService — raw layer, no queueing or validation
// Use only for debugging or custom flows.
Always prefer wallet.walletPublicService over wallet.walletPrivateService in application code. The public service serializes calls per symbol (no concurrent orders on the same symbol), validates arguments, and writes an audit record to the console after every commit: { symbol, action, amountUSDT, averagePrice, date, status }.

Next steps

  • REPL Guide — Full reference for every mutating command: commitBuy, commitSell, commitTrade, and commitCancel.
  • Broker Adapter — See how the commit flows map to a production backtest-kit broker adapter, including idempotent reconcile by clientOrderId and terminal rejection on the fifth attempt.
  • API Reference — Complete TypeScript signatures for both services and all data types.

Build docs developers (and LLMs) love