Obtain exchange rate basic information port

Call frequency limit

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

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
        "isSupport": true //Whether or not to support exchange
    },
    "resCode": "800",
    "resMsg": "success",
    "resMsgEn": ""
}

5.Return Parameter Description

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": "ęˆåŠŸ"
}

ā€‹

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)

ā€‹

For a detailed explanation, please seed the Google Document

Business Reference Graph

Last updated