Market
Documentation on interacting with Mexc's Market API functions through the PENDAX Javascript SDK.
Test Connectivity
Function Name:
testConnectivitySpot()
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myMexcExchanges = createExchange({
exchange: "mexc",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "mexc"
});
async function testConnectivitySpot(exchange, options) {
try {
let result = await exchange.testConnectivitySpot(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await testConnectivitySpot(myMexcExchanges);
Check Server Time
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myMexcExchanges = createExchange({
exchange: "mexc",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "mexc"
});
async function getServerTimeSpot(exchange, options) {
try {
let result = await exchange.getServerTimeSpot(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getServerTimeSpot(myMexcExchanges);
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);
Exchange Information
Function Name:
getExchangeInformationSpot()
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myMexcExchanges = createExchange({
exchange: "mexc",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "mexc"
});
async function getExchangeInformationSpot(exchange, options) {
try {
let result = await exchange.getExchangeInformationSpot(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getExchangeInformationSpot(myMexcExchanges, {symbol: "BTCUSDT"});
Order Book
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myMexcExchanges = createExchange({
exchange: "mexc",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "mexc"
});
async function getOrderBookSpot(exchange, options) {
try {
let result = await exchange.getOrderBookSpot(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getOrderBookSpot(myMexcExchanges,
{
symbol: "BTCUSDT"
});
Recent Trades List
Function Name:
getRecentTradesListSpot()
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myMexcExchanges = createExchange({
exchange: "mexc",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "mexc"
});
async function getRecentTradesListSpot(exchange, options) {
try {
let result = await exchange.getRecentTradesListSpot(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getRecentTradesListSpot(myMexcExchanges,
{
symbol: "BTCUSDT"
});
Compressed/Aggregate Trades List
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myMexcExchanges = createExchange({
exchange: "mexc",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "mexc"
});
async function getAggTradesSpot(exchange, options) {
try {
let result = await exchange.getAggTradesSpot(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getAggTradesSpot(myMexcExchanges,
{
symbol: "BTCUSDT"
});
Kline/Candlestick Data
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myMexcExchanges = createExchange({
exchange: "mexc",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "mexc"
});
async function getKlinesSpot(exchange, options) {
try {
let result = await exchange.getKlinesSpot(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getKlinesSpot(myMexcExchanges,
{
symbol: "BTCUSDT",
interval: "15m"
});
Current Average Price
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myMexcExchanges = createExchange({
exchange: "mexc",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "mexc"
});
async function getAvgPriceSpot(exchange, options) {
try {
let result = await exchange.getAvgPriceSpot(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getAvgPriceSpot(myMexcExchanges,
{
symbol: "BTCUSDT"
});
24hr Ticker Price Change Statistics
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myMexcExchanges = createExchange({
exchange: "mexc",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "mexc"
});
async function get24HrTickerSpot(exchange, options) {
try {
let result = await exchange.get24HrTickerSpot(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await get24HrTickerSpot(myMexcExchanges);
Symbol Price Ticker
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myMexcExchanges = createExchange({
exchange: "mexc",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "mexc"
});
async function getPriceTickerSpot(exchange, options) {
try {
let result = await exchange.getPriceTickerSpot(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getPriceTickerSpot(myMexcExchanges);
Symbol Order Book Ticker
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myMexcExchanges = createExchange({
exchange: "mexc",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "mexc"
});
async function getBookTickerSpot(exchange, options) {
try {
let result = await exchange.getBookTickerSpot(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getBookTickerSpot(myMexcExchanges);