SkillAgentSearch skills...

Node Binance Api

Node Binance API is an asynchronous node.js library for the Binance API designed to be easy to use.

Install / Use

npx skills add ccxt/node-binance-api

Installs into whichever agent you are using.

About this skill

Quality Score

0/100

Category

Design

Supported Platforms

Universal

README

<!-- [![Binance Community API](https://cdn.discordapp.com/attachments/569865969120575519/718166995354255370/binance-api-black.png)](https://dev.binance.vision/) --> <!-- ![Last Commit](https://badgen.net/github/last-commit/jaggedsoft/node-binance-api?scale=2&label=🟣%20Updated&labelColor=black&color=448AFF&cache=9999) --> <!-- [![npm downloads](https://img.shields.io/npm/dt/node-binance-api.svg?maxAge=7200)](https://www.npmjs.com/package/node-binance-api) [![Build Status](https://travis-ci.org/jaggedsoft/node-binance-api.svg?branch=master&style=flat-square)](https://travis-ci.org/jaggedsoft/node-binance-api) [![Coverage Status](https://coveralls.io/repos/github/jaggedsoft/node-binance-api/badge.svg?branch=master&style=flat-square)](https://coveralls.io/github/jaggedsoft/node-binance-api) [![CodeCov](https://codecov.io/gh/jaggedsoft/node-binance-api/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/github/jaggedsoft/node-binance-api/) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/996757cec66542c0a64fca2b4cf8a936)](https://www.codacy.com/app/jaggedsoft/node-binance-api?utm_source=github.com&utm_medium=referral&utm_content=jaggedsoft/node-binance-api&utm_campaign=Badge_Coverage) [![Codacy Grade](https://api.codacy.com/project/badge/Grade/996757cec66542c0a64fca2b4cf8a936)](https://www.codacy.com/app/jaggedsoft/node-binance-api) https://img.shields.io/npm/dm/node-binance-api.svg?labelColor=blueviolet) https://badgen.net/npm/dm/node-binance-api?labelColor=7C4DFF&color=green&scale=2&label=Downloads&icon=bitcoin 🟣 Used by 727 https://badgen.net/github/dependents-repo/jaggedsoft/node-binance-api?labelColor=blue&color=purple&label=Used%20by&icon=github 🧪 Releases 87 https://badgen.net/github/releases/jaggedsoft/node-binance-api?scale=2&icon=github&labelColor=purple&color=green&label=%F0%9F%A7%AA%20Release 🎈💡 Merged PRs 79 https://badgen.net/github/merged-prs/jaggedsoft/node-binance-api ⭐ Stars 630 https://badgen.net/github/stars/jaggedsoft/node-binance-api?scale=2&label=%E2%AD%90Stars&labelColor=black&color=purple ✅ship Commits 568 https://badgen.net/github/commits/micromatch/micromatch?label=%E2%9C%A8Commits&labelColor=black&color=red ⚡ Updated about 16 hours ago https://badgen.net/github/last-commit/jaggedsoft/node-binance-api?scale=2&icon=bitcoin-lightning&label=Updated&labelColor=black&color=448AFF 👀👁 Watchers 48 https://badgen.net/github/watchers/jaggedsoft/node-binance-api color=blueviolet 🔵q --> <!-- [![Latest Version](https://img.shields.io/github/release/jaggedsoft/node-binance-api.svg?style=flat-square&labelColor=blueviolet&label=release)](https://github.com/jaggedsoft/node-binance-api/releases) [![GitHub last commit](https://img.shields.io/github/last-commit/jaggedsoft/node-binance-api.svg?maxAge=2400&labelColor=333&label=🟣%20updated)](#) [![Monthly Downloads](https://img.shields.io/npm/dm/node-binance-api.svg?labelColor=29B6F6&color=3D5AFE&label=downloads&logo=bitcoin-lightning)](https://npm-stat.com/charts.html?package=node-binance-api&from=2017-07-01&to=2020-07-01) -->

Node Binance API

telegram Yearly Downloads CCXT on X

This project is designed to help you make your own projects that interact with the Binance API. You can stream candlestick chart data, market depth, or use other advanced features such as setting stop losses and iceberg orders. This project seeks to have complete API coverage including WebSockets.

<b><p align="center"> <a href="#binance-futures-api" style="color:#f9c513">Futures API</a> & <a href="#futures-websocket-streams" style="color:#f9c513">Streams</a><a href="#binance-api-spot-trading" style="color:#282828">Spot Trading API</a> & <a href="#websockets-implementation" style="color:#282828">Streams</a><a href="#binance-margin-api">Margin API</a><a href="#binance-lending-api">Lending API</a><br/> <a href="https://github.com/jaggedsoft/node-binance-api/tree/master/examples">Examples</a><a href="#troubleshooting">Troubleshooting</a><a href="https://github.com/jaggedsoft/node-binance-api/releases">Changelog</a><a href="https://t.me/binance_api_english">Support</a>

</p></b>

Installation

npm install node-binance-api

NPM

<!-- [![npm install node-binance-api](https://nodei.co/npm/node-binance-api.png?mini=true)](https://npmjs.org/package/node-binance-api) -->

Community Telegram Chat

https://t.me/nodebinanceapi

This project is powered by <a href="https://github.com/ccxt/ccxt"><img src="https://avatars.githubusercontent.com/u/31901609" width=4% height=4%></a>

Actively maintained, typed, and safe SDK for the Binance REST APIs and Websockets. Supports ESM and CJS out of the box.

Features

  • Spot, Margin, Futures and Delivery API (including the new algoOrder service)
  • Demo trading support
  • Testnet support (deprecated)
  • Proxy support (REST and WS, including the new WS-API)
  • Customizable HTTP headers
  • Customizable request parameters
  • RSA/ECDSA support
  • Portfolio Margin API *soon*
  • Websocket handling with automatic reconnection
  • RecvWindow and automatic timestamps generation
  • Ability to call any endpoint, even if not supported directly by the library
  • Overridable hostnames (.us, .jp, etc)
  • Verbose mode to debug http requests/responses

Upgrading to v1.0.0+

We highly advise you to update from 0.0.X but minor adjustments might be needed.

The library was fully refactored to use a modern and typed JavaScript/Typescript version, using the built-in await/async syntax and unifying some methods' signatures. Some important changes include the removal of callbacks as parameters of REST methods, adaptation of signatures to directly receive some important request values (symbol, orderId, ...), among others.

Getting started (ESM)

import Binance from 'node-binance-api';
async function run() {
    const exchange = new Binance();
    const res = await exchange.futuresTime();
    console.log( res );
}

Getting started (CJS)

const Binance = require('node-binance-api');
const binance = new Binance({
  APIKEY: '<key>',
  APISECRET: '<secret>',
  test: true, // if you want to use the sandbox/testnet
});

Binance Futures API

Futures Prices

console.info( await binance.futuresPrices() );

Futures Account Balances & Positions

console.info( await binance.futuresAccount() );

Futures Balances

console.info( await binance.futuresBalance() );

Futures Limit Buy

console.info( await binance.futuresBuy( 'LIMIT', 'BTCUSDT', 0.1, 8222 ) );

Futures Limit Sell

console.info( await binance.futuresSell( 'LIMIT', 'BTCUSDT', 0.5, 11111 ) );

Futures Market Buy

console.info( await binance.futuresMarketBuy( 'BNBUSDT', 5 ) );

Futures Market Sell

console.info( await binance.futuresMarketSell( 'TRXUSDT', 1 ) );

Futures Place Multiple Orders

let orders = [
  {
  symbol:"BTCUSDT",
  side: "BUY",
  type: "MARKET",
  quantity: "0.01",
  },
  {
  symbol:"BNBUSDT",
  side: "SELL",
  type: "MARKET",
  quantity: "0.5",
  }
]
console.info( await binance.futuresMultipleOrders(orders) );

Futures Market Orders: Get the fill price using newOrderRespType

console.info( await binance.futuresMarketBuy( 'BNBUSDT', amount, { newOrderRespType: 'RESULT' } ) );

Futures reduceOnly Order Example

if ( side == 'LONG' ) order = await binance.futuresMarketSell( obj.symbol, amount, {reduceOnly: true} )
else order = await binance.futuresMarketBuy( obj.symbol, amount, {reduceOnly: true} )

Get Futures Positions

console.info( await binance.futuresPositionRisk() );
<details> <summary>View Example</summary>
let position_data = await binance.futuresPositionRisk(), markets = Object.keys( position_data );
for ( let market of markets ) {
  let obj = position_data[market], size = Number( obj.positionAmt );
  if ( size == 0 ) continue;
  console.info( `${leverage}x\t${market}\t${obj.unRealizedProfit}` );
  //console.info( obj ); //positionAmt entryPrice markPrice unRealizedProfit liquidationPrice leverage marginType isolatedMargin isAutoAddMargin maxNotionalValue
}
</details>

Adjust Leverage (1-125x)

console.info( await binance.futuresLeverage( 'ETHUSDT', 50 ) );

Adjust Margin Type (ISOLATED, CROSSED)

console.info( await binance.futuresMarginType( 'BTCUSDT', 'ISOLATED' ) );

Adjust Position Margin

// Type: 1: Add postion margin,2: Reduce postion margin
console.info( await binance.futuresPositionMargin( "TRXUSDT", amount, type ) );
console.info( await binance.futuresTime() );
console.info( await binance.futuresExchangeInfo() );
console.info( await binance.futuresCandles( "TRXUSDT", "1m" ) );
console.info( await binance.futuresDepth( "ADAUSDT" ) );
console.info( await binance.futuresQuote() );
console.info( await binance.futuresQuote( "BCHUSDT" ) );
console.info( await binance.futuresDaily() );
console.info( await binance.futuresOpenInterest( "BTCUSDT" ) );
console.info( await binance.futuresMarkPrice() );
console.info( await binance.futuresMarkPrice( "ETHUSDT" ) );
console.info( await binance.futuresTrades( "LTCUSDT" ) );
console.info( await binance.futuresAggTrades( "XTZUSDT" ) );
console.info( await binance.futuresLiquidationOrders() );
console.info( await binance.futuresFundingRate() );
console.info( await binance.futuresHistoricalTrades( "XMRUSDT" ) );
console.info( await binance.fu

Related Skills

View on GitHub
GitHub Stars1.7k
CategoryDesign
Updated4d ago
Forks759

Languages

TypeScript

Security Score

100/100

Audited on Aug 4, 2026

No findings