批量获取兑换汇率基本信息接口
批量获取兑换汇率基本信息接口,汇率更新频率为:4~6s
1. 接口调用:
https://{host}/api/v1/getInfo
2. 请求参数实例
参数 | 是否必须 | 说明 |
---|---|---|
transactionPair | 是 | 要查询的交易对信息,币种和币种之间用"to"隔开,多个交易对之间用","隔开,例如SWFTCtoBTC,SWFTCtoETH,, |
| | |
3.请求参数示例
{
"transactionPair":"SWFTCtoBTC,BNB(BSC)toHT(HECO)"
}
4.返回结果示例
{
"data": {
"BNB(BSC)toHT(HECO)": {
"depositMax": "21458291499499.955262",
"depositMin": "0.081593",
"instantRate": "40.936843425964",
"minerFee": "164.629310344827586207",
"receiveCoinFee": "0.02"//兑换完成发币要扣除的网络手续费0.02HT(HECO)
},
"SWFTCtoBTC": {
"depositMax": "6000000",
"depositMin": "45041.394252",
"instantRate": "0.000000058282",
"minerFee": "0.001",
"receiveCoinFee": "0.0007"//兑换完成发币要扣除的网络手续费0.0007BTC
}
},
"resCode": "800",
"resMsg": "成功",
"resMsgEn": ""
}
5.返回参数说明
字段名称 | 字段 | 数据类型 | 备注 |
---|---|---|---|
即时汇率 | instantRate | String | "精确到小数点后十位 接收货币/存入货币的汇率" |
最低存储额 | depositMin | String | 精确到小数点后六位 |
最高存储额 | depositMax | String | 精确到小数点后六位 |
兑换手续费 | depositCoinFeeRate | String | 精确到小数点后六位 |
发币手续费 | chainFee | String | 精确到小数点后六位 |
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n\t\"transactionPair\":\"SWFTCtoETH,SWFTCtoBTC\"\n}");
Request request = new Request.Builder()
.url("https://{host}/api/v1/getInfo")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
.addHeader("Postman-Token", "6a54ea69-afbd-4498-97e0-c41b471787be")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "{host}/api/v1/getInfo"
payload := strings.NewReader("{\n\t\"transactionPair\":\"SWFTCtoETH,SWFTCtoBTC\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("cache-control", "no-cache")
req.Header.Add("Postman-Token", "731d31cf-548f-42ec-a5a2-3e51d82a89dc")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
import http.client
conn = http.client.HTTPConnection("{host}")
payload = "{\n\t\"transactionPair\":\"SWFTCtoETH,SWFTCtoBTC\"\n}"
headers = {
'Content-Type': "application/json",
'cache-control': "no-cache",
'Postman-Token': "ba52a67c-021e-4b95-ac3e-a4cea0dd752e"
}
conn.request("POST", "api,v1,getInfo", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
// Some code//getToken example
import axios from 'axios'
const params = {
transactionPair: 'SWFTCtoETH,SWFTCtoBTC'
}
const res = await axios.post('https://{host}/api/v1/getInfo', params )
console.log(res)
.png?alt=media&token=ee06a7c4-d2c9-4b14-b210-cecad4b03ba5)
{
"data": {
"BNB(BSC)toHT(HECO)": {
"depositMax": "21458291499499.955262",
"depositMin": "0.081593",
"instantRate": "40.936843425964",
"minerFee": "164.629310344827586207",
"receiveCoinFee": "0.02"//兑换完成发币要扣除的网络手续费0.02HT(HECO)
},
"SWFTCtoBTC": {
"depositMax": "6000000",
"depositMin": "45041.394252",
"instantRate": "0.000000058282",
"minerFee": "0.001",
"receiveCoinFee": "0.0007"//兑换完成发币要扣除的网络手续费0.0007BTC
}
},
"resCode": "800",
"resMsg": "成功",
"resMsgEn": ""
}
字段 | 说明 |
minerFee | 该值为中心化兑换,存入币种使用SWFTC作为手续费时的汇率值,SWFTC手续费 = 存币数量 * minerFee |
receiveCoinFee | 该值为去中心化兑换,兑换成功后发币时扣取的网络手续费数量,单位为接收币币种,可用于提前计算用户大致接收到的币的数量,或用于显示用户即将扣除发币网络手续费的数量 |
因为去中心化兑换,用户的手续费方式为原币,非SWFTC,因此可以忽略minerFee字段,手续费固定收取存入原币的千分之二(即:存入0.1btc,实际会扣取0.0002btc作为兑换的手续费,实际兑换时,只拿0.0998btc去做兑换)
实际到账数量 = (用户存币数量 - 兑换手续费数量)* 汇率 - 发币网络手续费
receiveCoinAmt = (depositCoinAmt - depositCoinAmt * 兑换手续费率) * instantRate - receiveCoinFee

Last modified 5mo ago