HTT:非小号公共API_Princess Striker Gem

非小号公共API

FeixiaohaoAPI是一套高性能的RESTful接口,专门设计用于满足应用程序开发人员、数据科学家和企业业务平台的需求。

------------------------------------------------------------------------------------

终结点

FeixiaohaoAPI目前只有1个顶级目录。

目录:https://fxhapi.feixiaohao.info/public/v1/ticker/*

描述:返回加密货币数据,如有序加密货币列表或价格和数量数据。

------------------------------------------------------------------------------------

快速开始

Ticker(行情)

更新频率:1分钟更新一次

访问方式:

GET

URL参数

可选:

start=(指定结果集的开始排名)

limit=(指定结果集的最大数量)

convert=(将返回的price,24hvolume,和marketcap字段转换到指定货币单位并补充到结果对象.可用的货币单位有:"AUD","BRL","CAD","CHF","CLP","CNY","CZK","DKK","EUR","GBP","HKD","HUF","IDR","ILS","INR","JPY","KRW","MXN","MYR","NOK","NZD","PHP","PKR","PLN","RUB","SEK","SGD","THB","TRY","TWD","ZAR")

访问成功:

返回码:200

返回内容:

[

{

"id":"bitcoin",

"name":"Bitcoin",

"symbol":"BTC",

"rank":1,

"logo":"https://s1.bqiapp.com/coin/20181030_72_webp/bitcoin_200_200.webp",

"logo_png":"https://s1.bqiapp.com/coin/20181030_72_png/bitcoin_200_200.png",

"price_usd":5225,

"price_btc":1,

"volume_24h_usd":5150321567,

"market_cap_usd":92163602317,

"available_supply":17637575,

"total_supply":17637575,

"max_supply":21000000,

"percent_change_1h":0.21,

"percent_change_24h":0.64,

"percent_change_7d":6,

"last_updated":1554886833

},

{

"id":"ethereum",

"name":"Ethereum",

"symbol":"ETH",

"rank":2,

"logo":"https://s1.bqiapp.com/coin/20181030_72_webp/ethereum_200_200.webp",

"logo_png":"https://s1.bqiapp.com/coin/20181030_72_png/ethereum_200_200.png",

"price_usd":179.65,

"price_btc":0.0344,

"volume_24h_usd":2766496907,

"market_cap_usd":18971178569,

"available_supply":105598041,

"total_supply":105598041,

"max_supply":105598041,

"percent_change_1h":0.35,

"percent_change_24h":2.18,

"percent_change_7d":8.42,

"last_updated":1554886833

}

]

其中各字段的说明如下:

"id":"币种代码",

"name":"币种英文名称",

"symbol":"币种的简称",

"rank":币种的排名,

"logo":"币种的logo",

"logo_png":"币种的logo",

"price_usd":最新价格,

"price_btc":最新价格,

"volume_24h_usd":24h的成交额,

"market_cap_usd":流通市值,

"available_supply":流通数量,

"total_supply":总发行量,

"max_supply":最大发行量,

"percent_change_1h":1小时涨跌幅,

"percent_change_24h":24小时涨跌幅,

"percent_change_7d":7天涨跌幅,

"last_updated":行情更新时间

访问失败:

返回码:401/403或者429

内容:{"message":"APIratelimitexceeded"}

示例请求:

CURL:

curl-H"Accept:application/json"-G"https://fxhapi.feixiaohao.com/public/v1/ticker?limit=5"

C#:

usingSystem;

usingSystem.Net;

usingSystem.Web;

classCSharpExample

{

publicstaticvoidMain(stringargs)

{

try

{

Console.WriteLine(makeAPICall());

}

catch(WebExceptione)

{

Console.WriteLine(e.Message);

}

}

staticstringmakeAPICall()

{

varURL=newUriBuilder("https://fxhapi.feixiaohao.com/public/v1/ticker");

varqueryString=System.Web.HttpUtility.ParseQueryString(string.Empty);

queryString="5";

queryString="5";

queryString="USD";

URL.Query=queryString.ToString();

varclient=newSystem.Net.WebClient();

client.Headers.Add("Accepts","application/json");

returnclient.DownloadString(URL.ToString());

}

}

Java:

importjava.io.IOException;

importjava.net.URISyntaxException;

importjava.util.ArrayList;

importjava.util.List;

publicclassJavaExample{

publicstaticvoidmain(Stringargs){

Stringuri="https://fxhapi.feixiaohao.com/public/v1/ticker";

Listparatmers=newArrayList();

paratmers.add(newBasicNameValuePair("start","5"));

paratmers.add(newBasicNameValuePair("limit","5"));

paratmers.add(newBasicNameValuePair("convert","USD"));

try{

Stringresult=makeAPICall(uri,paratmers);

System.out.println(result);

}catch(IOExceptione){

System.out.println("Error:cannontaccesscontent-"+e.toString());

}catch(URISyntaxExceptione){

System.out.println("Error:InvalidURL"+e.toString());

}

}

publicstaticStringmakeAPICall(Stringuri,Listparameters)

throwsURISyntaxException,IOException{

Stringresponse_content="";

URIBuilderquery=newURIBuilder(uri);

query.addParameters(parameters);

CloseableHttpClientclient=HttpClients.createDefault();

HttpGetrequest=newHttpGet(query.build());

request.setHeader(HttpHeaders.ACCEPT,"application/json");

CloseableHttpResponseresponse=client.execute(request);

try{

System.out.println(response.getStatusLine());

HttpEntityentity=response.getEntity();

response_content=EntityUtils.toString(entity);

EntityUtils.consume(entity);

}finally{

response.close();

}

returnresponse_content;

}

}

Golang:

packagemain

import(

"fmt"

"io/ioutil"

"log"

"net/http"

"net/url"

"os"

)

funcmain(){

client:=&http.Client{}

req,err:=http.NewRequest("GET","https://fxhapi.feixiaohao.com/public/v1/ticker",nil)

iferr!=nil{

log.Print(err)

os.Exit(1)

}

q:=url.Values{}

q.Add("start","5")

q.Add("limit","5")

q.Add("convert","USD")

req.Header.Set("Accepts","application/json")

req.URL.RawQuery=q.Encode()

resp,err:=client.Do(req);

iferr!=nil{

fmt.Println("Errorsendingrequesttoserver")

os.Exit(1)

}

fmt.Println(resp.Status);

respBody,_:=ioutil.ReadAll(resp.Body)

fmt.Println(string(respBody));

}

郑重声明: 本文版权归原作者所有, 转载文章仅为传播更多信息之目的, 如作者信息标记有误, 请第一时间联系我们修改或删除, 多谢。

区块博客

[0:46ms0-3:709ms