> For the complete documentation index, see [llms.txt](https://docs.topay.mobi/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.topay.mobi/cn/reference/api-reference/rate.md).

# 汇率

查询币种之间的汇率。

{% hint style="warning" %}
每个请求都必须包含[公共参数](/cn/reference/api-reference/common-parameters.md)。
{% endhint %}

## 交易汇率 <a href="#trade-rate" id="trade-rate"></a>

<mark style="color:green;">`POST`</mark> `https://api.topay.mobi/v1/rate/queryTradeRate`

查询币种之间的汇率。

#### 请求体 <a href="#request-body" id="request-body"></a>

| 名称                                              | 类型     | 说明                   |
| ----------------------------------------------- | ------ | -------------------- |
| baseCurrency<mark style="color:red;">\*</mark>  | String | 货币对中的第一个币种，即基础币种     |
| quoteCurrency<mark style="color:red;">\*</mark> | String | 用于确定基础币种价值的报价币种      |
| symbolTradeType                                 | String | ask 或 bid，默认值为 "bid" |
| orderType                                       | String | 默认值："pay"            |

{% tabs %}
{% tab title="200: OK " %}

```javascript
{
  "code": "200",
  "data": {
    "rate": "16078.8636472720095",
    "symbol": "USDT-IDR",
    "timeMills": 1678085017746,
    "expiredMills": 1678085077746
  },
  "message": "success"
}
```

{% endtab %}
{% endtabs %}

<details>

<summary>代码示例</summary>

```
curl --location --request POST 'https://api.topay.mobi/v1/rate/queryTradeRate' \
--header 'Content-Type: application/json' \
--data-raw '{
   "baseCurrency": "USDT",
   "quoteCurrency": "IDR"
   
}'
```

</details>

{% hint style="info" %}
示例代码请参阅 [GitHub](/cn/reference/api-reference.md#demo-client)。
{% endhint %}
