# Asset

{% hint style="warning" %}
**All parameters  of type INTEGER listed in the Bybit API docs need to be passed in as a string.**
{% endhint %}

## Get Coin Exchange Records

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/exchange>
{% endhint %}

#### Function name:

```javascript
getCoinExchangeRecords(options)
```

#### Usage:&#x20;

<pre class="language-javascript"><code class="lang-javascript">import { createExchange } from "./exchanges/exchange.js";

  let myByBitAccount = createExchange({
      exchange: "bybit",
      authenticate: "true",
<strong>      key: "myKeys",
</strong>      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);
</code></pre>

## Get Delivery Record

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/delivery>
{% endhint %}

#### Function name:

```javascript
getDeliveryRecord(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/settlement>
{% endhint %}

#### Function name:

```javascript
getUsdcSesssionSettlement(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/asset-info>
{% endhint %}

#### Function name:

```javascript
getAssetInfo(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/all-balance>
{% endhint %}

#### Function name:

```javascript
getAllCoinsBalance(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/account-coin-balance>
{% endhint %}

#### Function name:

```javascript
getSingleCoinBalance(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/transferable-coin>
{% endhint %}

#### Function name:

```javascript
getTransferableCoin(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/create-inter-transfer>
{% endhint %}

#### Function name:

```javascript
createInternalTransfer(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/inter-transfer-list>
{% endhint %}

#### Function name:

```javascript
getInternalTransferRecords(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/sub-uid-list>
{% endhint %}

#### Function name:

```javascript
getSubUid(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/enable-unitransfer-subuid>
{% endhint %}

#### Function name:

```javascript
enableUniversalTransfer(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/unitransfer>
{% endhint %}

#### Function name:

```javascript
createUniversalTransfer(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/unitransfer-list>
{% endhint %}

#### Function name:

```javascript
getUniversalTransferRecords(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/deposit-coin-spec>
{% endhint %}

#### Function name:

```javascript
getAllowedDepositCoinInfo(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/set-deposit-acct>
{% endhint %}

#### Function name:

```javascript
setDepositAccount(options)
```

#### Usage:&#x20;

```javascript
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)

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/deposit-record>
{% endhint %}

#### Function name:

```javascript
getDepositRecord(options)
```

#### Usage:&#x20;

```javascript
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)

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/sub-deposit-record>
{% endhint %}

#### Function name:

```javascript
getSubAccountDepositRecords(options)
```

#### Usage:&#x20;

```javascript
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)

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/internal-deposit-record>
{% endhint %}

#### Function name:

```javascript
getInternalDepositRecords(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/master-deposit-addr>
{% endhint %}

#### Function name:

```javascript
getMasterDepositAddress(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/sub-deposit-addr>
{% endhint %}

#### Function name:

```javascript
getSubDepositAddress(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/coin-info>
{% endhint %}

#### Function name:

```javascript
getCoinInfo(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/withdraw-record>
{% endhint %}

#### Function name:

```javascript
getWithdrawalRecords(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/delay-amount>
{% endhint %}

#### Function name:

```javascript
getDelayWithdrawalAmount(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="warning" %}
This function is under construction and may not behave as expected
{% endhint %}

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/withdraw>
{% endhint %}

#### Function name:

```javascript
withdraw(options)
```

#### Usage:&#x20;

```javascript
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

{% hint style="warning" %}
This function is under construction and may not behave as expected
{% endhint %}

{% hint style="info" %}
Please refer to the official ByBit API Docs for the required parameters.

<https://bybit-exchange.github.io/docs/v5/asset/cancel-withdraw>
{% endhint %}

#### Function name:

```javascript
cancelWithdraw(options)
```

#### Usage:&#x20;

```javascript
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"
    });
```
