Original project created by @Treast (https://github.com/Treast/universal-binance-api).
An API wrapper for Binance. Build your application faster !
This fork implements correctly the isomorphic-fetch
to be able to use this on browser or on node!
- Built with Typescript (autocomplete on request/response)
- Use native Promises
- Updated with the latest version
This library is being written. Some features may be changed as updates are made. Be careful.
I disclaim all responsibility for any loss, injury, claim, liability, or damage of any kind resulting from, arising out of, or any way related to any errors in or omissions from this library.
npm install -D universal-binance-api
yarn add -D universal-binance-api
const { Binance } = require('universal-binance-api');
const binance = new Binance(API_KEY, TEST_SECRET_KEY, true); // 3rd parameter is testMode. Set explicitly to false if you want to use Live API.
binance
.spotAllOrders({
symbol: 'BTCUSDT',
})
.then((res) => {
console.log(res);
});
import { Binance } from 'universal-binance-api';
const binance = new Binance(API_KEY, TEST_SECRET_KEY, true); // 3rd parameter is testMode. Set explicitly to false if you want to use Live API.
binance
.spotNewOrder({
symbol: 'BTCUSDT',
side: Binance.EOrderSide.BUY,
type: Binance.EOrderType.LIMIT,
quantity: 0.01,
price: 1000,
timeInForce: Binance.EOrderTimeInForce.GTC,
.then((res) => {
console.log(res);
});
All functions have the same name as described on the official documentation and are prefixed by the domain: https://binance-docs.github.io/apidocs/.
Example: Spot > New Order becomes spotNewOrder
Example: Savings > Purchase Fixed/Activity Project becomes savingsPurchaseFixedActivityProject
Stream functions return a Websocket instance from the ws package. A cache is set up to prevent opening a same stream twice.
- API Structure
- Wallet endpoints
- Market endpoints
- Spot endpoints
- Margin endpoints
- Saving endpoints
- Futures endpoints
- Streams
- Mining endpoints
- BLVT endpoints
- BSwap endpoints
- Sub-accounts endpoints
- Streams typings
- Better error handling