BitMart REST JavaScript SDK example: spot-submit-order.ts

BitMart REST spot submit order JavaScript example for the Siebly BitMart SDK, covering exchange REST API and WebSocket integration, setup, and production SDK docs.

We use environment variables in our examples for API keys. It is your responsibility to manage and secure your keys appropriately.

examples/Bitmart/Rest/Spot/spot-submit-order.ts

What this example covers

  • BitMart REST API JavaScript example.
  • Uses the Siebly BitMart SDK package bitmart-api instead of hand-written HTTP request plumbing.
  • Source path: Bitmart/Rest/Spot/spot-submit-order.ts.
  • Example category: REST.
  • Imports SDK symbols including RestClient.
  • Calls SDK methods such as submitSpotOrder(), submitSpotOrderV2().

How to use this example

  • Start here for the specific request or stream pattern, then check the matching SDK guide for install, credentials, and operational notes.
  • Open the repository source when you need the latest committed version: GitHub source file.
import { RestClient } from 'bitmart-api'; const account = {  key: process.env.API_KEY || 'apiKeyHere',  secret: process.env.API_SECRET || 'apiSecretHere',  memo: process.env.API_MEMO || 'apiMemoHere',}; async function start() {  const client = new RestClient({    apiKey: account.key,    apiSecret: account.secret,    apiMemo: account.memo,  });   try {    // const usdValue = 6;    // const price = 52000;    // const qty = usdValue / price;     // const limitBuyOrder = {    //   symbol: 'BTC_USDT',    //   side: 'buy',    //   type: 'limit',    //   size: String(qty),    //   price: String(price),    // };     // const res = await client.submitSpotOrder({    //   symbol: 'BTC_USDT',    //   side: 'buy',    //   type: 'market',    //   size: String(qty),    // });     const res = await client.submitSpotOrderV2({      symbol: 'BTC_USDT',      side: 'sell',      type: 'market',      size: String(0.00011),    });    console.log('res ', JSON.stringify(res, null, 2));  } catch (e) {    console.error('Req error: ', e);  }} start(); 

Subscribe on Substack

Complete the Substack form below to join our newsletter. Substack handles all subscriber data directly.