# My Assets methods

### List of My Balances methods:

* [Asset Query ](#asset-query-method)- used for one-time data get requests.
* [Asset Subscribe ](#asset-subscribe-method)- used to subscribe to receive real-time updates (when the balance state is changed).
* [Asset Unsubscribe ](#asset-unsubscribe-method)- used to unsubscribe from the [Asset Subscribe](#asset-subscribe-method) method.

### Asset Query method

Used for one-time data get requests.

#### Method name

```javascript
asset.query
```

#### Request "params" parameters

| Name                                    |  Type  | Description                                                                                                                    | Example |
| --------------------------------------- | :----: | ------------------------------------------------------------------------------------------------------------------------------ | :-----: |
| asset<mark style="color:red;">\*</mark> | STRING | Assets (empty = all balances, 1 asset = 1 balance for a specific asset, list of assets = list of balances for specific assets) |   BTC   |

#### Request example 1

```javascript
{
  "method":"asset.query",
  "params":
    [
      "BTC"
    ],
  "id":1
}
```

#### Response parameters&#x20;

|    Name   | Type   |                Description               |
| :-------: | ------ | :--------------------------------------: |
|   market  | STRING |                Asset name                |
| available | STRING | Available amount (without active orders) |
|   freeze  | STRING |   Freezed amount (active orders amount)  |

#### Response example 1

```javascript
{
    "id": 1,
    "params": [
        "BTC"
    ],
    "result": {
        "BTC": {
            "available": "0.000290480096",
            "freeze": "0"
        }
    },
    "error": null
}
```

#### Request example 2

```javascript
{
  "method":"asset.query",
  "params":
    [
      "BTC",
      "ETH",
      "USDT"
    ],
  "id":2
}
```

#### Response example 2

```javascript
{
    "id": 2,
    "params": [
        "BTC",
        "ETH",
        "USDT"
    ],
    "result": {
        "BTC": {
            "available": "0.000290480096",
            "freeze": "0"
        },
        "ETH": {
            "available": "0",
            "freeze": "0"
        },
        "USDT": {
            "available": "42.5282451022304501",
            "freeze": "4.9999999996298992"
        }
    },
    "error": null
}
```

#### Request example 3

```javascript
{
  "method":"asset.query",
  "params":
    [],
  "id":3
}
```

#### Response example 3

```javascript
{
    "id": 3,
    "params": [],
    "result": {
        "AGLD": {
            "available": "0",
            "freeze": "0"
        },
        "MATIC": {
            "available": "0",
            "freeze": "0"
        },
        ...
        },
    "error": null
}
```

### Asset Subscribe method

Used to subscribe to receive real-time updates.

#### Method

```javascript
asset.subscribe
```

#### Request "params" parameters

|                   Name                  | Type   |                                                           Description                                                          | Example |
| :-------------------------------------: | ------ | :----------------------------------------------------------------------------------------------------------------------------: | ------- |
| asset<mark style="color:red;">\*</mark> | STRING | Assets (empty = all balances, 1 asset = 1 balance for a specific asset, list of assets = list of balances for specific assets) | USDT    |

#### Request example

```javascript
{
  "method":"asset.subscribe",
  "params":
    [
      "USDT"
    ],
  "id":3
}
```

#### Response example (successfully subscribed)

```javascript
{
    "id": 3,
    "params": [],
    "result": {
        "status": "success"
    },
    "error": null
}
```

#### Response parameters ("asset.update", when the balance state was changed)

|    Name   | Type   |              Description              |
| :-------: | ------ | :-----------------------------------: |
|   market  | STRING |               Asset name              |
| available | STRING |  Available amount (in active orders)  |
|   freeze  | STRING | Freezed amount (active orders amount) |

#### Response example ("asset.update", when the balance state was changed)

```javascript
{
    "id": null,
    "method": "asset.update",
    "params": [
        {
            "USDT": {                                     // market
                "available": "42.4487262222304501",       // available
                "freeze": "4.9999999996298992"            // freeze
            }
        }
    ]
}
```

### Asset Unsubscribe method

Used to unsubscribe from the [Asset Subscribe](#asset-subscribe-method) method.

#### Method

```javascript
asset.unsubscribe
```

#### Request example&#x20;

```javascript
{
  "method":"asset.unsubscribe",
  "params":[],
  "id":4
}
```

#### Response example (successfully unsubscribed)

```javascript
{
    "id": 4,
    "params": [],
    "result": {
        "status": "success"
    },
    "error": null
}
```


---

# 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://earnbit.gitbook.io/earnbit/developers/exchange-api-documentation/private-methods-or-websoket/my-assets-methods.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.
