Trade (Futures)

Documentation on interacting with Bitget's Futures Trading & Order API functions through the PENDAX Javascript SDK.

Place Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#place-order

Function name:

placeOrderFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt",
      testnet: "false"
});

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

const result = await placeOrderFutures(myBitgetAccount, 
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        size: "0.01",
        side: "open_long",
        orderType: "market"
    });

Batch Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#batch-order

Function name:

placeBatchOrderFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await placeBatchOrderFutures(myBitgetAccount, 
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        orderDataList:[
      {
          size: "0.003",
          side: "open_long",
          orderType: "limit",
          price: "10000"

      },
      {
          size: "0.004",
          side: "open_long",
          orderType: "limit",
          price: "10000"
      }]
    });

Cancel Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#cancel-order

Function name:

cancelOrderFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await cancelOrderFutures(myBitgetAccount
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        orderId: "1009818807293329409"
    });

Batch Cancel Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#batch-cancel-order

Function name:

cancelBatchOrdersFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await cancelBatchOrdersFutures(myBitgetAccount,
    {
      symbol: "BTCUSDT_UMCBL",
      marginCoin: "USDT",
      orderIds:["1011271303899529219", "1011271303903723526"]
    });

Cancel All Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#cancel-all-order

Function name:

cancelAllOrdersFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await cancelAllOrdersFutures(myBitgetAccount,
    {
        productType: "umcbl",
        marginCoin: "USDT"
    });

Get Open Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#get-open-order

Function name:

getOpenOrdersFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getOpenOrdersFutures(myBitgetAccount, 
    {
        symbol: "BTCUSDT_UMCBL"
    });

Get All Open Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#get-all-open-order

Function name:

getAllOpenOrdersFutures()

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getAllOpenOrdersFutures(myBitgetAccount,
    {
        productType: "umcbl",
        marginCoin: "USDT"
    });

Get History Orders

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#get-history-orders

Function name:

getOrdersHistoryFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getOrdersHistoryFutures(myBitgetAccount,
    {
        symbol: "BTCUSDT_UMCBL",
        startTime: "1659403328000", 
        endTime: "1659410528000",
        pageSize: "20"
    });

Get ProductType History Orders

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#get-producttype-history-orders

Function name:

getOrdersHistoryByProductTypeFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getOrdersHistoryByProductTypeFutures(myBitgetAccount,
    {
        productType: "umcbl",
        startTime: "1659403328000", 
        endTime: "1659410528000",
        pageSize: "20"
    });

Get Order Details

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#get-order-details

Function name:

getOrderDetailsFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getOrderDetailsFutures(myBitgetAccount, 
    {
        symbol: "BTCUSDT_UMCBL",
        orderId: "12345"
    });

Get Order Fill Details

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#get-order-fill-detail

Function name:

getOrderFillDetailFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getOrderFillDetailFutures(myBitgetAccount,
    {
      symbol: "BTCUSDT_UMCBL",
      startTime: "1659403328000", 
      orderId: "1010182528922435618"
  });

Get ProductType Order Fill Details

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#get-producttype-order-fill-detail

Function name:

getProductTypeOrderFillDetailFutures(options)

Usage:

API requires either endTime and startTime or lastEndId as parameters

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getProductTypeOrderFillDetailFutures(myBitgetAccount,
    {
        productType: "umcbl",
        startTime: "0",
        endTime: "1676832767000"
    });

Place Plan Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#place-plan-order

Function name:

placePlanOrderFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await placePlanOrderFutures(myBitgetAccount, 
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        size: "0.05",
        side: "open_long",
        orderType: "market",
        triggerPrice: "22000",
        triggerType: "market_price"
    });

Modify Plan Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#modify-plan-order

Function name:

modifyPlanOrderFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await modifyPlanOrderFutures(myBitgetAccount,
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        orderId: "12345",
        side: "open_long",
        orderType: "market",
        triggerPrice: "21000",
        triggerType: "market_price"
    });

Modify Plan Order TPSL

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#modify-plan-order-tpsl

Function name:

modifyPlanOrderTpslFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await modifyPlanOrderTpslFutures(myBitgetAccount,
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        orderId: "12345"
    });

Place Stop Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#place-stop-order

Function name:

placeStopOrderFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await placeStopOrderFutures(myBitgetAccount,
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        size: "0.001",
        planType: "profit_plan",
        triggerPrice:"23555.5",
        holdSide:"long"
    });  

Place Trailing Stop Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#place-trailing-stop-order

This function is under construction

Function name:

placeTrailingStopOrderFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await placeTrailingStopOrderFutures(myBitgetAccount,
    {
      symbol: "BTCUSDT_UMCBL",
      marginCoin: "USDT",
      triggerPrice:"22000",
      holdSide: "long",
      rangeRate: "1"
  });  

Place Position TPSL

This Function is currently under construction

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#place-position-tpsl

Function name:

placePositionTpslFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await placePositionTpslFutures(myBitgetAccount,
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        planType: "pos_profit",
        triggerPrice:"24720",
        holdSide:"long"
    });

Modify Stop Order

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#modify-stop-order

Function name:

modifyStopOrderFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await modifyStopOrderFutures(myBitgetAccount,
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        orderId: "1010239532700766209",
        planType: "pos_profit",
        triggerPrice:"24620",
        holdSide:"long"
    });  

Cancel Plan Order TPSL

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#cancel-plan-order-tpsl

Function name:

cancelPlanOrderTpslFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await cancelPlanOrderTpslFutures(myBitgetAccount,
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        orderId: "1010239532700766209",
        planType: "pos_profit"
        
    });  

Cancel All Trigger Order TPSL

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#cancel-all-trigger-order-tpsl

Function name:

cancelAllTriggerOrdersTpslFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await cancelAllTriggerOrdersTpslFutures(myBitgetAccount,
    {
        productType: "umcbl",
        planType: "pos_profit"
        
    });  

Get Plan Order TPSL List

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#get-plan-order-tpsl-list

Function name:

getPlanOrderListTpslFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getPlanOrderListTpslFutures(myBitgetAccount,
    {
        symbol: "BTCUSDT_UMCBL"
    });

Get History Plan Orders TPSL

Please refer to the official Bitget API Docs for the required parameters.

https://bitgetlimited.github.io/apidoc/en/mix/#get-history-plan-orders-tpsl

Function name:

getHistoryPlanOrdersTpslFutures(options)

Usage:

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getHistoryPlanOrdersTpslFutures(myBitgetAccount,
    {
        symbol: "BTCUSDT_UMCBL",
        startTime: "1659403328000", 
        endTime: "1659410528000",
        pageSize: "20"
    });

Last updated