Account (Futures)

Documentation on interacting with Bitget's Futures Market Account API functions through the PENDAX Javascript SDK.

Get Single Account

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

https://bitgetlimited.github.io/apidoc/en/mix/#get-single-account

Function name:

getSingleAccountFutures(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 getSingleAccountFutures(exchange, options) {
    try {
        let result = await exchange.getSingleAccountFutures(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

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

Get Account List

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

https://bitgetlimited.github.io/apidoc/en/mix/#get-account-list

Function name:

getAccountListFutures(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 getAccountListFutures(exchange, options) {
    try {
        let result = await exchange.getAccountListFutures(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await getAccountListFutures(myBitgetAccount, 
    {
        productType: "umcbl"
    });

Get Sub-Account Contract Assets

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

https://bitgetlimited.github.io/apidoc/en/mix/#get-sub-account-contract-assets

Function name:

getSubaccountContractAssets(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 getSubaccountContractAssets(exchange, options) {
    try {
        let result = await exchange.getSubaccountContractAssets(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await getSubaccountContractAssets(myBitgetAccount, 
    {
        productType: "umcbl"
    });

Get Open Count

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

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

Function name:

getOpenCountFutures(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 getOpenCountFutures(exchange, options) {
    try {
        let result = await exchange.getOpenCountFutures(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await getOpenCountFutures(myBitgetAccount, 
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        openPrice: "23189.5",
        leverage: "20",
        openAmount:"5000"
    });

Change Leverage

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

https://bitgetlimited.github.io/apidoc/en/mix/#change-leverage

Function name:

setLeverage(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 setLeverage(exchange, options) {
    try {
        let result = await exchange.setLeverage(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await setLeverage(myBitgetAccount, 
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        leverage: "2"
    });

Change Margin

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

https://bitgetlimited.github.io/apidoc/en/mix/#change-margin

Function name:

getApiKeyInfo(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 changeMargin(exchange, options) {
    try {
        let result = await exchange.changeMargin(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await changeMargin(myBitgetAccount, 
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        amount: "-10"
    });

Change Margin Mode

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

https://bitgetlimited.github.io/apidoc/en/mix/#change-margin-mode

Function name:

setMarginMode(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 setMarginMode(exchange, options) {
    try {
        let result = await exchange.setMarginMode(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await setMarginMode(myBitgetAccount, 
    {
        symbol: "BTCUSDT_UMCBL",
        marginCoin: "USDT",
        marginMode: "crossed"
    });

Change Hold Mode

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

https://bitgetlimited.github.io/apidoc/en/mix/#change-hold-mode

Function name:

changeHoldMode(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 changeHoldMode(exchange, options) {
    try {
        let result = await exchange.changeHoldMode(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await changeHoldMode(myBitgetAccount, 
    {
        productType: "umcbl",
        holdMode: "double_hold"
    });

Get Symbol Position

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

https://bitgetlimited.github.io/apidoc/en/mix/#get-symbol-position

Function name:

getSymbolPosition(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 getSymbolPosition(exchange, options) {
    try {
        let result = await exchange.getSymbolPosition(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

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

Get All Position

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

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

Function name:

getAllPositionsFutures(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 getAllPositionsFutures(exchange, options) {
    try {
        let result = await exchange.getAllPositionsFutures(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

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

Get Account Bill

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

https://bitgetlimited.github.io/apidoc/en/mix/#get-account-bill

Function name:

getAccountBill(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 getAccountBill(exchange, options) {
    try {
        let result = await exchange.getAccountBill(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

const result = await getAccountBill(myBitgetAccount, 
    {
        symbol: "BTCUSDT_UMCBL", 
        marginCoin: "USDT",
        startTime: "1659403328000",
        endTime: "1659406928000",
        pageSize: "20"
    });

Get Business Account Bill

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

https://bitgetlimited.github.io/apidoc/en/mix/#get-business-account-bill

Function name:

getBusinessAccountBill(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 getBusinessAccountBill(exchange, options) {
    try {
        let result = await exchange.getBusinessAccountBill(options);
        console.log(result);
    } catch (error) {
        console.log(error.message);
    }
}

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

Last updated