JSPM

asterdex

1.0.0
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q29656F
    • License ISC

    Package Exports

    • asterdex
    • asterdex/index.js

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (asterdex) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    About

    A simple AsterDex.com api for REST api: https://github.com/asterdex/api-docs.

    Usage example 1 (api class)

    const api = require('asterdex')
    let ac = new api("<APIKEY>", "<SECRET>");
    async function f(){
      let r = await ac.get('/fapi/v2/balance')
      console.log(r)
    }
    f()

    Usage example 2 (call function)

    const {call} = require('asterdex')
    let apiKey = "<APIKEY>";
    let secret = "<SECRET>";
    let path = "/fapi/v2/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: "/fapi/v2/balance" optional:

    • apiKey, secret: can be omitted for public endpoint: eg: "/fapi/v1/exchangeInfo"
    • 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: "/fapi/v1/exchangeInfo"
    • 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.