Spot Account/Trade

Documentation on interacting with Mexc's Spot Account/Trade API functions through the PENDAX Javascript SDK.

User API default symbol

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#user-api-default-symbol

Function Name:

getSelfSymbolsSpot()

Usage:

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

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

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

let result = await getSelfSymbolsSpot(myMexcExchanges);

New Order

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#test-new-order

Function Name:

newOrderSpot()

Usage:

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

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

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

let result = await newOrderSpot(myMexcExchanges,
         {
              symbol: "MXUSDT",
              side: "BUY",
              type: "MARKET",
              quoteOrderQty: "8"
         });

Test New Order

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#new-order

Function Name:

testNewOrderSpot()

Usage:

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

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

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

let result = await testNewOrderSpot(myMexcExchanges,
         {
             symbol: "BTCUSDT",
             side: "BUY",
             type: "LIMIT",
             price: "20000",
             quantity: "0.0002"
         });

Cancel Order

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#batch-orders

Function Name:

cancelOrderSpot()

Usage:

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

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

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

let result = await cancelOrderSpot(myMexcExchanges,
         {
             symbol: "MXUSDT",
             orderId: "65f257f2b17f491393980f6e1a5a8331"
         });

Cancel all Open Orders on a Symbol

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#cancel-all-open-orders-on-a-symbol

Function Name:

cancelOpenOrdersSpot()

Usage:

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

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

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

let result = await cancelOpenOrdersSpot(myMexcExchanges,
         {
             symbol: "MXUSDT"
         });

Query Order

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#query-order

Function Name:

getOrderSpot()

Usage:

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

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

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

let result = await getOrderSpot(myMexcExchanges,
         {
             symbol: "MXUSDT",
             orderId: "65f257f2b17f491393980f6e1a5a8331"
         });

Current Open Orders

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#current-open-orders

Function Name:

getOpenOrdersSpot()

Usage:

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

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

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

let result = await getOpenOrdersSpot(myMexcExchanges,
         {
             symbol: "MXUSDT"
         });

All Orders

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#all-orders

Function Name:

getAllOrdersSpot()

Usage:

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

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

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

let result = await getAllOrdersSpot(myMexcExchanges,
         {
             symbol: "MXUSDT"
         });

Account Information

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#account-information

Function Name:

getSpotAccountInfo()

Usage:

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

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

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

let result = await getSpotAccountInfo(myMexcExchanges);

Account Trade List

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#account-trade-list

Function Name:

getAccountTradeListSpot()

Usage:

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

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

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

let result = await getAccountTradeListSpot(myMexcExchanges, {symbol: "MXUSDT"});

Enable MX Deduct

This function is currently under construction and may fail or give unexpected behavior

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#enable-mx-deduct

Function Name:

enableMxDeduct()

Usage:

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

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

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

let result = await enableMxDeduct(myMexcExchanges, {mxDeductEnable: "true"});

Query MX Deduct Status

This function is currently under construction and may fail or give unexpected behavior

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

https://mxcdevelop.github.io/apidocs/spot_v3_en/#query-mx-deduct-status

Function Name:

getMxDeductStatus()

Usage:

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

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

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

let result = await getMxDeductStatus(myMexcExchanges);

Last updated