bnbapi
v1.1.9
Published
Simple Binance api with GET and POST methods.
Downloads
33
Readme
About
Simple Binance api with GET and POST methods.
Usage example 1 (api class)
const api = require('bnbapi')
let ac = new api("<APIKEY>", "<SECRET>");
async function f(){
let r = await ac.get('/papi/v1/balance')
console.log(r)
}
f()
Usage example 2 (call function)
const {call} = require('bnbapi')
let apiKey = "<APIKEY>";
let secret = "<SECRET>";
let path = "/papi/v1/balance";
async function f() {
let r = await call(path, { apiKey, secret, data, method, raw });
console.log(r);
}
f();
Parameters 1 (api class)
let ac = new api("<APIKEY>", "<SECRET>", {testnet});
ac.get(path, data, { raw }) // GET
ac.post(path, data, { raw }) // POST
ac.put(path, data, { raw }) // PUT
ac.delete(path, data, { raw }) // DELETE
ac.getPublic(path, data, { raw }) // GET public endpoint // alt: ac.call(path[, data])
ac.call() // refer above
required: path: eg: "/papi/v1/balance" optional:
- apiKey, secret: can be omitted for public endpoint: eg: "/api/v3/ticker/price"
- testnet: 0|1, default: 0
- data: payload parameters object to be sent
- raw: 0|1, default: 0, get the raw return with headers and status, else return only the data.
Parameters 2 (call function)
call(path, { data, apiKey, secret, method, testnet, raw } = {})
required: path: eg: "/papi/v1/balance" optional:
- data: payload parameters object to be sent
- apiKey, secret: can be omitted for public endpoint: eg: "/api/v3/ticker/price"
- method: "GET|POST", default: "GET"
- testnet: 0|1, default: 0
- raw: 0|1, default: 0, get the raw return with headers and status, else return only the data.
Global rate limit
global.bnbLimit["x-mbx-used-weight"]
global.bnbLimit["x-mbx-used-weight-1m"]
global.bnbLimit["x-mbx-order-count-10s"]
global.bnbLimit["x-mbx-order-count-1m"]
global.bnbLimit["x-sapi-used-ip-weight-1m"]
global.bnbLimit["x-sapi-used-uid-weight-1m"]
Only used limit will be shown.