Spot Account/Trade
Documentation on interacting with Mexc's Spot Account/Trade API functions through the PENDAX Javascript SDK.
User API default symbol
Function Name:
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
Function Name:
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
Function Name:
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
Function Name:
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
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
Function Name:
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
Function Name:
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
Function Name:
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
Function Name:
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
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
Function Name:
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
Function Name:
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);