b2trader
TypeScript icon, indicating that this package has built-in type declarations

1.6.0 • Public • Published

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

Package Sidebar

Install

npm i b2trader

Weekly Downloads

7

Version

1.6.0

License

AGPL-3.0

Unpacked Size

50.8 kB

Total Files

10

Last publish

Collaborators

  • b2broker-manager