# Spot Margin Trade (Normal)

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

## Get Margin Coin Info

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

<https://bybit-exchange.github.io/docs/v5/spot-margin-normal/margin-data>
{% endhint %}

#### Function name:

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

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

## Get Borrowable Coin Info

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

<https://bybit-exchange.github.io/docs/v5/spot-margin-normal/borrowable-data>
{% endhint %}

#### Function name:

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

const result = await getBorrowableCoinInfo(myByBitAccount, {coin: "ETH"});
```

## Get Interest & Quota

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

<https://bybit-exchange.github.io/docs/v5/spot-margin-normal/interest-quota>
{% endhint %}

#### Function name:

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

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

## Get Loan Account Info

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

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

#### Function name:

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

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

## Borrow

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

<https://bybit-exchange.github.io/docs/v5/spot-margin-normal/borrow>
{% endhint %}

#### Function name:

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

const result = await borrowMargin(myByBitAccount,
    {
        coin: "USDT",
        qty: "10"
    });
```

## Repay

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

<https://bybit-exchange.github.io/docs/v5/spot-margin-normal/repay>
{% endhint %}

#### Function name:

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

const result = await repayMargin(myByBitAccount,
    {
        coin: "USDT",
        completeRepayments: "1"
    });
```

## Get Borrow Order Detail

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

<https://bybit-exchange.github.io/docs/v5/spot-margin-normal/borrow-order>
{% endhint %}

#### Function name:

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

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

## Get Repayment Order Detail

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

<https://bybit-exchange.github.io/docs/v5/spot-margin-normal/repay-order>
{% endhint %}

#### Function name:

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

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

## Toggle Margin Trade

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

<https://bybit-exchange.github.io/docs/v5/spot-margin-normal/switch-mode>
{% endhint %}

#### Function name:

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

const result = await toggleNormalMarginTrade(myByBitAccount,
    {
        switch: "1"
    });
```


---

# 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/spot-margin-trade-normal.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.
