Options
All
  • Public
  • Public/Protected
  • All
Menu

b2trader - v1.6.0

B2Trader CI GitHub version npm version Known Vulnerabilities Coverage Status code style: prettier semantic-release Conventional Commits GitHub top language node-current npm License

Node.js library for the B2Trader's API.

Installation

npm install b2trader

Usage

PublicClient

import { PublicClient } from "B2Trader";
const url = "https://api.b2bx.exchange:8443/trading"; // B2Trader's url
const client = new PublicClient({ url });
  • .getInstruments()
const instruments = await client.getInstruments();
  • .getAssets()
const assets = await client.getAssets();
  • .getListOfInstruments()
const instruments = await client.getListOfInstruments();
  • .getOrderBookSnapshot()
const instrument = "btc_usd";
const snapshot = await client.getOrderBookSnapshot({ instrument });
  • .getCandles()
const instrument = "btc_usd";
const startDate = "2020-01-24T07:26:04";
const endDate = "2020-09-29T07:26:04";
const type = "1m";
const count = 2;
const candles = await client.getCandles({
  instrument,
  startDate,
  endDate,
  type,
  count,
});
  • .getRootAsset()
const asset = await client.getRootAsset();
  • .getTiers()
const tiers = await client.getTiers();

Test

npm test