> For the complete documentation index, see [llms.txt](https://earnbit.gitbook.io/earnbit/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://earnbit.gitbook.io/earnbit/developers/exchange-api-documentation/public-methods-or-websoket/market-price-methods.md).

# Market Price methods

### List of Market Price methods:

* [Market Price Query](#market-price-query-method) - used for one-time data get requests.
* [Market Price Subscribe](#market-price-subscribe-method) - used to subscribe to receive real-time updates.
* [Market Price Unsubscribe ](#market-price-unsubscribe-method)- used to unsubscribe from the [Market Price Subscribe](#market-price-subscribe-method) method.

### Market Price Query method

Used for one-time data get requests.

#### Method

```javascript
price.query
```

#### Request "params" parameters

|                   Name                   |  Type  | Desciption      | Example   |
| :--------------------------------------: | :----: | --------------- | --------- |
| market<mark style="color:red;">\*</mark> | STRING | Any public pair | BTC\_USDT |

#### Request example

```javascript
{
  "method":"price.query",
  "params":
    [
      "BTC_USDT"
    ],
  "id":1
}
```

#### Response "params" and "result" parameters

|  Name  |  Type  |
| :----: | :----: |
| market | STRING |
|  price | STRING |

```javascript
{
    "id": 1,
    "params": [
        "BTC_USDT"      // market
    ],
    "result": "63678",  // price
    "error": null
}
```

## Market Price Subscribe method

Used to subscribe to receive real-time updates.

#### Method

```javascript
price.subscribe
```

#### Request "params" parameters

|                   Name                   |  Type  | Desciption      | Example   |
| :--------------------------------------: | :----: | --------------- | --------- |
| market<mark style="color:red;">\*</mark> | STRING | Any public pair | BTC\_USDT |

#### Request example

```javascript
{
    "method":"price.subscribe",
    "params":
    [
        "BTC_USDT"
    ],
    "id":1
}
```

#### Response example (successfully subscribed)

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

#### **Response "**&#x70;aram&#x73;**" parameters ("**&#x70;rice.updat&#x65;**")**

|                   Name                   |  Type  |
| :--------------------------------------: | :----: |
| market<mark style="color:red;">\*</mark> | STRING |
|  price<mark style="color:red;">\*</mark> | STRING |

#### **Response example ("**&#x70;rice.updat&#x65;**")**

```javascript
{
    "id": null,
    "method": "price.update",
    "params": [
        "BTC_USDT",         // market
        "63770.00000000"   // price
    ]
}
```

### Market Price Unsubscribe method

Used to unsubscribe from the [Market Price Subscribe](#market-price-subscribe-method) method.

#### Method

```javascript
price.unsubscribe
```

#### Request Example

```javascript
{
  "method":"price.unsubscribe",
  "params":[],
  "id":2
}
```

#### Response example (successfully unsubscribed)

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