Obtain exchange rate basic information port
Call frequency limit
Provide the trade rate between two tokens, the trade rate update rate is 5-10s
Interface call:
https://{host}/api/v1/getBaseInfo
2. Request parameter instance
depositCoinCode
Yes
BTC
receiveCoinCode
Yes
ETH
depositCoinAmt
Yes
depositCoinAmt
sourceFlag
Yes
sourceFlag
3. Example of request parameters
{
"depositCoinCode":"ETH",
"receiveCoinCode":"BNB(BSC)",
"depositCoinAmt":"1.5",
"sourceFlag": "xxx"
}
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
"isSupport": true //Whether or not to support exchange
},
"resCode": "800",
"resMsg": "success",
"resMsgEn": ""
}
5.Return Parameter Description
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
Whether or not to support exchange
isSupport
Boolean
true/false
Code Example
java code example
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();
C# code example
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);
Objective-C code example
#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];
Nodejs code example
//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)
Postman example

Response result example
{
"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)
Last updated