For the complete documentation index, see llms.txt. This page is also available as Markdown.

金額換算

將一筆金額從某個幣別換算成另一個幣別,兩端都可以是法幣或加密資產。指定時間時使用該 時點的歷史匯率,適合案件金額比對、帳務回溯與跨幣別對帳。回應會一併帶出換算所依據的 匯率與其資料時間,方便留存佐證。

若指定時間早於該幣別的資料涵蓋範圍,會回傳 404,而不會改用最新匯率代替。

get
Authorizations
X-API-KeystringRequired
Query parameters
amountnumber · doubleRequired

要換算的金額(非負數)

Example: 33000
fromstringRequired

來源幣別(法幣代碼或 rate_symbol)

Example: TWD
tostringRequired

目標幣別(法幣代碼或 rate_symbol)

Example: USDT
atinteger · int64Optional

時點(unix 秒);省略=最新

Example: 1721142000
Responses
200

換算成功,回傳結果金額與所用匯率

application/json
get/v1/rates/convert
GET /v1/rates/convert?amount=1&from=text&to=text HTTP/1.1
Host: api.blockchainsecurity.asia
X-API-Key: YOUR_API_KEY
Accept: */*
{
  "data": {
    "amount": 33000,
    "at": 1721142000,
    "from": "TWD",
    "from_rate": {
      "kind": "fiat",
      "price_usd": 0.030536215952119215,
      "ts": 1721142000,
      "units_per_usd": 32.748
    },
    "rate": 0.030536215952119215,
    "result": 1007.695126419934,
    "to": "USDT",
    "to_rate": {
      "kind": "stable",
      "price_usd": 1,
      "ts": null,
      "units_per_usd": null
    },
    "usd_value": 1007.695126419934
  },
  "meta": {
    "request_id": "3f1c8a20-6d54-4f8b-9a17-2c9e5b7d1e44"
  }
}

Last updated

Was this helpful?