# Wallet (Spot)

All Spot Market Wallet API endpoints require authentication. Please create Bitget API keys to interact with these functions successfully. Accounts must be funded or collateralized for any trades to successfully post.

### Transfer

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

<https://bitgetlimited.github.io/apidoc/en/spot/#transfer>
{% endhint %}

#### Function name:

```javascript
spotWalletTransfer()
```

#### Usage:&#x20;

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await spotWalletTransfer(myBitgetAccount, 
    {
        fromType: "spot",
        toType: "mix_usdt",
        amount: "0.1",
        coin: "USDT"
    })
```

### Sub Transfer

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

<https://bitgetlimited.github.io/apidoc/en/spot/#sub-transfer>
{% endhint %}

#### Function name:

```javascript
subaccountTransfer()
```

#### Usage:&#x20;

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await subaccountTransfer(myBitgetAccount, {
 fromType: "spot",
 toType: "spot",
 amount: "5",
 coin: "USDT",
 clientOid: "12345",
 fromUserId: "1",
 toUserId: "2"});
```

### Get Coin Address

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

<https://bitgetlimited.github.io/apidoc/en/spot/#get-coin-address>
{% endhint %}

#### Function name:

```javascript
getCoinDepositAddress()
```

#### Usage:&#x20;

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getCoinDepositAddress(myBitgetAccount, 
    {
        coin: "USDT",
        chain: "trc20"
    });
```

### Withdraw

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

<https://bitgetlimited.github.io/apidoc/en/spot/#withdraw>
{% endhint %}

{% hint style="warning" %}
This function is under construction
{% endhint %}

#### Function name:

```javascript
spotWalletWithdraw()
```

#### Usage:&#x20;

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await spotWalletWithdraw(myBitgetAccount)
```

### Inner Withdraw

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

<https://bitgetlimited.github.io/apidoc/en/spot/#inner-withdraw>
{% endhint %}

#### Function name:

```javascript
innerWithdraw()
```

#### Usage:&#x20;

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await innerWithdraw(myBitgetAccount, {
    coin: "USDT",
    toUid: "234567",
    amount: "5"
  });
```

### Get Withdraw List

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

<https://bitgetlimited.github.io/apidoc/en/spot/#get-withdraw-list>
{% endhint %}

#### Function name:

```javascript
getWithdrawalList()
```

#### Usage:&#x20;

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getWithdrawalList(myBitgetAccount, {
    coin: "USDT",
    startTime: "1659036670000",
    endTime: "1659076670000",
    pageNo: "1",
    pageSize: "20"
    });
```

### Get Deposit List

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

<https://bitgetlimited.github.io/apidoc/en/spot/#get-deposit-list>
{% endhint %}

#### Function name:

```javascript
getDepositList()
```

#### Usage:&#x20;

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

  let myBitgetAccount = createExchange({
      exchange: "bitget",
      authenticate: "true",
      key: "myKeys",
      secret: "mySecret",
      passphrase: "myPassphrase",
      label: "bitget",
      marginType: "usdt"
});

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

const result = await getDepositList(myBitgetAccount, {
    coin: "USDT",
    startTime: "1659036670000",
    endTime: "1659076670000",
    pageNo: "1",
    pageSize: "20"
    })
```
