Links

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

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)