1.2.6 • Published 8 months ago

bnbapi v1.2.6

Weekly downloads
-
License
ISC
Repository
-
Last release
8 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

8 months ago

1.2.5

8 months ago

1.2.4

9 months ago

1.2.3

9 months ago

1.2.0

9 months ago

1.2.2

9 months ago

1.2.1

9 months ago

1.1.9

1 year ago

1.1.1

1 year ago

1.1.8

1 year ago

1.1.7

1 year ago

1.1.6

1 year ago

1.1.5

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.0

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago