Asset

Documentation on interacting with ByBit's Asset 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.

Get Coin Exchange Records

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

https://bybit-exchange.github.io/docs/v5/asset/exchange

Function name:

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

const result = await getCoinExchangeRecords(myByBitAccount);

Get Delivery Record

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

https://bybit-exchange.github.io/docs/v5/asset/delivery

Function name:

getDeliveryRecord(options)

Usage:

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

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

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

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

const result = await getDeliveryRecord(myByBitAccount, 
    {
        category: "option"
    });

Get USDC Session Settlement

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

https://bybit-exchange.github.io/docs/v5/asset/settlement

Function name:

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

const result = await getUsdcSesssionSettlement(myByBitAccount, 
    {
       category: "linear"
     });

Get Asset Info

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

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

Function name:

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

const result = await getAssetInfo(myByBitAccount, {accountType: "SPOT"});

Get All Coins Balance

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

https://bybit-exchange.github.io/docs/v5/asset/all-balance

Function name:

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

const result = await getAllCoinsBalance(myByBitAccount, {accountType: "SPOT"});

Get Single Coin Balance

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

https://bybit-exchange.github.io/docs/v5/asset/account-coin-balance

Function name:

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

const result = await getSingleCoinBalance(myByBitAccount, 
    {
       accountType: 'UNIFIED',
       coin: 'BTC'
     });

Get Transferable Coin

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

https://bybit-exchange.github.io/docs/v5/asset/transferable-coin

Function name:

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

const result = await getTransferableCoin(myByBitAccount,
    {
        fromAccountType: 'SPOT',
        toAccountType: 'UNIFIED'
    });

Create Internal Transfer

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

https://bybit-exchange.github.io/docs/v5/asset/create-inter-transfer

Function name:

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

const result = await createInternalTransfer(myByBitAccount, 
    {
        transferID: '12345',
        coin: 'USDT',
        amount: '10',
        fromAccountType: 'UNIFIED',
        toAccountType: 'SPOT'
    });

Get Internal Transfer Records

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

https://bybit-exchange.github.io/docs/v5/asset/inter-transfer-list

Function name:

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

const result = await getInternalTransferRecords(myByBitAccount);

Get Sub UID

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

https://bybit-exchange.github.io/docs/v5/asset/sub-uid-list

Function name:

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

const result = await getSubUid(myByBitAccount);

Enable Universal Transfer for Sub UID

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

https://bybit-exchange.github.io/docs/v5/asset/enable-unitransfer-subuid

Function name:

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

const result = await enableUniversalTransfer(myByBitAccount, 
    {
        subMemberIds: ["554117,592324,592334"]
    });

Create Universal Transfer

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

https://bybit-exchange.github.io/docs/v5/asset/unitransfer

Function name:

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

const result = await createUniversalTransfer(myByBitAccount, 
    {
        transferId: "12345",
        coin: "USDT",
        amount: "10",
        fromMemberId: "12345",
        toMemberId: "123456",
        fromAccountType: "UNIFIED",
        toAccountType: "UNIFIED"
    });

Get Universal Transfer Records

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

https://bybit-exchange.github.io/docs/v5/asset/unitransfer-list

Function name:

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

const result = await getUniversalTransferRecords(myByBitAccount);

Get Allowed Deposit Coin Info

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

https://bybit-exchange.github.io/docs/v5/asset/deposit-coin-spec

Function name:

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

const result = await getAllowedDepositCoinInfo(myByBitAccount);

Set Deposit Account

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

https://bybit-exchange.github.io/docs/v5/asset/set-deposit-acct

Function name:

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

const result = await setDepositAccount(myByBitAccount, 
    {
        accountType: "UNIFIED"
    });

Get Deposit Records (on-chain)

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

https://bybit-exchange.github.io/docs/v5/asset/deposit-record

Function name:

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

const result = await getDepositRecord(myByBitAccount);

Get Sub Deposit Records (on-chain)

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

https://bybit-exchange.github.io/docs/v5/asset/sub-deposit-record

Function name:

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

const result = await getSubAccountDepositRecords(myByBitAccount, 
    {
        subMemberId: "12345"
    });

Get Internal Deposit Records (off-chain)

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

https://bybit-exchange.github.io/docs/v5/asset/internal-deposit-record

Function name:

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

const result = await getInternalDepositRecords(myByBitAccount);

Get Master Deposit Address

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

https://bybit-exchange.github.io/docs/v5/asset/master-deposit-addr

Function name:

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

const result = await getMasterDepositAddress(myByBitAccount,
    {
        coin: "USDT"
    });

Get Sub Deposit Address

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

https://bybit-exchange.github.io/docs/v5/asset/sub-deposit-addr

Function name:

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

const result = await getSubDepositAddress(myByBitAccount,
    {
        coin: "USDT",
        chainType: "ETH",
        subMemberId: "12345"
    });

Get Coin Info

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

https://bybit-exchange.github.io/docs/v5/asset/coin-info

Function name:

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

const result = await getCoinInfo(myByBitAccount);

Get Withdrawal Records

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

https://bybit-exchange.github.io/docs/v5/asset/withdraw-record

Function name:

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

const result = await getWithdrawalRecords(myByBitAccount);

Get Withdrawal Records

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

https://bybit-exchange.github.io/docs/v5/asset/delay-amount

Function name:

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

const result = await getDelayWithdrawalAmount(myByBitAccount, 
    {
        coin: "USDT"
    });

Withdraw

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/asset/withdraw

Function name:

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

const result = await withdraw(myByBitAccount, 
    {
        coin: "USDT",
        chain: "ETH20",
        walletAddress: "12345",
        amount: "10",
        timestamp: "10000000000"
    });

Cancel Withdrawal

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/asset/cancel-withdraw

Function name:

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

const result = await cancelWithdraw(myByBitAccount, 
    {
        id: "12345"
    });

Last updated