Package Exports
- open-binance-api
- open-binance-api/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (open-binance-api) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Binance Api Client
NodeJS Binance API Client
Install
npm i open-binance-api
Usage
const OpenBinance = require("open-binance-api");
let OBinance = new OpenBinance(
"API_KEY",
"SECRET_KEY"
);
Account/Wallet
Get Api Restrictions
OBinance.apiRestrictions().then((result) => {
console.log("apiRestrictions Result", result);
}).catch((err) => {
console.log("apiRestrictions Error: ", err);
});Get Trade Fee
OBinance.tradeFee("BTCUSDT").then((result) => {
console.log("tradeFee Result", result);
}).catch((err) => {
console.log("tradeFee Error: ", err);
});
Test connectivity to the Rest API.
OBinance.ping().then((result) => {
console.log("ping Result:", result);
}).catch((err) => {
console.log("ping Error: ", err);
});
Test connectivity to the Rest API and get the current server time.
OBinance.checkServerTime().then((result) => {
console.log("checkServerTime Result:", result);
}).catch((err) => {
console.log("checkServerTime Error: ", err);
});
Current exchange trading rules and symbol information
OBinance.exchangeInfo().then((result) => {
console.log("exchangeInfo Result:", result);
}).catch((err) => {
console.log("exchangeInfo Error: ", err);
});
Order Book
OBinance.depth("BTCUSDT").then((result) => {
console.log("depth Result:", result);
}).catch((err) => {
console.log("depth Error: ", err);
});
Get recent trades.
OBinance.trades("BTCUSDT").then((result) => {
console.log("trades Result:", result);
}).catch((err) => {
console.log("trades Error: ", err);
});
Get compressed, aggregate trades. Trades that fill at the time, from the same order, with the same price will have the quantity aggregated.
OBinance.aggTrades("BTCUSDT").then((result) => {
console.log("aggTrades Result:", result);
}).catch((err) => {
console.log("aggTrades Error: ", err);
});
Kline/candlestick bars for a symbol.
OBinance.klines("BTCUSDT").then((result) => {
console.log("klines Result:", result);
}).catch((err) => {
console.log("klines Error: ", err);
});
Current average price for a symbol.
OBinance.avgPrice("BTCUSDT").then((result) => {
console.log("avgPrice Result:", result);
}).catch((err) => {
console.log("avgPrice Error: ", err);
});
24 hour rolling window price change statistics. Careful when accessing this with no symbol.
OBinance.tickerPrice24hr(["BTCUSDT"]).then((result) => {
console.log("tickerPrice24hr Result:", result);
}).catch((err) => {
console.log("tickerPrice24hr Error: ", err);
});
Latest price for a symbol or symbols.
OBinance.latestPrice(["BTCUSDT"]).then((result) => {
console.log("latestPrice Result:", result);
}).catch((err) => {
console.log("latestPrice Error: ", err);
});
Best price/qty on the order book for a symbol or symbols.
OBinance.bookTicker(["BTCUSDT"]).then((result) => {
console.log("bookTicker Result:", result);
}).catch((err) => {
console.log("bookTicker Error: ", err);
});
This endpoint is different from the tickerPrice24hr() method.
OBinance.computeStatistics(["BTCUSDT"]).then((result) => {
console.log("computeStatistics Result:", result);
}).catch((err) => {
console.log("computeStatistics Error: ", err);
});
