Is there a Binance SDK for TypeScript and Node.js?
Yes. The binance package on npm is the leading community maintained open-source Binance SDK for TypeScript and Node.js. It ships its own type definitions, is MIT licensed, and covers Spot, USD-M futures and COIN-M futures over REST and WebSockets. Install it with npm install binance.
What it covers
- REST:
MainClientfor Spot and account features,USDMClientfor USD-M futures andCoinMClientfor COIN-M futures. See Clients. - WebSockets:
WebsocketClientfor market and account streams, andWebsocketAPIClientfor request and response calls. See WebSocket streams. - Keys: HMAC, RSA and Ed25519 keys, detected from the secret you pass. See API key setup.
- Environments: production, Spot Testnet and demo trading. See Testnet and demo trading.
- Runtimes: Node.js, Bun, Deno, Cloudflare Workers, and browser and mobile apps. See the framework and runtime guides.
Signing, reconnects and rate-limit headers are handled by the SDK. Method names follow the Binance endpoints, so Binance's own API documentation maps directly to your code.
Make a first request
This TypeScript example reads the BTCUSDT price. It needs no API key:
ts
import { MainClient } from 'binance';
async function main() {
const client = new MainClient();
const result = await client.getSymbolPriceTicker({ symbol: 'BTCUSDT' });
if (Array.isArray(result)) throw new Error('Expected a single-symbol ticker.');
console.log('BTCUSDT last price:', result.price);
}
main().catch((error) => {
console.error(error instanceof Error ? error.message : 'Request failed. See the troubleshooting guide.');
process.exitCode = 1;
});Follow the Node.js quickstart for the full project setup, or the TypeScript guide for compiler settings.