Obtain exchange rate basic information port
Provide the trade rate between two tokens, the trade rate update rate is 5-10s
- 1.Interface call:
https://{host}/api/v1/getBaseInfo
2. Request parameter instance
parameter | whether | explain |
---|---|---|
depositCoinCode | Yes | BTC |
receiveCoinCode | Yes | ETH |
depositCoinAmt | Yes | depositCoinAmt |
3. Example of request parameters
{
"depositCoinCode":"ETH",
"receiveCoinCode":"BNB(BSC)",
"depositCoinAmt":"1.5"
}
4.Example of returned results
{
"data": {
"chainFee": "0.001",
"depositCoinFeeRate": "0.002",
"depositMax": "14",
"depositMin": "0.038603",
"instantRate": "6.875775974236",
"burnRate": "0",
"isSupportNoGas": true //Does it support gas free redemption
},
"resCode": "800",
"resMsg": "success",
"resMsgEn": ""
}
5.Return Parameter Description
Field Name | field | data type | remarks |
---|---|---|---|
cinstantRate | instantRate | String | "Exchange rate of received currency/deposited currency accurate to ten decimal places" |
depositMin | cdepositMin | String | Accurate to six decimal places |
depositMax | depositMax | String | BitcoiAccurate to six decimal places |
depositCoinFeeRate | depositCoinFeeRate | String | Accurate to six decimal places |
chainFee | chainFee | String | Accurate to six decimal places |
burnRate | burnRate | String | Default 0 |
Does it support gas free redemption | isSupportNoGas | Boolean | true/false |
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"depositCoinCode\":\"BTC\",\"receiveCoinCode\":\"ETH\"}");
Request request = new Request.Builder()
.url("https://{host}/api/v1/getBaseInfo")
.post(body)
.addHeader("Content-Type", "application/json")
.addHeader("cache-control", "no-cache")
.build();
Response response = client.newCall(request).execute();
var client = new RestClient("https://{host}/api/v1/getBaseInfo");
var request = new RestRequest(Method.POST);
request.AddHeader("cache-control", "no-cache");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("undefined", "{\"depositCoinCode\":\"BTC\",\"receiveCoinCode\":\"ETH\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"Content-Type": @"application/json",
@"cache-control": @"no-cache" };
NSDictionary *parameters = @{ @"depositCoinCode": @"BTC",
@"receiveCoinCode": @"ETH" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://{host}/api/v1/getBaseInfo"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];
//getToken example
import axios from 'axios'
const params = {
depositCoinCode: 'ETH',
receiveCoinCode: 'BNB(BSC)',
}
const res = await axios.post('https://{host}/api/v1/getBaseInfo', params )
console.log(res)
.png?alt=media&token=bff97586-fd06-450f-8ab4-229cbc5c625e)
{
"data": {
"depositMax": "1692690",
"depositMin": "169269",
"instantRate": "0.000000538438",
"minerFee": "0.00004368",
"receiveCoinFee": "0.009328",
"burnRate": "0",
"isSupportNoGas": true //Does it support gas free redemption
},
"resCode": "800",
"resMsg": "成功"
}
Parameter | Explanation |
minerFee | This value is for deposited tokens that utilize SWFTC for the exchange fee, SWFTC exchange fee = deposited amount * minerFee |
receiveCoinFee | This value is the amount of network fee deducted after successful transfer, the units are displayed in the token type the user is receiving/buying, this can be used to calculate the approximate amount of tokens that the user will receive, or it will be used to display the amount of network fees deducted to complete the transfer. |
Important Items:
For advanced trading, user's fee method is the deposited tokens, not SWFTC, therefore parameter "minerFee" can be ignored, the transaction fee is fixed at 0.1% (ex.: if depositing 0.1 BTC, the actual amount deducted is 0.0001btc as the transfer's transaction fee, when actually exchange, only 0.0999btc will be transferred)
Business Reference Graph

Last modified 1mo ago