# Account

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

## Get Wallet Balance

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

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

#### Function name:

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

const result = await getWalletBalance(myByBitAccount, 
    {
       accountType: "UNIFIED"
     });
</code></pre>

## Upgrade to Unified Account

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

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

#### Function name:

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

const result = await upgradeToUta(myByBitAccount);
```

## Get Borrow History

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

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

#### Function name:

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

const result = await getBorrowHistory(myByBitAccount, 
    {
       currency: "USDT"
     });
```

## Get Collateral Info

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

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

#### Function name:

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

const result = await getCollateralInfo(myByBitAccount);
```

## Get Coin Greeks

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

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

#### Function name:

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

const result = await getCoinGreeks(myByBitAccount);
```

## Get Fee Rate

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

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

#### Function name:

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

const result = await getFeeRate(myByBitAccount, 
    {
       category: 'linear'
     });
```

## Get Account Info

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

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

#### Function name:

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

const result = await getAccountInfo(myByBitAccount);
```

## Get Transaction Log

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

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

#### Function name:

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

const result = await getTransactionLog(myByBitAccount);
```

## Set Margin Mode

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

<https://bybit-exchange.github.io/docs/v5/account/set-margin-mode>
{% endhint %}

#### Function name:

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

const result = await setMarginMode(myByBitAccount, 
    {
       setMarginMode: "REGULAR_MARGIN"
   });
```

## Set MMP

{% 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/account/set-mmp>
{% endhint %}

#### Function name:

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

const result = await setMmp(myByBitAccount, 
    {
    baseCoin: "ETH",
    window: "5000",
    frozenPeriod: "100000",
    qtyLimit: "50",
    deltaLimit: "20"
    });
```

## Reset MMP

{% 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/account/reset-mmp>
{% endhint %}

#### Function name:

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

const result = await resetMmp(myByBitAccount, 
    {
    baseCoin: "BTC"
    });
```

## Get MMP State

{% 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/account/get-mmp-state>
{% endhint %}

#### Function name:

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

const result = await getMmpState(myByBitAccount, 
    {
    baseCoin: "ETH"
    });
```

##


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.compendium.finance/pendax/using-pendax-sdk/bybit-functions/account.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
