User

Documentation on interacting with ByBit's User API functions through the PENDAX Javascript SDK.

All parameters of type INTEGER listed in the Bybit API docs need to be passed in as a string.

Create Sub UID

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

https://bybit-exchange.github.io/docs/v5/user/create-subuid

Function name:

createSubUid(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

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

const result = await createSubUid(myByBitAccount, 
    {
        username: "bill",
        memberType: "1"
    });

Create Sub UID API Key

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

https://bybit-exchange.github.io/docs/v5/user/create-subuid-apikey

Function name:

createSubUidApiKey(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

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

const result = await createSubUidApiKey(myByBitAccount, 
    {
       subuid: "62874117",
       readOnly: "0",
       permissions: {
           Spot: ["SpotTrade"]
       }
   });

Get Sub UID List

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

https://bybit-exchange.github.io/docs/v5/user/subuid-list

Function name:

getSubUidList(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

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

const result = await getSubUidList(myByBitAccount);

Freeze Sub UID

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

https://bybit-exchange.github.io/docs/v5/market/preimum-index-kline

Function name:

freezeSubUid(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

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

const result = await freezeSubUid(myByBitAccount, 
    {
       subuid: "62874117",
       frozen: "1"
     });

Get API Key Information

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

https://bybit-exchange.github.io/docs/v5/user/apikey-info

Function name:

getApiKeyInfo(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

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

const result = await getApiKeyInfo(myByBitAccount);

Modify Master API Key

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

https://bybit-exchange.github.io/docs/v5/user/modify-master-apikey

Function name:

modifyMasterApiKey(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

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

const result = await modifyMasterApiKey(myByBitAccount, 
    {
        permissions:{
            NFT:[
                "NFTQueryProductList"
            ]
        }
    });

Modify Sub API Key

This function is under construction and may not behave as expected

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

https://bybit-exchange.github.io/docs/v5/user/modify-sub-apikey

Function name:

modifySubApiKey(options)

Usage:

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

  let myByBitSubAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

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

const result = await modifySubApiKey(myByBitSubAccount , 
    {
        permissions:{
            NFT:[
                "NFTQueryProductList"
            ]
        }
    });

Delete Master API Key

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

https://bybit-exchange.github.io/docs/v5/user/rm-master-apikey

Function name:

deleteMasterApiKey(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

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

const result = await deleteMasterApiKey(myByBitAccount);

Delete Sub API Key

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

https://bybit-exchange.github.io/docs/v5/user/rm-sub-apikey

Function name:

deleteSubApiKey(options)

Usage:

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

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      label: "bybit",
      testnet: "false"
});

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

const result = await deleteSubApiKey(myByBitAccount);

Last updated