Skip to main content

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.

Wallet Manager has a deliberately minimal configuration surface. The only runtime inputs it needs are your Binance API credentials, supplied as two environment variables in a .env file at the project root. When you run npm start, dotenv loads that file before the REPL process starts, making the variables available to src/config/params.ts which exports them for use throughout the service layer. There are no configuration files, no YAML, and no flags — credentials in .env is the entire configuration model.

Environment variables

CC_BINANCE_API_KEY
string
required
Your Binance API key. Used to authenticate every request sent to the Binance REST API via node-binance-api. If this value is empty at startup, the first call to getBinance() throws "Binance API KEY is empty" and clears the singleshot lock so the next call retries.
CC_BINANCE_API_SECRET
string
required
Your Binance API secret. Used to sign every authenticated request. If this value is empty, getBinance() throws "Binance API SECRET is empty" under the same retry semantics as the missing key.

.env file setup

Create a file named .env in the wallet-manager project root and populate it with your credentials:
.env
CC_BINANCE_API_KEY=your_api_key_here
CC_BINANCE_API_SECRET=your_api_secret_here
Never commit .env to version control. Add .env to your .gitignore immediately — your API secret grants full trading access to your account and must not appear in any repository, even a private one.

Obtaining API credentials

1

Log in to Binance

Go to binance.com and sign in to your account.
2

Open API Management

Navigate to Account → API Management from the user menu in the top-right corner.
3

Create a new API key

Click Create API and choose a label. Complete any 2FA challenge Binance requires.
4

Set permissions

Enable only the permissions Wallet Manager needs (see the table below). Leave everything else disabled, especially withdrawals.
5

Restrict to your IP

Under IP access restrictions, add your server or workstation IP. A key locked to a specific IP cannot be used even if it leaks.
6

Copy key and secret

Copy both values immediately — the secret is shown only once. Store them securely (e.g. a password manager) before closing the page.

Required API key permissions

PermissionRequired
✅ Enable ReadingYes — needed for balance, price, and order queries
✅ Enable Spot & Margin TradingYes — needed for all commit* operations
❌ Enable WithdrawalsNo — do not enable
Wallet Manager only places and cancels spot orders and reads account data. Withdrawal permission is not needed and should be left disabled to limit the blast radius of a compromised key.

How credentials are used in the code

src/config/params.ts reads both variables from process.env and falls back to an empty string so the module always exports a string (never undefined):
// src/config/params.ts
export const CC_BINANCE_API_KEY = process.env.CC_BINANCE_API_KEY || "";
export const CC_BINANCE_API_SECRET = process.env.CC_BINANCE_API_SECRET || "";
These exports are consumed by getBinance() in WalletPrivateService. If either is an empty string at the time of the first API call, the factory throws immediately with a descriptive error and clears its singleshot lock — so fixing the .env file and making another call is enough to recover, without restarting the process.

recvWindow

The Binance client is initialised with recvWindow: 60000 (60 seconds). This is the window Binance uses for timestamp validation: a request whose timestamp differs from the server clock by more than recvWindow milliseconds is rejected. The generous 60-second window prevents spurious authentication failures on hosts whose system clock is slightly out of sync.
useServerTime: true is also set in the client options, which instructs node-binance-api to call useServerTime() on init and align the local request timestamps with Binance’s server clock. This happens automatically inside getBinance() before the instance is returned to any caller.

Build configuration

Wallet Manager uses Rollup to compile src/index.ts to build/index.mjs. The npm start script runs the build step first, then launches the REPL with credentials injected via dotenv:
npm run build  # Rollup + TypeScript → build/index.mjs
npm start      # build + dotenv + REPL
The npm start script expands to:
npm run build && dotenv -e .env -- node ./scripts/repl.mjs
This means every npm start produces a fresh build from source before opening the REPL — edits to src/ are always reflected on the next start without a separate build step.

Build docs developers (and LLMs) love