Margin Trading

Query product information

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

https://phemex-docs.github.io#query-product-information-4

Function Name:

getProductInfo()

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

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

https://phemex-docs.github.io/#place-order-http-put-prefered-4

Function Name:

placeOrderMargin()

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

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

https://phemex-docs.github.io#cancel-order-2

Function Name:

cancelOrderMargin()

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

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

https://phemex-docs.github.io#cancel-all-order-by-symbol-2

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

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

https://phemex-docs.github.io#query-open-order-by-order-id-or-client-order-id-2

Function Name:

getOpenOrderMargin()

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

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

https://phemex-docs.github.io#query-all-open-orders-by-symbol-2

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

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

https://phemex-docs.github.io#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

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

https://phemex-docs.github.io#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

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

https://phemex-docs.github.io#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

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

https://phemex-docs.github.io#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

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

https://phemex-docs.github.io#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

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

https://phemex-docs.github.io#post-margin-borrow-request

Function Name:

marginBorrow()

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

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

https://phemex-docs.github.io#post-margin-payback-history

Function Name:

marginPayback()

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

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

https://phemex-docs.github.io#query-wallets-2

Function Name:

getWalletsMargin()

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, {

     });

Last updated