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);
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 placeOrderMargin(exchange, options) {
try {
let result = await exchange.placeOrderMarginrderMargin(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await placeOrderMargin(myMainPhemexExchange, {
symbol: "sBTCUSDT",
side: "Buy",
qtyType: "ByBase",
baseQtyRq: "1",
priceRp: "1000",
ordType: "Limit"
});
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 cancelOrderMargin(exchange, options) {
try {
let result = await exchange.cancelOrderMargin(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await cancelOrderMargin(myMainPhemexExchange, {
symbol: "sBTCUSDT",
orderID: "jwkndqwklqkdw"
});
Cancel all order by symbol
Function Name:
cancelAllOrdersMargin()
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function cancelAllOrdersMargin(exchange, options) {
try {
let result = await exchange.cancelAllOrdersMargin(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await cancelAllOrdersMargin(myMainPhemexExchange, {
symbol: "sBTCUSDT"
});
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 getOpenOrderMargin(exchange, options) {
try {
let result = await exchange.getOpenOrderMargin(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getOpenOrderMargin(myMainPhemexExchange, {
symbol: "sBTCUSDT",
orderID: "swjndklwndwdkmn"
});
Query all open orders by symbol
Function Name:
getAllOpenOrdersMargin()
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getAllOpenOrdersMargin(exchange, options) {
try {
let result = await exchange.getAllOpenOrdersMargin(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getAllOpenOrdersMargin(myMainPhemexExchange, {
symbol: "sBTCUSDT"
});
Query margin orders details
Function Name:
getMarginOrdersDetails()
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getMarginOrdersDetails(exchange, options) {
try {
let result = await exchange.getMarginOrdersDetails(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getMarginOrdersDetails(myMainPhemexExchange, {
});
Query margin order trades details
Function Name:
getMarginOrderTradesDetails()
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getMarginOrderTradesDetails(exchange, options) {
try {
let result = await exchange.getMarginOrderTradesDetails(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getMarginOrderTradesDetails(myMainPhemexExchange, {
});
Query margin borrow interest history
Function Name:
getMarginBorrowInterestHistory()
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getMarginBorrowInterestHistory(exchange, options) {
try {
let result = await exchange.getMarginBorrowInterestHistory(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getMarginBorrowInterestHistory(myMainPhemexExchange, {
});
Query margin borrow history records
Function Name:
getMarginBorrowHistory()
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getMarginBorrowHistory(exchange, options) {
try {
let result = await exchange.getMarginBorrowHistory(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getMarginBorrowHistory(myMainPhemexExchange, {
});
Query margin payback history
Function Name:
getMarginPaybackHistory()
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function getMarginPaybackHistory(exchange, options) {
try {
let result = await exchange.getMarginPaybackHistory(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getMarginPaybackHistory(myMainPhemexExchange, {
});
Post margin borrow request
Function Name:
Usage:
import { createExchange } from "./exchanges/exchange.js";
let myPhemexExchange = createExchange({
exchange: "phemex",
authenticate: "true",
key: "myKey",
secret: "mySecret",
label: "phemex"
});
async function marginBorrow(exchange, options) {
try {
let result = await exchange.marginBorrow(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await marginBorrow(myMainPhemexExchange, {
currency: "USDT",
amountRv: "100"
});
Post margin payback 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 marginPayback(exchange, options) {
try {
let result = await exchange.marginPayback(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await marginPayback(myMainPhemexExchange, {
currency: "USDT",
amountRv: "1"
});
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 getWalletsMargin(exchange, options) {
try {
let result = await exchange.getWalletsMargin(options);
console.log(result);
} catch (error) {
console.log(error.message);
}
}
let result = await getWalletsMargin(myMainPhemexExchange, {
});