Node.js library for the B2Trader's API.
npm install b2trader
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();
npm test