downloads
Across all versions, last 30 days.
53,390 in 30 days
compatibility
Runtime metadata.
Across all versions, last 30 days.
53,390 in 30 days
Runtime metadata.
Estimated unpacked size across 1 packages.
380.9 kB
Includes dependencies.
7 direct dependencies.
^7.2.0
^2.7.0
^1.0.0
^4.0.1
^4.1.3
^5.0.0
^4.2.0

A complete API wrapper for the Binance API.
Note: This wrapper uses Promises, if they are not supported in your environment, you might want to add a polyfill for them.
For PRs or issues, head over to the source repository.
For contribution guidelines and development instructions, see CONTRIBUTING.md.
npm install binance-api-nodeImport the module and create a new client. Passing api keys is optional only if you don't plan on doing authenticated calls. You can create an api key here. If you want to create demo/testnet keys click here
import Binance from 'binance-api-node'
const client = Binance()
// Authenticated client, can make signed calls
const client2 = Binance({
apiKey: 'xxx',
apiSecret: 'xxx',
getTime: xxx,
})
client.time().then(time => console.log(time))To use testnet, initialize it with the testnet boolean set to true.
const client = Binance({
apiKey: 'xxx',
apiSecret: 'xxx',
getTime: xxx,
testnet: true,
})This library works in both browsers and Node.js environments:
This library supports RSA and ED25519 keys out of the box. The usage is straightforward, just provide privateKey instead of apiSecret.
const apiKey = "ZymCbCxu1LiYIW8IcYSbXQOaAtHaeW3ioCU5qFf5QvUyTfP1runCaY8AwzCaoOaq"
const privateKey = "-----BEGIN PRIVATE KEY-----\ndMC4CAfAwafYDK2cwaCIEIa+Ax8dMK50wcIcD0Zdf2jaCDoRdaoc7KaadRUh+aLdt\n-----END PRIVATE KEY-----"
const client = Binance({
privateKey,
apiKey,
})
Proxy support for HTTP and WebSocket connections is available in Node.js:
const client = Binance({
apiKey: 'xxx',
apiSecret: 'xxx',
proxy: 'http://proxy-host:port',
})
// All HTTP requests and WebSocket connections will use the proxy
await client.time()
client.ws.ticker('BTCUSDT', ticker => console.log(ticker))Notes:
binance-api-node fully supports the new algo service introduced on the Decemeber 9th of 2025http:// or https:// protocol)http://username:password@proxy-host:portIf you do not have an appropriate babel config, you will need to use the basic commonjs requires.
const Binance = require('binance-api-node').defaultEvery REST method returns a Promise, making this library async await ready.
Following examples will use the await form, which requires some configuration you will have to lookup.
| Param | Type | Required | Info |
|---|---|---|---|
| apiKey | String | false | Required when making private calls |
| apiSecret | String | false | Required when making private calls |
| privateKey | String | false | Required when using RSA/Ed25519 calls |
| getTime | Function | false | Time generator, defaults to () => Date.now() |
| httpBase | String | false | Changes the default endpoint |
| httpFutures | String |
Test connectivity to the API.
console.log(await client.ping())Test connectivity to the Rest API and get the current server time.
console.log(await client.time())1508478457643Get the current exchange trading rules and symbol information. You can optionally pass a symbol to only retrieve info of this specific one.
console.log(await client.exchangeInfo())| Param | Type | Required | Default |
|---|---|---|---|
| symbol | String | false |
{
"timezone": "UTC",
"serverTime": 1508631584636,
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 1200
},
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 1,
"limit": 10
},
{
"rateLimitType": "ORDERS",
Get the order book for a symbol.
console.log(await client.book({ symbol: 'ETHBTC' }))| Param | Type | Required | Default |
|---|---|---|---|
| symbol | String | true | |
| limit | Number | false | 100 |
{
lastUpdateId: 17647759,
asks:
[
{ price: '0.05411500', quantity: '5.55000000' },
{ price: '0.05416700', quantity: '11.80100000' }
],
bids:
[
{ price: '0.05395500', quantity: '2.70000000' },
{ price: '0.05395100', quantity: '11.84100000' }
]
}Retrieves Candlestick for a symbol. Candlesticks are uniquely identified by their open time.
console.log(await client.candles({ symbol: 'ETHBTC' }))| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| interval | String | false | 5m | 1m, 3m, 5m, 15m, 30m, 1h, 2h,4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M |
| limit | Number | false | 500 | Max 1000 |
| startTime | Number | false |
;[
{
openTime: 1508328900000,
open: '0.05655000',
high: '0.05656500',
low: '0.05613200',
close: '0.05632400',
volume: '68.88800000',
closeTime: 1508329199999,
quoteAssetVolume: '2.29500857',
trades: 85,
baseAssetVolume: '40.61900000',
},
]Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
console.log(await client.aggTrades({ symbol: 'ETHBTC' }))| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| fromId | String | false | ID to get aggregate trades from INCLUSIVE. | |
| startTime | Number | false | Timestamp in ms to get aggregate trades from INCLUSIVE. | |
| endTime | Number | false | Timestamp in ms to get aggregate trades until INCLUSIVE. | |
| limit | Number |
Note: If both startTime and endTime are sent, limit should not be sent AND the distance between startTime and endTime must be less than 1 hour.
Note: If frondId, startTime, and endTime are not sent, the most recent aggregate trades will be returned.
;[
{
aggId: 2107132,
symbol: 'ETHBTC',
price: '0.05390400',
quantity: '1.31000000',
firstId: 2215345,
lastId: 2215345,
timestamp: 1508478599481,
isBuyerMaker: true,
wasBestPrice: true,
},
]Get recent trades of a symbol.
console.log(await client.trades({ symbol: 'ETHBTC' }))| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| limit | Number | false | 500 | Max 500 |
;[
{
id: 28457,
price: '4.00000100',
qty: '12.00000000',
time: 1499865549590,
isBuyerMaker: true,
isBestMatch: true,
},
]24 hour price change statistics, not providing a symbol will return all tickers and is resource-expensive.
console.log(await client.dailyStats({ symbol: 'ETHBTC' }))| Param | Type | Required |
|---|---|---|
| symbol | String | false |
{
symbol: 'ETHBTC',
priceChange: '-0.00112000',
priceChangePercent: '-1.751',
weightedAvgPrice: '0.06324784',
prevClosePrice: '0.06397400',
lastPrice: '0.06285500',
lastQty: '0.63500000',
bidPrice: '0.06285500',
bidQty: '0.81900000',
askPrice: '0.06291900',
askQty: '2.93800000',
openPrice: '0.06397500',
highPrice: '0.06419100',
lowPrice
Current average price for a symbol.
console.log(await client.avgPrice({ symbol: 'ETHBTC' }))| Param | Type | Required |
|---|---|---|
| symbol | String | true |
{
"mins": 5,
"price": "9.35751834"
}Latest price for a symbol, not providing the symbol will return prices for all symbols.
console.log(await client.prices())| Param | Type | Required |
|---|---|---|
| symbol | String | false |
{
ETHBTC: '0.05392500',
LTCBTC: '0.01041100',
...
}Best price/qty on the order book for all symbols.
console.log(await client.allBookTickers()){
DASHBTC: {
symbol: 'DASHBTC',
bidPrice: '0.04890400',
bidQty: '0.74100000',
askPrice: '0.05230000',
askQty: '0.79900000'
},
DASHETH: {
symbol: 'DASHETH',
bidPrice: '0.89582000',
bidQty: '0.63300000',
askPrice: '1.02328000',
askQty: '0.99900000'
}
...
}Test connectivity to the API.
console.log(await client.futuresPing())Test connectivity to the Rest API and get the current server time.
console.log(await client.futuresTime())1508478457643Get the current exchange trading rules and symbol information.
console.log(await client.futuresExchangeInfo()){
"timezone": "UTC",
"serverTime": 1508631584636,
"rateLimits": [
{
"rateLimitType": "REQUEST_WEIGHT",
"interval": "MINUTE",
"intervalNum": 1,
"limit": 1200
},
{
"rateLimitType": "ORDERS",
"interval": "SECOND",
"intervalNum": 1,
"limit": 10
},
{
"rateLimitType": "ORDERS",
Get the order book for a symbol.
console.log(await client.futuresBook({ symbol: 'BTCUSDT' }))| Param | Type | Required | Default |
|---|---|---|---|
| symbol | String | true | |
| limit | Number | false | 100 |
{
lastUpdateId: 17647759,
asks:
[
{ price: '8000.05411500', quantity: '54.55000000' },
{ price: '8000.05416700', quantity: '1111.80100000' }
],
bids:
[
{ price: '8000.05395500', quantity: '223.70000000' },
{ price: '8000.05395100', quantity: '1134.84100000' }
]
}Retrieves Candlestick for a symbol. Candlesticks are uniquely identified by their open time.
console.log(await client.futuresCandles({ symbol: 'BTCUSDT' }))| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| interval | String | false | 5m | 1m, 3m, 5m, 15m, 30m, 1h, 2h,4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M |
| limit | Number | false | 500 | Max 1000 |
| startTime | Number | false |
;[
{
openTime: 1508328900000,
open: '0.05655000',
high: '0.05656500',
low: '0.05613200',
close: '0.05632400',
volume: '68.88800000',
closeTime: 1508329199999,
quoteAssetVolume: '2.29500857',
trades: 85,
baseAssetVolume: '40.61900000',
},
]Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
console.log(await client.futuresAggTrades({ symbol: 'ETHBTC' }))| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| fromId | String | false | ID to get aggregate trades from INCLUSIVE. | |
| startTime | Number | false | Timestamp in ms to get aggregate trades from INCLUSIVE. | |
| endTime | Number | false | Timestamp in ms to get aggregate trades until INCLUSIVE. | |
| limit | Number |
Note: If both startTime and endTime are sent, limit should not be sent AND the distance between startTime and endTime must be less than 24 hours.
Note: If frondId, startTime, and endTime are not sent, the most recent aggregate trades will be returned.
;[
{
aggId: 2107132,
price: '0.05390400',
quantity: '1.31000000',
firstId: 2215345,
lastId: 2215345,
timestamp: 1508478599481,
isBuyerMaker: true,
wasBestPrice: true,
},
]Get recent trades of a symbol.
console.log(await client.futuresTrades({ symbol: 'ETHBTC' }))| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| limit | Number | false | 500 | Max 500 |
;[
{
id: 28457,
price: '4.00000100',
qty: '12.00000000',
time: 1499865549590,
isBuyerMaker: true,
isBestMatch: true,
},
]24 hour price change statistics, not providing a symbol will return all tickers and is resource-expensive.
console.log(await client.futuresDailyStats({ symbol: 'ETHBTC' }))| Param | Type | Required |
|---|---|---|
| symbol | String | false |
{
symbol: 'BTCUSDT',
priceChange: '-0.00112000',
priceChangePercent: '-1.751',
weightedAvgPrice: '0.06324784',
prevClosePrice: '0.06397400',
lastPrice: '0.06285500',
lastQty: '0.63500000',
bidPrice: '0.06285500',
bidQty: '0.81900000',
askPrice: '0.06291900',
askQty: '2.93800000',
openPrice: '0.06397500',
highPrice: '0.06419100',
lowPrice
Latest price for symbol, not providing a symbol will return latest price for all symbols and is resource-expensive.
console.log(await client.futuresPrices())| Param | Type | Required |
|---|---|---|
| symbol | String | false |
{
BTCUSDT: '8590.05392500',
ETHUSDT: '154.1100',
...
}Best price/qty on the order book for all symbols.
console.log(await client.futuresAllBookTickers()){
BTCUSDT: {
symbol: 'BTCUSDT',
bidPrice: '0.04890400',
bidQty: '0.74100000',
askPrice: '0.05230000',
askQty: '0.79900000'
},
ETHUSDT: {
symbol: 'ETHUSDT',
bidPrice: '0.89582000',
bidQty: '0.63300000',
askPrice: '1.02328000',
askQty: '0.99900000'
}
...
}Mark Price and Funding Rate.
console.log(await client.futuresMarkPrice()){
"symbol": "BTCUSDT",
"markPrice": "11012.80409769",
"lastFundingRate": "-0.03750000",
"nextFundingTime": 1562569200000,
"time": 1562566020000
}Get all Liquidation Orders.
console.log(await client.futuresAllForceOrders())| Param | Type | Required |
|---|---|---|
| symbol | String | false |
| startTime | Long | false |
| endTime | Long | false |
| limit | Long | false |
;[
{
symbol: 'BTCUSDT', // SYMBOL
price: '7918.33', // ORDER_PRICE
origQty: '0.014', // ORDER_AMOUNT
executedQty: '0.014', // FILLED_AMOUNT
avragePrice: '7918.33', // AVG_PRICE
status: 'FILLED', // STATUS
timeInForce: 'IOC', // TIME_IN_FORCE
type: 'LIMIT',
side: 'SELL', // DIRECTION
time: 1568014460893,
},
]Test connectivity to the API.
console.log(await client.deliveryPing())Test connectivity to the Rest API and get the current server time.
console.log(await client.deliveryTime())1508478457643Get the current exchange trading rules and symbol information.
console.log(await client.deliveryExchangeInfo()){
timezone: 'UTC',
serverTime: 1663099219744,
rateLimits: [
{
rateLimitType: 'REQUEST_WEIGHT',
interval: 'MINUTE',
intervalNum: 1,
limit: 2400
},
{
rateLimitType: 'ORDERS',
interval: 'MINUTE',
intervalNum: 1,
limit: 1200
}
],
exchangeFilters: [],
symbols: [...]
}Get the order book for a symbol.
console.log(await client.deliveryBook({ symbol: 'TRXUSD_PERP' }))| Param | Type | Required | Default |
|---|---|---|---|
| symbol | String | true | |
| limit | Number | false | 500 |
{
lastUpdateId: 17647759,
asks:
[
{ price: '8000.05411500', quantity: '54.55000000' },
{ price: '8000.05416700', quantity: '1111.80100000' }
],
bids:
[
{ price: '8000.05395500', quantity: '223.70000000' },
{ price: '8000.05395100', quantity: '1134.84100000' }
]
}Retrieves Candlestick for a symbol. Candlesticks are uniquely identified by their open time.
console.log(await client.deliveryCandles({ symbol: 'TRXUSD_PERP' }))| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| interval | String | false | 5m | 1m, 3m, 5m, 15m, 30m, 1h, 2h,4h, 6h, 8h, 12h, 1d, 3d, 1w, 1M |
| limit | Number | false | 500 | Max 1000 |
| startTime | Number | false |
[
{
openTime: 1663104600000,
open: '0.06091',
high: '0.06091',
low: '0.06086',
close: '0.06090',
volume: '7927',
closeTime: 1663104899999,
baseVolume: '1302212.12820796',
trades: 75,
quoteAssetVolume: '386',
baseAssetVolume: '63382.78318786'
}
]Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
console.log(await client.deliveryAggTrades({ symbol: 'TRXUSD_PERP' }))| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| fromId | String | false | ID to get aggregate trades from INCLUSIVE. | |
| startTime | Number | false | Timestamp in ms to get aggregate trades from INCLUSIVE. | |
| endTime | Number | false | Timestamp in ms to get aggregate trades until INCLUSIVE. | |
| limit | Number |
Note: If both startTime and endTime are sent, limit should not be sent AND the distance between startTime and endTime must be less than 24 hours.
Note: If fromId, startTime, and endTime are not sent, the most recent aggregate trades will be returned.
Note : Only market trades will be aggregated and returned, which means the insurance fund trades and ADL trades won't be aggregated.
[
{
aggId: 14642023,
symbol: 'TRXUSD_PERP',
price: '0.06087',
quantity: '50',
firstId: 26319898,
lastId: 26319898,
timestamp: 1663105187120,
isBuyerMaker: false,
}
]Get recent trades of a symbol.
console.log(await client.deliveryTrades({ symbol: 'TRXUSD_PERP' }))| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| limit | Number | false | 500 | Max 1000 |
;[
{
id: 26319660,
price: '0.06097',
qty: '28',
baseQty: '4592.42250287',
time: 1663103746267,
isBuyerMaker: true
},
]24 hour price change statistics, not providing a symbol will return all tickers and is resource-expensive.
console.log(await client.deliveryDailyStats({ symbol: 'TRXUSD_PERP' }))| Param | Type | Required |
|---|---|---|
| symbol | String | false |
| pair | String | false |
{
symbol: 'TRXUSD_PERP',
pair: 'TRXUSD',
priceChange: '-0.00277',
priceChangePercent: '-4.353',
weightedAvgPrice: '0.06248010',
lastPrice: '0.06087',
lastQty: '4',
openPrice: '0.06364',
highPrice: '0.06395',
lowPrice: '0.06069',
volume: '545316',
baseVolume: '87278342.48218514',
openTime: 1663019640000,
closeTime
Latest price for all symbols.
console.log(await client.futuresPrices()){
BTCUSDT: '8590.05392500',
ETHUSDT: '154.1100',
...
}Best price/qty on the order book for all symbols.
console.log(await client.deliveryAllBookTickers()){
BTCUSD_PERP: {
symbol: 'BTCUSD_PERP',
pair: 'BTCUSD',
bidPrice: '20120.9',
bidQty: '13673',
askPrice: '20121.0',
askQty: '2628',
time: 1663106372658
},
ETHUSD_PERP: {
symbol: 'ETHUSD_PERP',
pair: 'ETHUSD',
bidPrice: '1593.63',
bidQty: '7210',
askPrice: '1593.64',
Mark Price and Funding Rate.
console.log(await client.deliveryMarkPrice())[
{
symbol: 'BTCUSD_221230',
pair: 'BTCUSD',
markPrice: '20158.81560758',
indexPrice: '20152.05327273',
estimatedSettlePrice: '20147.96717735',
lastFundingRate: '',
interestRate: '',
nextFundingTime: 0,
time: 1663106459005
},
{
symbol: 'FILUSD_PERP',
pair: 'FILUSD',
markPrice: '5.88720470',
indexPrice: '5.89106242',
estimatedSettlePrice: '5.89377086',
lastFundingRate: '0.00010000',
Note that for all authenticated endpoints, you can pass an extra parameter
useServerTime set to true in order to fetch the server time before making
the request.
console.log(
await client.order({
symbol: 'XLMETH',
side: 'BUY',
quantity: '100',
price: '0.0002',
}),
)| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| side | String | true | BUY,SELL | |
| type | String | false | LIMIT | LIMIT, MARKET |
| quantity | String | true | ||
| price | String |
Additional mandatory parameters based on type:
| Type | Additional mandatory parameters |
|---|---|
LIMIT | timeInForce, quantity, price |
MARKET | quantity |
STOP | quantity, price, stopPrice |
STOP_LOSS_LIMIT | timeInForce, quantity, price, stopPrice |
STOP_LOSS_MARKET | stopPrice |
TAKE_PROFIT | quantity, price, stopPrice |
TAKE_PROFIT_MARKET | stopPrice |
STOP_PROFIT_LIMIT | timeInForce, quantity, price, stopPrice |
LIMIT_MAKER are LIMIT orders that will be rejected if they would immediately match and trade as a taker.STOP and TAKE_PROFIT will execute a MARKET order when the stopPrice is reached.LIMIT or LIMIT_MAKER type order can be made an iceberg order by sending an icebergQty.icebergQty MUST have timeInForce set to GTC.{
symbol: 'XLMETH',
orderId: 1740797,
clientOrderId: '1XZTVBTGS4K1e',
transactTime: 1514418413947,
price: '0.00020000',
origQty: '100.00000000',
executedQty: '0.00000000',
status: 'NEW',
timeInForce: 'GTC',
type: 'LIMIT',
side: 'BUY'
}Test new order creation and signature/recvWindow. Creates and validates a new order but does not send it into the matching engine.
Same API as above, but does not return any output on success.
const order = await client.updateOrder({
symbol: 'LTCUSDT',
cancelOrderId: 12345678,
side: 'BUY',
type: 'LIMIT',
quantity: 1,
price: 80,
timeInForce: 'GTC',
})
Creates a new OCO order.
console.log(
await client.orderOco({
symbol: 'XLMETH',
side: 'SELL',
quantity: 100,
price: 0.0002,
stopPrice: 0.0001,
stopLimitPrice: 0.0001,
}),
)| Param | Type | Required | Description |
|---|---|---|---|
| symbol | String | true | |
| listClientOrderId | String | false | A unique Id for the entire orderList |
| side | String | true | BUY,SELL |
| quantity | Number | true | |
| limitClientOrderId | String | false | A unique Id for the limit order |
| price | Number | true |
Additional Info:
SELL: Limit Price > Last Price > Stop PriceBUY: Limit Price < Last Price < Stop PriceICEBERG quantities however do not have to be the same{
"orderListId": 0,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "JYVpp3F0f5CAG15DhtrqLp",
"transactionTime": 1514418413947,
"symbol": "XLMETH",
"orders": [
{
"symbol": "XLMETH",
"orderId": 1740797,
"clientOrderId": "1XZTVBTGS4K1e"
},
{
"symbol": "XLMETH",
"orderId":
Check an order's status.
console.log(
await client.getOrder({
symbol: 'BNBETH',
orderId: 50167927,
}),
)| Param | Type | Required | Description |
|---|---|---|---|
| symbol | String | true | |
| orderId | Number | true | Not required if origClientOrderId is used |
| origClientOrderId | String | false | |
| recvWindow | Number | false |
{
clientOrderId: 'NkQnNkdBV1RGjUALLhAzNy',
cummulativeQuoteQty: '0.16961580',
executedQty: '3.91000000',
icebergQty: '0.00000000',
isWorking: true,
orderId: 50167927,
origQty: '3.91000000',
price: '0.04338000',
side: 'SELL',
status: 'FILLED',
stopPrice: '0.00000000',
symbol: 'BNBETH',
time: 1547075007821,
timeInForce
Retrieves a specific OCO based on provided optional parameters
console.log(
await client.getOrderOco({
orderListId: 27,
}),
)| Param | Type | Required | Description |
|---|---|---|---|
| orderListId | Number | true | Not required if listClientOrderId is used |
| listClientOrderId | String | false | |
| recvWindow | Number | false |
{
orderListId: 27,
contingencyType: 'OCO',
listStatusType: 'EXEC_STARTED',
listOrderStatus: 'EXECUTING',
listClientOrderId: 'h2USkA5YQpaXHPIrkd96xE',
transactionTime: 1565245656253,
symbol: 'LTCBTC',
orders: [
{
symbol: 'LTCBTC',
orderId: 4,
clientOrderId: 'qD1gy3kc3Gx0rihm9Y3xwS'
},
{
symbol: 'LTCBTC',
orderId: 5,
clientOrderId: 'ARzZ9I00CPM8i3NhmU9Ega'
Cancels an active order.
console.log(
await client.cancelOrder({
symbol: 'ETHBTC',
orderId: 1,
}),
)| Param | Type | Required | Description |
|---|---|---|---|
| symbol | String | true | |
| orderId | Number | true | Not required if origClientOrderId is used |
| origClientOrderId | String | false | |
| newClientOrderId | String | false | Used to uniquely identify this cancel. Automatically generated by default. |
| recvWindow | Number | false |
{
symbol: 'ETHBTC',
origClientOrderId: 'bnAoRHgI18gRD80FJmsfNP',
orderId: 1,
clientOrderId: 'RViSsQPTp1v3WmLYpeKT11'
}Cancel an entire Order List.
console.log(
await client.cancelOrderOco({
symbol: 'ETHBTC',
orderListId: 0,
}),
)| Param | Type | Required | Description |
|---|---|---|---|
| symbol | String | true | |
| orderListId | Number | true | Not required if listClientOrderId is used |
| listClientOrderId | String | false | |
| newClientOrderId | String | false | Used to uniquely identify this cancel. Automatically generated by default. |
| recvWindow | Number | false |
{
orderListId: 0,
contingencyType: 'OCO',
listStatusType: 'ALL_DONE',
listOrderStatus: 'ALL_DONE',
listClientOrderId: 'C3wyj4WVEktd7u9aVBRXcN',
transactionTime: 1574040868128,
symbol: 'LTCBTC',
orders: [
{
symbol: 'LTCBTC',
orderId: 2,
clientOrderId: 'pO9ufTiFGg3nw2fOdgeOXa'
},
{
symbol: 'LTCBTC',
orderId: 3,
clientOrderId: 'TXOvglzXuaubXAaENpaRCB'
Cancels all active orders on a symbol. This includes OCO orders.
console.log(
await client.cancelOpenOrders({
symbol: 'ETHBTC'
}),
)| Param | Type | Required |
|---|---|---|
| symbol | String | true |
[
{
symbol: 'ETHBTC',
origClientOrderId: 'bnAoRHgI18gRD80FJmsfNP',
orderId: 1,
clientOrderId: 'RViSsQPTp1v3WmLYpeKT11'
},
{
symbol: 'ETHBTC',
origClientOrderId: 'IDbzcGmfwSCKihxILK1snu',
orderId: 2,
clientOrderId: 'HKFcuWAm9euMgRuwVGR8CL'
}
]Get all open orders on a symbol.
console.log(
await client.openOrders({
symbol: 'XLMBTC',
}),
)| Param | Type | Required |
|---|---|---|
| symbol | String | true |
| recvWindow | Number | false |
;[
{
symbol: 'XLMBTC',
orderId: 11271740,
clientOrderId: 'ekHkROfW98gBN80LTfufQZ',
price: '0.00001081',
origQty: '1331.00000000',
executedQty: '0.00000000',
status: 'NEW',
timeInForce: 'GTC',
type: 'LIMIT',
side: 'BUY',
stopPrice: '0.00000000',
icebergQty: '0.00000000',
time: 1522682290485,
isWorking: true,
},
]Get all account orders on a symbol; active, canceled, or filled.
console.log(
await client.allOrders({
symbol: 'ETHBTC',
}),
)| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| orderId | Number | false | If set, it will get orders >= that orderId. Otherwise most recent orders are returned. | |
| limit | Number | false | 500 | Max 500 |
| recvWindow | Number | false |
;[
{
symbol: 'ENGETH',
orderId: 191938,
clientOrderId: '1XZTVBTGS4K1e',
price: '0.00138000',
origQty: '1.00000000',
executedQty: '1.00000000',
status: 'FILLED',
timeInForce: 'GTC',
type: 'LIMIT',
side: 'SELL',
stopPrice: '0.00000000',
icebergQty: '0.00000000',
time: 1508611114735,
isWorking: true,
},
]Retrieves all OCO based on provided optional parameters
console.log(
await client.allOrdersOCO({
timestamp: 1565245913483,
}),
)| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| timestamp | Number | true | ||
| startTime | Number | false | ||
| endTime | Number | false | ||
| limit | Integer | false | 500 | Max 1000 |
| recvWindow | Number | false |
;[
{
"orderListId": 29,
"contingencyType": "OCO",
"listStatusType": "EXEC_STARTED",
"listOrderStatus": "EXECUTING",
"listClientOrderId": "amEEAXryFzFwYF1FeRpUoZ",
"transactionTime": 1565245913483,
"symbol": "LTCBTC",
"orders": [
{
"symbol": "LTCBTC",
"orderId": 4,
"clientOrderId": "oD7aesZqjEGlZrbtRpy5zB"
},
{
"symbol": "LTCBTC",
Get current account information.
console.log(await client.accountInfo())| Param | Type | Required |
|---|---|---|
| recvWindow | Number | false |
{
makerCommission: 10,
takerCommission: 10,
buyerCommission: 0,
sellerCommission: 0,
canTrade: true,
canWithdraw: true,
canDeposit: true,
balances: [
{ asset: 'BTC', free: '0.00000000', locked: '0.00000000' },
{ asset: 'LTC', free: '0.00000000', locked: '0.00000000' },
]
}Get trades for the current authenticated account and symbol.
console.log(
await client.myTrades({
symbol: 'ETHBTC',
}),
)| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| limit | Number | false | 500 | Max 1000 |
| fromId | Number | false | TradeId to fetch from. Default gets most recent trades. | |
| orderId | Number | false | This can only be used in combination with symbol. | |
| startTime | Number |
;[
{
id: 9960,
orderId: 191939,
price: '0.00138000',
qty: '10.00000000',
commission: '0.00001380',
commissionAsset: 'ETH',
time: 1508611114735,
isBuyer: false,
isMaker: false,
isBestMatch: true,
},
]Get asset snapshot for the current authenticated account.
console.log(
await client.accountSnapshot({
"type": "SPOT"
});
)| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| type | String | true | ||
| startTime | Number | false | ||
| endTime | Number | false | ||
| limit | Number | false | 5 | min 5, max 30, default 5 |
| recvWindow | Number |
{
"code":200, // 200 for success; others are error codes
"msg":"", // error message
"snapshotVos":[
{
"data":{
"balances":[
{
"asset":"BTC",
"free":"0.09905021",
"locked":"0.00000000"
},
{
"asset":"USDT",
"free":"1.89109409",
"locked":"0.00000000"
}
],
"totalAssetOfBtc"
Lookup symbol trades history.
console.log(await client.tradesHistory({ symbol: 'ETHBTC' }))| Param | Type | Required | Default | Description |
|---|---|---|---|---|
| symbol | String | true | ||
| limit | Number | false | 500 | Max 500 |
| fromId | Number | false | null | TradeId to fetch from. Default gets most recent trades. |
;[
{
id: 28457,
price: '4.00000100',
qty: '12.00000000',
time: 1499865549590,
isBuyerMaker: true,
isBestMatch: true,
},
]Get the account withdraw history.
console.log(await client.withdrawHistory())| Param | Type | Required | Description |
|---|---|---|---|
| asset | String | false | |
| status | Number | false | 0 (0: Email Sent, 1: Cancelled 2: Awaiting Approval, 3: Rejected, 4: Processing, 5: Failure, 6: Completed) |
| offset | Number | false | |
| limit | Number | false | |
| startTime | Number | false | |
| endTime | Number | false |
[
{
"address": "0x94df8b352de7f46f64b01d3666bf6e936e44ce60",
"amount": "8.91000000",
"applyTime": "2019-10-12 11:12:02",
"coin": "USDT",
"id": "b6ae22b3aa844210a7041aee7589627c",
"withdrawOrderId": "WITHDRAWtest123", // will not be returned if there's no withdrawOrderId for this withdraw.
"network": "ETH",
"transferType": 0, // 1 for internal transfer, 0 for external transfer
"status": 6,
"txId": "0xb5ef8c13b968a406cc62a93a8bd80f9e9a906ef1b3fcf20a2e48573c17659268"
},
{
"address": "1FZdVHtiBqMrWdjPyRPULCUceZPJ2WLCsB"
Triggers the withdraw process.
console.log(
await client.withdraw({
coin: 'ETH',
network: 'ETH',
address: '0xfa97c22a03d8522988c709c24283c0918a59c795',
amount: 100,
// addressTag: '' // MEMO
}),
)| Param | Type | Required | Description |
|---|---|---|---|
| asset | String | true | |
| address | String | true | |
| amount | Number | true | |
| name | String | false | Description of the address |
| recvWindow | Number | false |
{
"id":"7213fea8e94b4a5593d507237e5a555b"
}Fetch deposit address with network.
console.log(await client.depositAddress({ coin: 'NEO' }))| Param | Type | Required | Description |
|---|---|---|---|
| coin | String | true | The coin name |
| network | String | false | The network name |
{
address: 'AM6ytPW78KYxQCmU2pHYGcee7GypZ7Yhhc',
coin: 'NEO',
tag: '',
url: 'https://neoscan.io/address/AM6ytPW78KYxQCmU2pHYGcee7GypZ7Yhhc'
}Fetch deposit address with network.
console.log(await client.depositHistory())| Param | Type | Required | Description |
|---|---|---|---|
| coin | String | false | The coin name |
| status | Number | false | 0 (0:pending, 6: credited but cannot withdraw, 1:success) |
| startTime | Number | false | Default: 90 days from current timestamp |
| endTime | Number | false | Default: present timestamp |
| offset | Number | false | default: 0 |
| limit | Number | false |
[
{
"amount": "0.00999800",
"coin": "PAXG",
"network": "ETH",
"status": 1,
"address": "0x788cabe9236ce061e5a892e1a59395a81fc8d62c",
"addressTag": "",
"txId": "0xaad4654a3234aa6118af9b4b335f5ae81c360b2394721c019b5d1e75328b09f3",
"insertTime": 1599621997000,
"transferType": 0,
"confirmTimes": "12/12"
},
{
"amount": "0.50000000",
"coin": "IOTA"
Retrieve the account trade Fee per asset.
console.log(await client.tradeFee())[
{
"symbol": "ADABNB",
"makerCommission": 0.9000,
"takerCommission": 1.0000
},
{
"symbol": "BNBBTC",
"makerCommission": 0.3000,
"takerCommission": 0.3000
}
]
Get information of coins (available for deposit and withdraw) for user.
console.log(await client.capitalConfigs())[
{
'coin': 'CTR',
'depositAllEnable': false,
'free': '0.00000000',
'freeze': '0.00000000',
'ipoable': '0.00000000',
'ipoing': '0.00000000',
'isLegalMoney': false,
'locked': '0.00000000',
'name': 'Centra',
'networkList': [
{
'addressRegex': '^(0x)[0-9A-Fa-f]{40}$',
'coin': 'CTR',
'depositDesc': 'Delisted, Deposit Suspended'
You need to enable Permits Universal Transfer option for the api key which requests this endpoint.
console.log(await client.universalTransfer({ type: 'MAIN_C2C', asset: 'USDT', amount: '1000' }))| Param | Type | Required | Description |
|---|---|---|---|
| type | String | true | |
| asset | String | true | |
| amount | String | true | |
| recvWindow | Number | false |
{
tranId:13526853623
}console.log(await client.universalTransferHistory({ type: 'MAIN_C2C' }))| Param | Type | Required | Description |
|---|---|---|---|
| type | String | true | |
| startTime | Number | false | |
| endTime | Number | false | |
| current | Number | false | Default 1 |
| size | Number | false | Default 10, Max 100 |
| recvWindow | Number | false |
{
"total": 2,
"rows": [
{
"asset":"USDT",
"amount":"1",
"type":"MAIN_C2C"
"status": "CONFIRMED",
"tranId": 11415955596,
"timestamp":1544433328000
},
{
"asset":"USDT",
"amount":"2",
"type":"MAIN_C2C",
"status": "CONFIRMED",
"tranId": 11366865406,
console.log(await client.assetDetail())| Param | Type | Required | Description |
|---|---|---|---|
| recvWindow | Number | false |
{
"CTR": {
"minWithdrawAmount": "70.00000000", //min withdraw amount
"depositStatus": false,//deposit status (false if ALL of networks' are false)
"withdrawFee": 35, // withdraw fee
"withdrawStatus": true, //withdraw status (false if ALL of networks' are false)
"depositTip": "Delisted, Deposit Suspended" //reason
},
"SKY": {
"minWithdrawAmount": "0.02000000",
"depositStatus": true,
"withdrawFee": 0.01,
"withdrawStatus": true
}
}console.log(await client.getBnbBurn())| Param | Type | Required | Description |
|---|---|---|---|
| recvWindow | Number | false | No more than 60000 |
{
"spotBNBBurn":true,
"interestBNBBurn": false
}console.log(await client.setBnbBurandomguy007
carlos_jose_lima@hotmail.com
| false |
| Changes the default endpoint |
| wsBase | String | false | Changes the default endpoint |
| wsFutures | String | false | Changes the default endpoint |
| endTime | Number | false |
| false |
500 |
Max 500 |
| endTime | Number | false |
| false |
500 |
Max 500 |
| endTime | Number | false |
| false |
500 |
Max 1000 |
| true |
Optional for MARKET orders |
| timeInForce | String | false | GTC | FOK, GTC, IOC |
| newClientOrderId | String | false | A unique id for the order. Automatically generated if not sent. |
| stopPrice | Number | false | Used with stop orders |
| activationPrice | Number | false | Used with TRAILING_STOP_MARKET |
| callbackRate | Number | false | Used with TRAILING_STOP_MARKET |
| newOrderRespType | String | false | RESULT | Returns more complete info of the order. ACK, RESULT, or FULL |
| icebergQty | Number | false | Used with iceberg orders |
| recvWindow | Number | false |
LIMIT_MAKERquantity, price |
TRAILING_STOP_MARKET | callbackRate, activationPrice |
| limitIcebergQty | Number | false | Used to make the LIMIT_MAKER leg an iceberg order. |
| stopClientOrderId | String | false | A unique Id for the stop loss/stop loss limit leg |
| stopPrice | Number | true |
| stopLimitPrice | Number | false | If provided, stopLimitTimeInForce is required. |
| stopIcebergQty | Number | false | Used with STOP_LOSS_LIMIT leg to make an iceberg order. |
| stopLimitTimeInForce | String | false | FOK, GTC, IOC |
| newOrderRespType | String | false | Returns more complete info of the order. ACK, RESULT, or FULL |
| recvWindow | Number | false | The value cannot be greater than 60000 |
| The value cannot be greater than 60000 |
| formId | Number | false | If supplied, neither startTime or endTime can be provided |
| false |
| endTime | Number | false |
| recvWindow | Number | false | 5000 | The value cannot be greater than 60000. |
| false |
| recvWindow | Number | false |
| recvWindow | Number | false |