Skip to main content

@coinset/bitmart

Universal BitMart API client

:children_crossing: This is not official

Public API

A request for an entry point that does not require authentication.

fetchContract

Get the latest market quotations of the contract. Docs

example:

import { fetchContract } from "https://deno.land/x/bitmart@$VERSION/mod.ts";
await fetchContract();

parameters:

type ContractOptions = {
  contractSymbol: string;
};

returns:

type ContractResponse = {
  code: 1000;
  trace: string;
  message: "OK";
  data: {
    tickers: {
      contract_symbol: string;
      last_price: number;
      index_price: number;
      last_funding_rate: number;
      price_change_percent_24h: number;
      volume_24h: number;
      url: string;
      high_price: number;
      low_price: number;
      legal_coin_price: number;
    }[];
  };
};

fetchCurrencies

Get a list of all cryptocurrencies on the platform. Docs

example:

import { fetchCurrencies } from "https://deno.land/x/bitmart@$VERSION/mod.ts";
await fetchCurrencies();

returns:

type CurrenciesResponse = {
  code: 1000;
  trace: string;
  message: "OK";
  data: {
    currencies: {
      id: string;
      name: string;
      withdraw_enabled: boolean;
      deposit_enabled: boolean;
    }[];
  };
};

fetchSymbols

Get a list of all trading pairs on the platform. Docs

example:

import { fetchSymbols } from "https://deno.land/x/bitmart@$VERSION/mod.ts";
await fetchSymbols();

returns:

type SymbolsResponse = {
  code: 1000;
  trace: string;
  message: "OK";
  data: {
    symbols: `${string}_${string}`[];
  };
};

fetchSymbolDetails

Get a detailed list of all trading pairs on the platform. Docs

example:

import { fetchSymbolDetails } from "https://deno.land/x/bitmart@$VERSION/mod.ts";
await fetchSymbolDetails();

returns:

type SymbolDetailsResponse = {
  code: 1000;
  trace: string;
  message: "OK";
  data: {
    symbols: {
      symbol: `${string}_${string}`;
      symbol_id: number;
      base_currency: string;
      quote_currency: string;
      quote_increment: number;
      base_min_size: number;
      base_max_size: number;
      price_min_precision: number;
      price_max_precision: number;
      expiration: "NA";
      min_buy_amount: number;
      min_sell_amount: number;
    }[];
  };
};

fetchTicker

Ticker is an overview of the market status of a trading pair, including the latest trade price, top bid and ask prices and 24-hour trading volume. Docs

example:

import { fetchTicker } from "https://deno.land/x/bitmart@$VERSION/mod.ts";
await fetchTicker({ symbol: "BTC_USDT" });

parameters:

type TickerOptions = {
  symbol: `${string}_${string}`;
};

returns:

type TickerResponse = {
  code: 1000;
  trace: string;
  message: "OK";
  data: {
    ticker: {
      symbol: `${string}_${string}`;
      last_price: number;
      quote_volume_24h: number;
      base_volume_24h: number;
      high_24h: number;
      low_24h: number;
      open_24h: number;
      close_24h: number;
      best_ask: number;
      best_ask_size: number;
      best_bid: number;
      best_bid_size: number;
      fluctuation: number;
      url: string;
    };
  };
};

fetchTickers

Ticker is an overview of the market status of a trading pair, including the latest trade price, top bid and ask prices and 24-hour trading volume. Docs

example:

import { fetchTickers } from "https://deno.land/x/bitmart@$VERSION/mod.ts";
await fetchTickers();

returns:

type TickersResponse = {
  code: 1000;
  trace: string;
  message: "OK";
  data: {
    tickers: {
      symbol: `${string}_${string}`;
      last_price: number;
      quote_volume_24h: number;
      base_volume_24h: number;
      high_24h: number;
      low_24h: number;
      open_24h: number;
      close_24h: number;
      best_ask: number;
      best_ask_size: number;
      best_bid: number;
      best_bid_size: number;
      fluctuation: number;
      url: string;
    }[];
  };
};