Query product information
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getProductInfo(exchange, options) {
try {
let result = await exchange.getProductInfo(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getProductInfo(myMainPhemexExchange);
Query server time
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getServerTime(exchange, options) {
try {
let result = await exchange.getServerTime(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getServerTime(myPhemexExchange);
Place order
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function amendOrder(exchange, options) {
try {
let result = await exchange.amendOrder(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await placeOrder(myPhemexExchange, {
symbol: "sBTCUSDT",
side: "Buy",
qtyType:"ByBase",
baseQtyEv: "1000000000",
ordType: "Limit",
priceEp: "2000000000"
});
Amend order
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function amendOrder(exchange, options) {
try {
let result = await exchange.amendOrder(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await amendOrder(myPhemexExchange, {
symbol: "sBTCUSDT",
orderID: "abb9f72f-2b97-4e96-acaa-2a2a6f9453a4",
priceRp: "200",
});
Cancel order
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function cancelOrder(exchange, options) {
try {
let result = await exchange.cancelOrder(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await cancelOrder(myPhemexExchange, {
symbol: "sBTCUSDT",
orderID: "abb9f72f-2b97-4e96-acaa-2a2a6f9453a4"
});
Cancel all order by symbol
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function cancelAllOrders(exchange, options) {
try {
let result = await exchange.cancelAllOrders(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await cancelAllOrders(myPhemexExchange);
Query open order by order ID or client order ID
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getOpenOrderActive(exchange, options) {
try {
let result = await exchange.getOpenOrderActive(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getOpenOrderActive(myPhemexExchange, {
orderID: "c3cf42ee-49ac-41a3-b092-1905062e813a",
symbol: "sBTCUSDT"
});
Query all open orders by symbol
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getOpenOrders(exchange, options) {
try {
let result = await exchange.getOpenOrders(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getOpenOrders(myPhemexExchange, {
symbol: "sBTCUSDT"
});
Query wallets
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getWallets(exchange, options) {
try {
let result = await exchange.getWallets(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getWallets(myMainPhemexExchange, {
});
Query orders by order ID or client order ID
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getOrder(exchange, options) {
try {
let result = await exchange.getOrder(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getOrderHistory(myPhemexExchange, {
symbol: "sBTCUSDT"
});
Query order history
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getOrderHistory(exchange, options) {
try {
let result = await exchange.getOrderHistory(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getOrderHistory(myPhemexExchange, {
symbol: "sBTCUSDT"
});
Query trade history
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getTradesHistory(exchange, options) {
try {
let result = await exchange.getTradesHistory(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getTradesHistory(myPhemexExchange, {
symbol: "sBTCUSDT"
});
Query PnL
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getPnL(exchange, options) {
try {
let result = await exchange.getPnL(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getPnL(myPhemexExchange);
Query chain information
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getChainInfo(exchange, options) {
try {
let result = await exchange.getChainInfo(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getChainInfo(myPhemexExchange, {currency: "BTC"});
Query deposit address by currency
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getDepositAddress(exchange, options) {
try {
let result = await exchange.getDepositAddress(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getDepositAddress(myPhemexExchange, {
currency: "BTC",
chainName: "BTC"
});
Query recent deposit history
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getDepositHistory(exchange, options) {
try {
let result = await exchange.getDepositHistory(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getDepositHistory(myPhemexExchange, {
currency: "BTC"
});
Query recent withdraw history
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getWithdrawHistory(exchange, options) {
try {
let result = await exchange.getWithdrawHistory(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getWithdrawHistory(myPhemexExchange, {
currency: "BTC"
});
Query funds history
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getFundsHistory(exchange, options) {
try {
let result = await exchange.getFundsHistory(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getFundsHistory(myPhemexExchange, {
currency: "USDT"
});
Query fee rate by quote currency
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getFeeRate(exchange, options) {
try {
let result = await exchange.getFeeRate(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getFeeRate(myPhemexExchange, {
quoteCurrency: "USDT"
});
Query order book
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getOrderBook(exchange, options) {
try {
let result = await exchange.getOrderBook(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getOrderBook(myPhemexExchange, {
symbol: "sBTCUSDT"
});
Query full order book
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getOrderBookFull(exchange, options) {
try {
let result = await exchange.getOrderBookFull(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getOrderBookFull(myPhemexExchange, {
symbol: "sBTCUSDT"
});
Query recent trades
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getRecentTrades(exchange, options) {
try {
let result = await exchange.getRecentTrades(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getRecentTrades(myPhemexExchange, {
symbol: "sBTCUSDT"
});
Query 24 hours ticker for all symbols
Function Name:
get24HourTickerAllSymbols()
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function get24HourTickerAllSymbols(exchange, options) {
try {
let result = await exchange.get24HourTickerAllSymbols(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await get24HourTickerAllSymbols(myPhemexExchange);
Query 24 hours ticker
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function get24HourTicker(exchange, options) {
try {
let result = await exchange.get24HourTicker(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await get24HourTickerAllSymbols(myPhemexExchange);