3.0.0 • Published 4 years ago
binance-nodejs v3.0.0
binance-nodejs
Binance.com v3 NodeJS REST API
Install
yarn add binance-nodejs
Setup
ENV vars (used if no params provided to constructor)
BINANCE_SAFE=1 // Read-only mode
BINANCE_TESTNET=1 // Testnet
BINANCE_KEY=key_here // API Key
BINANCE_SECRET=secret_here // API Secret
Import
import { REST } from 'binance-nodejs'
REST
Constructor
const rest = new REST(key, secret, testnet = false, timeout = 500, keepAlive = true)
Documentation https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md
const info = await rest.exchangeInfo()
GET /api/v3/ticker/price
rest.ticker_price({ symbol: 'BTCUSDT' })
POST /api/v3/order
const res = await rest.order(
{
symbol: 'BTCUSDT',
side: 'BUY',
type: 'MARKET',
quantity: .1,
},
'POST'
)
3.0.0
4 years ago