> 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
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://earnbit.gitbook.io/earnbit/developers/exchange-api-documentation/public-methods-or-websoket/market-price-methods.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
