npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@bdxi/node-beldex-api

v1.0.9

Published

A light weight sdk for Beldex exchange API and WebSocket

Downloads

52

Readme

Introduction

A light weight package written in javascript for beldex exchange api and websocket. You can also write your own code to connect to the beldex API. Refer Beldex API Documentation.

Prerequisite

  • API Key
  • Secret
  • Passphrase

You can create the API Key, Secret and Passphrase from the My Accounts page of Beldex exchange

Installation

npm install @bdxi/node-beldex-api

Example

API

const { PublicClient } = require('@bdxi/node-beldex-api');
const { Authenticate } = require('@bdxi/node-beldex-api');
const pClient = new PublicClient();
const authClient = new Authenticate(api-key, secret, passphrase);

// get time
pClient.server().getTime();
// market list
pClient.market().list();
// market summary
pClient.market().summary(['BTCUSDT', 'ETHUSDT', 'BDXBTC']);
// market status
pClient.market().status('ETHBTC', 86400);
// total volume
pClient.market().totalVolume();
// market 24hrs-tickers
pClient.market().ticker('ETHBTC');
// market kline
pClient.market().kline({ market: "ETHBTC", start: 1577750400, end: 1577923200, interval: 86400 });
// market last
pClient.market().last('ETHBTC');
// market deals
pClient.market().deals('BDXBTC',1);
// get asset
pClient.asset().list('BTC');
// orderBook
pClient.trade().orderBook({ "market": "BDXBTC", "side": 2, "offset": 0, "limit": 2 });
// orderDepth
pClient.trade().orderDepth({ "market": "BDXBTC", "limit": 10, "interval": "1" });

// Private endpoints

// get balance
authClient.asset().getBalance(['ETH', 'BTC', 'USDT']);
// balance history
authClient.asset().balanceHistory({ 'asset': "ETH", 'start_time': 1576750273, 'end_time': 1577095873, 'offset': 0, 'limit': 10, 'type': 'deposit' });
// place limit order
authClient.trade().putLimit({ "market": "BDXBTC", "side": 1, "amount": "100", "price": "0.05", "source": "beldex exchange" });
// plca marker order
authClient.trade().putMarket({ "market": "BDXBTC", "side": 1, "amount": "100", "source": "beldex exchange" });
// order cancel
authClient.trade().orderCancel({ "market": "BDXBTC", "order_id": 84 });
// order pending asset
authClient.trade().orderPending({ "market": "BDXBTC", "offset": 0, "limit": 2, "user_id": 84 });
// order pending details
authClient.trade().orderPendingDetails({ "market": "BDXBTC", "order_id": 84 });
// order deals
authClient.trade().orderDeals({ "order_id": 84, "offset": 0, "limit": 3 });
// finished orders
authClient.trade().orderFinished({ "offset": 0, "limit": 3, "market": "BDXBTC", "start_time": 0, "end_time": 0 });
// finished order details
authClient.trade().finishedOrderDetails({ "order_id": 84 });

WebSocket

const { WebsocketClient } = require('@bdxi/node-beldex-api');
const wss = new WebsocketClient();

wss.connect();
wss.login(api-key, secret, passphrase);

// State subscription
wss.send({ "method": "state.subscribe", params: ["BDXBTC"] });
// deals subscription
wss.send({ "method": "deals.subscribe", params: ["BDXBTC"] });
// kline subscription
wss.send({ "method": "kline.subscribe", params: ["BDXBTC", 60] });
// depth subscription
wss.send({ "method": "depth.subscribe", "params": ["BDXUSDT", 50, '0'] });
// depth query
wss.send({ "method": "depth.query", params: ["BDXBTC", 50, '0'] });
// kline query
wss.send({ "method": "kline.query", "params": ["BDXBTC", 1575539107, 1580723167, 3600] });
// order query
wss.send({ "method": "order.query", params: ["BTCUSDT", 0, 50] });
// order history
wss.send({ "method": "order.history", "params": ["BDXBTC", 1580636703, 1580723103, 0, 50] });
// order subscription
wss.send({ "method": "order.subscribe", "params": ["BDXUSDT"] });
// asset query
wss.send({ "method": "asset.query", "params": ["BDX", "BTC"] });
// asset subscription
wss.send({ "method": "asset.subscribe", "params": ["BDX", "BTC"] });
Listen to subscription

All the subscriptions can be handled using onMessage function. The subscription can be differentiated using the method value from the response data.

wss.onMessage(data => {
    console.log(data);
});