账户
鉴权
签名方式:每个请求用 App Key / Secret 签名。请求头如下:
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
Authorization | string · header | 必填 | OpenAPI 后台 上的账户 Access Token,作为原始 token 传入(不带 Bearer 前缀),并参与签名计算。 |
X-Api-Key | string · header | 必填 | 你的 App Key。 |
X-Timestamp | string · header | 必填 | 请求时间戳,单位秒(Unix 时间)。 |
X-Api-Signature | string · header | 必填 | HMAC-SHA256 签名。格式:HMAC-SHA256 SignedHeaders=authorization;x-api-key;x-timestamp, Signature=。 |
获取账户中所有货币对的当前外汇汇率。
请求
查询参数
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
base | string | 可选 | 基础货币,例如 `USD`,不传则返回所有货币对 |
响应
响应字段
| 名称 | 类型 | 必填 | 说明 |
|---|---|---|---|
exchanges | object[] | 可选 | 汇率列表, |
└ base_currency | string | 可选 | 基准货币 |
└ other_currency | string | 可选 | 报价货币 |
└ bid_rate | number | 可选 | 买入汇率 |
└ offer_rate | number | 可选 | 卖出汇率 |
└ average_rate | number | 可选 | 平均汇率,表示 1 单位 `other_currency` 折合多少 `base_currency`。例如 `base_currency=USD`、`other_currency=HKD`、`average_rate=0.12746` 表示 1 港元 = 0.12746 美元 |
响应 JSON 示例
{
"code": 0,
"message": "success",
"data": {
"exchanges": [
{
"base_currency": "USD",
"other_currency": "HKD",
"bid_rate": 0.12746,
"offer_rate": 0.12746,
"average_rate": 0.12746
}
]
}
}错误码
参见错误码文档。