Compendium Trading Tools Documentation
CompendiumPENDAXCompendexOfficial Links
  • ⭐Platform Overview
  • ⚫PENDAX
    • 🌐What is PENDAX?
    • 🖱️PENDAX Capabilities
    • 💾Installing PENDAX modules
    • 💡Using PENDAX SDK
      • 💻Common Functions
      • 💻OKX Functions
        • Trading & Orders
        • Funding
        • Convert
        • Account & Subaccount
        • Grid Trading
        • Market Data
        • Public Data
        • Trading Data
      • 💻Bitget Functions
        • Public (Spot)
        • Market (Spot)
        • Wallet (Spot)
        • Account (Spot)
        • Trade (Spot)
        • Market (Futures)
        • Account (Futures)
        • Trade (Futures)
        • CopyTrade (Futures)
        • Sub Account Interface (Broker)
        • Sub API Interface (Broker)
      • 💻ByBit Functions
        • Market
        • Trading
        • Position
        • Account
        • Asset
        • User
        • Spot Leverage Token
        • Spot Margin Trade (UTA)
        • Spot Margin Trade (Normal)
        • Institutional Lending
      • 💻Mexc Functions
        • Market
        • Sub-Account
        • Spot Account/Trade
        • Wallet
        • ETF
        • Rebate
        • Futures Market
        • Futures Account and Trading
      • 💻Phemex Functions
        • Contract
        • Hedged Contract
        • Spot
        • Margin Trading
        • Transfer
        • Convert
        • Deposit And Withdraw
      • 💻BloFin Functions
        • Websocket
        • Account
        • Affiliate
        • Public Data
        • Trading
        • User
      • 💻BingX Functions
        • Fund Account
        • Wallet Deposits and Withdrawals
        • Sub-Account Managenent
        • Market Data (USDT-M)
        • Account (USDT-M)
        • Trades (USDT-M)
        • Market Data (Coin-M)
        • Trades (Coin-M)
        • Market Data (Spot)
        • Fund Account (Spot)
        • Trades (Spot)
        • CopyTrader
      • ⚠️FTX Functions
    • 📜License Agreement
  • 🟣Compendium App
    • 📈Compendium Trading Tools
    • 🔗Connect An Exchange Account
      • 🗝️OKX.com API Keys
    • 🤖Verified Trading Bots
      • Explore The Marketplace
      • For Algo & Strategy Authors
        • Get Listed & Verified
        • Strategy Monetization
        • Sending Trading Signals
        • Simplified Signal Program
      • For Users & Subscribers
        • Subscribing To Bots
        • Managing A Subscription
    • 💫Copy Trading Groups
      • For Copy Group Leaders
        • Creating A Copy Group
        • Linking Leader Account
        • Important Trading Notes
        • Manage A Copy Group
        • Discord Webhooks Setup
      • For Users & Subscribers
        • Subscribe To Copy Group
        • Link Account To Group
    • 📶Signal Provider Groups
      • For Group Leaders
        • Creating A Signal Group
        • Managing A Signal Group
        • Sending Trading Signals
      • For Users & Subscribers
        • Subscribing To Signal Groups
        • Manage Signal Group Subscription
  • 🔵Compendex Suite
    • 🔮DeFi With Compendex
    • ☀️Solana Integrations
      • Supported Solana Wallets
      • Overview And News
      • Openbook Spot Markets
      • Smart Swap Aggregator
      • NFT Metaverse Markets
      • Solana DeFi Analytics Portal
      • Community Tools List
  • 🪙The CMFI Token Ecosystem
    • 📊Tokenomics Breakdown
    • 🍎Trade Incentive Program
    • 🌊Staking And Liquidity Pools
      • ✨Raydium Liquidity Pools
      • 🐳Orca Liquidity Whirlpools
      • 🐋Orca Liquidity Pools
    • 🐷Compendi-Pigs NFT
  • 👥Community Info
    • ✅Links And Social Pages
    • 🎨Branding Guidelines
Powered by GitBook
On this page
  • Query product information
  • Place order
  • Cancel order
  • Cancel all order by symbol
  • Query open order by order ID or client order ID
  • Query all open orders by symbol
  • Query margin orders details
  • Query margin order trades details
  • Query margin borrow interest history
  • Query margin borrow history records
  • Query margin payback history
  • Post margin borrow request
  • Post margin payback history
  • Query wallets
  1. PENDAX
  2. Using PENDAX SDK
  3. Phemex Functions

Margin Trading

PreviousSpotNextTransfer

Last updated 1 year ago

Query product information

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

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

     });

⚫
💡
💻
https://phemex-docs.github.io#query-product-information-4
https://phemex-docs.github.io/#place-order-http-put-prefered-4
https://phemex-docs.github.io#cancel-order-2
https://phemex-docs.github.io#cancel-all-order-by-symbol-2
https://phemex-docs.github.io#query-open-order-by-order-id-or-client-order-id-2
https://phemex-docs.github.io#query-all-open-orders-by-symbol-2
https://phemex-docs.github.io#query-margin-orders-details
https://phemex-docs.github.io#query-margin-order-trades-details
https://phemex-docs.github.io#query-margin-borrow-interest-history
https://phemex-docs.github.io#query-margin-borrow-history-records
https://phemex-docs.github.io#query-margin-payback-history
https://phemex-docs.github.io#post-margin-borrow-request
https://phemex-docs.github.io#post-margin-payback-history
https://phemex-docs.github.io#query-wallets-2