Example: rest-usdm-order.ts

Static snapshot for Binance/Rest/Futures/rest-usdm-order.ts.

Example Path

Binance/Rest/Futures/rest-usdm-order.ts

Source Link

Repository source: https://github.com/sieblyio/crypto-api-examples/blob/master/examples/Binance/Rest/Futures/rest-usdm-order.ts

Code Snapshot

import { USDMClient } from 'binance';

const key = process.env.API_KEY_COM || 'APIKEY';
const secret = process.env.API_SECRET_COM || 'APISECRET';

const client = new USDMClient({
  api_secret: secret,
  api_key: key,
  beautifyResponses: true,
});

async function start() {
  try {
    // To open a short position - if you don't have a position yet, and your account is set to one-way mode, just place a sell order to open a short position
    const result = await client.submitNewOrder({
      side: 'SELL',
      symbol: 'BTCUSDT',
      type: 'MARKET',
      quantity: 0.001,
      // newOrderRespType: 'FULL',
    });

    console.log('market sell result: ', result);
  } catch (e) {
    console.error('market sell failed: ', e);
  }
}

start();

This is a static, crawlable snapshot. The interactive app loads after JavaScript starts and can refresh live data.