CopyTrader

Trader’s current order

Please refer to the official BingX API Docs for the Required parameters.

https://bingx-api.github.io/docs/#/en-us/copyTrade/trader-interface.html#Trader’s+current+order

Function Name:

getTradersCurrentOrder()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function getTradersCurrentOrder(exchange, options) {
    try {
        let result = await exchange.getTradersCurrentOrder(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getTradersCurrentOrder(myBingxExchange);

Traders close positions according to the order number

Function Name:

tradersClosePositionsByOrderNumber()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function tradersClosePositionsByOrderNumber(exchange, options) {
    try {
        let result = await exchange.tradersClosePositionsByOrderNumber(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await tradersClosePositionsByOrderNumber(myBingxExchange, {
	positionId: "<int64>",
	recvWindow: "<int64>"
});

Traders set take profit and stop loss based on order numbers

Function Name:

tradersSetTPSLByOrderNumber()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function tradersSetTPSLByOrderNumber(exchange, options) {
    try {
        let result = await exchange.tradersSetTPSLByOrderNumber(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await tradersSetTPSLByOrderNumber(myBingxExchange, {
	positionId: "<int64>",
	takeProfitMarkPrice: "<float64>",
	stopLossMarkPrice: "<float64>",
	recvWindow: "<int64>"
});

Trader sells spot assets based on buy order number

Function Name:

traderSellsSpotAssetsBasedOnBuyOrder()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myBingxExchange  = createExchange({
      exchange: "bingx",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "bingx"
  });

async function traderSellsSpotAssetsBasedOnBuyOrder(exchange, options) {
    try {
        let result = await exchange.traderSellsSpotAssetsBasedOnBuyOrder(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await traderSellsSpotAssetsBasedOnBuyOrder(myBingxExchange, {
	orderId: "<int64>"
});

Last updated