1.2.6 • Published 6 months ago

bnbapi v1.2.6

Weekly downloads
-
License
ISC
Repository
-
Last release
6 months ago

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.

1.2.6

6 months ago

1.2.5

6 months ago

1.2.4

7 months ago

1.2.3

7 months ago

1.2.0

8 months ago

1.2.2

8 months ago

1.2.1

8 months ago

1.1.9

11 months ago

1.1.1

11 months ago

1.1.8

11 months ago

1.1.7

11 months ago

1.1.6

11 months ago

1.1.5

11 months ago

1.1.4

11 months ago

1.1.3

11 months ago

1.1.2

11 months ago

1.1.0

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.7

11 months ago

1.0.6

11 months ago

1.0.5

12 months ago

1.0.4

12 months ago

1.0.3

12 months ago

1.0.2

12 months ago

1.0.1

12 months ago

1.0.0

12 months ago