Hedged Contract

Query product information

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

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

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-2

Function Name:

placeOrderHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function placeOrderHedged(exchange, options) {
    try {
        let result = await exchange.placeOrderHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await placeOrderHedged(myPhemexExchange, {
        symbol: "BTCUSDT", 
        side: "Buy", 
        posSide: "Long",
        orderQtyRq: "0.01",
        ordType: "Limit",
        priceRp: "20000"
    });

Amend order by orderID

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

https://phemex-docs.github.io#amend-order-by-orderid

Function Name:

amendOrderHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function amendOrderHedged(exchange, options) {
    try {
        let result = await exchange.amendOrderHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await amendOrderHedged(myPhemexExchange, {
         symbol: "BTCUSDT", 
         orderID: "9839ae8f-88e7-431f-94a4-dd8d3312b382",
         priceRp: "21000",
         posSide: "Buy",
         orderQtyRq: "0.02"

     });

Cancel Single Order by orderID

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

https://phemex-docs.github.io#cancel-single-order-by-orderid

Function Name:

cancelOrderHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function cancelOrderHedged(exchange, options) {
    try {
        let result = await exchange.cancelOrderHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await cancelOrderHedged(myPhemexExchange, {
         symbol: "BTCUSDT",
         posSide: "Sell",
         orderID: "9839ae8f-88e7-431f-94a4-dd8d3312b382"
     });

Bulk Cancel Orders

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

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

Function Name:

cancelBatchOrderHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function cancelBatchOrderHedged(exchange, options) {
    try {
        let result = await exchange.cancelBatchOrderHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await cancelBatchOrderHedged(myMainPhemexExchange, {
        symbol: "BTCUSDT",
        orderID: "234fsfs3,d2123dada2",
        posSide: "Buy"
     });

Cancel All Orders

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

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

Function Name:

cancelAllOrdersHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function cancelAllOrdersHedged(exchange, options) {
    try {
        let result = await exchange.cancelAllOrdersHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await cancelAllOrdersHedged(myPhemexExchange, {});

Query Account Positions

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

https://phemex-docs.github.io#query-account-positions

Function Name:

getAccountPositionsHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getAccountPositionsHedged(exchange, options) {
    try {
        let result = await exchange.getAccountPositionsHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getAccountPositionsHedged(myMainPhemexExchange, {
         currency: "USDT"
     });

Query Account Positions with unrealized PNL

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

https://phemex-docs.github.io#query-account-positions-with-unrealized-pnl

Function Name:

getAccountPositionsUnPnLHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getAccountPositionsUnPnLHedged(exchange, options) {
    try {
        let result = await exchange.getAccountPositionsUnPnLHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getAccountPositionsUnPnLHedged(myPhemexExchange, {
         currency: "BTC"
     });

Switch Position Mode Synchronously

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

https://phemex-docs.github.io#switch-position-mode-synchronously

Function Name:

switchPositionModeSynchronously()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function switchPositionModeSynchronously(exchange, options) {
    try {
        let result = await exchange.switchPositionModeSynchronously(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await switchPositionModeSynchronously(myPhemexExchange, {
         symbol: "BTCUSDT",
         targetPosMode: "Hedged"
     });

Set Leverage

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

https://phemex-docs.github.io#set-leverage-2

Function Name:

setLeverageHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function setLeverageHedged(exchange, options) {
    try {
        let result = await exchange.setLeverageHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await setLeverageHedged(myPhemexExchange, {
         symbol: "BTCUSDT",
         leverageRr: "-10"
     });

Set RiskLimit

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

https://phemex-docs.github.io#set-risklimit

Function Name:

setRiskLimitHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function setRiskLimitHedged(exchange, options) {
    try {
        let result = await exchange.setRiskLimitHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await setRiskLimitHedged(myPhemexExchange, {
         symbol: "BTCUSDT",
         riskLimitRv: "10",
         posSide: "Buy"
     });

Query open orders by symbol

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

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

Function Name:

getOpenOrdersHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getOpenOrdersHedged(exchange, options) {
    try {
        let result = await exchange.getOpenOrdersHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getOpenOrdersHedged(myPhemexExchange, {
         symbol: "BTCUSDT"
     });

Query closed orders by symbol

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

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

Function Name:

getClosedOrdersHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getClosedOrdersHedged(exchange, options) {
    try {
        let result = await exchange.getClosedOrdersHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getClosedOrdersHedged(myPhemexExchange, {
         currency: "USDT"
     });

Query user trade

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

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

Function Name:

getUserTradeHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getUserTradeHedged(exchange, options) {
    try {
        let result = await exchange.getUserTradeHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getUserTradeHedged(myPhemexExchange, {
         currency: "USDT",
         offset: "0",
         limit: "10"
     });

Query Order Book

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

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

Function Name:

getOrderBookHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getOrderBookHedged(exchange, options) {
    try {
        let result = await exchange.getOrderBookHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getOrderBookHedged(myPhemexExchange, {
         symbol: "BTCUSDT"
     });

Query kline

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

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

Function Name:

getKlineHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getKlineHedged(exchange, options) {
    try {
        let result = await exchange.getKlineHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getKlineHedged(myPhemexExchange, {
         symbol: "BTCUSDT",
         resolution: "60"
     });

Query Trade

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

https://phemex-docs.github.io#query-trade

Function Name:

getTradeHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getTradeHedged(exchange, options) {
    try {
        let result = await exchange.getTradeHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getTradeHedged(myPhemexExchange, {
         symbol: "BTCUSDT"
     });

Query 24 ticker

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

https://phemex-docs.github.io#query-24-ticker

Function Name:

get24HourTickerHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function get24HourTickerHedged(exchange, options) {
    try {
        let result = await exchange.get24HourTickerHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await get24HourTickerHedged(myPhemexExchange, {
         symbol: "BTCUSDT"
     });

Query 24 ticker for all symbols

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

https://phemex-docs.github.io#query-24-ticker-for-all-symbols

Function Name:

get24HourTickerAllSymbolsHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function get24HourTickerAllSymbolsHedged(exchange, options) {
    try {
        let result = await exchange.get24HourTickerAllSymbolsHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await get24HourTickerAllSymbolsHedged(myPhemexExchange);

Query Orders History

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

https://phemex-docs.github.io#query-orders-history

Function Name:

getOrdersHistoryHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getOrdersHistoryHedged(exchange, options) {
    try {
        let result = await exchange.getOrdersHistoryHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getOrdersHistoryHedged(myPhemexExchange, {
         symbol: "BTCUSDT"
     });

Query Orders By Ids

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

https://phemex-docs.github.io#query-orders-by-ids

Function Name:

getOrdersByIdHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getOrdersByIdHedged(exchange, options) {
    try {
        let result = await exchange.getOrdersByIdHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getOrdersByIdHedged(myPhemexExchange, {
         symbol: "BTCUSDT",
         orderID: "9839ae8f-88e7-431f-94a4-dd8d3312b382"
     });

Query Trades History

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

https://phemex-docs.github.io#query-trades-history

Function Name:

getTradeHistoryHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getTradeHistoryHedged(exchange, options) {
    try {
        let result = await exchange.getTradeHistoryHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getTradeHistoryHedged(myPhemexExchange, {currency:"BTC", symbol: "BTCUSDT"});

Query funding rate history

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

https://phemex-docs.github.io#query-funding-rate-history-2

Function Name:

getFundingRateHistoryHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getFundingRateHistoryHedged(exchange, options) {
    try {
        let result = await exchange.getFundingRateHistoryHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getFundingRateHistoryHedged(myPhemexExchange, {symbol: ".ETHUSDTFR8H"});

Query funding fee history

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

https://phemex-docs.github.io#query-funding-fee-history-2

Function Name:

getFundingFeeHistoryHedged()

Usage:

import { createExchange } from "./exchanges/exchange.js";

   let myPhemexExchange  = createExchange({
      exchange: "phemex",
      authenticate: "true",
      key: "myKey",
      secret: "mySecret",
      label: "phemex"
  });

async function getFundingFeeHistoryHedged(exchange, options) {
    try {
        let result = await exchange.getFundingFeeHistoryHedged(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

let result = await getFundingFeeHistoryHedged(myPhemexExchange, {symbol: "BTCUSDT"});

Last updated