cURL
curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending"import requests
url = "https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending"
headers = {"X-FH-APIKEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-FH-APIKEY': '<api-key>'}};
fetch('https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-FH-APIKEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-FH-APIKEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-FH-APIKEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"error_code": "0",
"message": "success",
"data": [
{
"name": "Bitcoin",
"symbol": "BTC",
"icon_url": "https://cdn.finhay.com/crypto/btc.png",
"price": 67500.25,
"formatted_price": "67.500,25",
"percent_change_1h": 0.5,
"percent_change_24h": -1.2,
"percent_change_7d": 3.8,
"percent_change_30d": 12.5,
"market_cap": 1325000000000,
"last_30d_chart": "https://cdn.finhay.com/spark/btc_30d.svg"
},
{
"name": "Ethereum",
"symbol": "ETH",
"icon_url": "https://cdn.finhay.com/crypto/eth.png",
"price": 3450,
"formatted_price": "3.450,00",
"percent_change_1h": 0.2,
"percent_change_24h": -0.8,
"percent_change_7d": 2.4,
"percent_change_30d": 8.9,
"market_cap": 414000000000,
"last_30d_chart": "https://cdn.finhay.com/spark/eth_30d.svg"
}
]
}{
"error_code": "400",
"message": "Invalid parameter"
}{
"error_code": "401",
"message": "Invalid signature"
}{
"error_code": "429",
"message": "Too many requests"
}{
"error_code": "500",
"message": "Internal server error"
}Hàng hoá
Top crypto đang trending
Top crypto đang trending toàn cầu, kèm giá hiện tại, market cap và % thay
đổi giá ở các khung thời gian (1h, 24h, 7d, 30d) cùng ảnh
sparkline 30 ngày (last_30d_chart).
Trending được xếp hạng theo dữ liệu CoinMarketCap. Số lượng item phụ thuộc nguồn — không có cap cứng từ phía Finhay.
GET
/
market
/
financial-data
/
cryptos
/
top-trending
cURL
curl -H "X-FH-APIKEY: $FINHAY_API_KEY" \
"https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending"import requests
url = "https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending"
headers = {"X-FH-APIKEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-FH-APIKEY': '<api-key>'}};
fetch('https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-FH-APIKEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-FH-APIKEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending")
.header("X-FH-APIKEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://open-api.fhsc.com.vn/market/financial-data/cryptos/top-trending")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-FH-APIKEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"error_code": "0",
"message": "success",
"data": [
{
"name": "Bitcoin",
"symbol": "BTC",
"icon_url": "https://cdn.finhay.com/crypto/btc.png",
"price": 67500.25,
"formatted_price": "67.500,25",
"percent_change_1h": 0.5,
"percent_change_24h": -1.2,
"percent_change_7d": 3.8,
"percent_change_30d": 12.5,
"market_cap": 1325000000000,
"last_30d_chart": "https://cdn.finhay.com/spark/btc_30d.svg"
},
{
"name": "Ethereum",
"symbol": "ETH",
"icon_url": "https://cdn.finhay.com/crypto/eth.png",
"price": 3450,
"formatted_price": "3.450,00",
"percent_change_1h": 0.2,
"percent_change_24h": -0.8,
"percent_change_7d": 2.4,
"percent_change_30d": 8.9,
"market_cap": 414000000000,
"last_30d_chart": "https://cdn.finhay.com/spark/eth_30d.svg"
}
]
}{
"error_code": "400",
"message": "Invalid parameter"
}{
"error_code": "401",
"message": "Invalid signature"
}{
"error_code": "429",
"message": "Too many requests"
}{
"error_code": "500",
"message": "Internal server error"
}Authorizations
API key dài hạn của client. Cấu hình 1 lần lúc khởi tạo; có thể wire thẳng
vào static setter của SDK tự-gen. Đi kèm với FINHAY_API_SECRET — secret
này chỉ dùng ở phía client để tính X-FH-SIGNATURE, không bao giờ
gửi qua mạng.
Response
Trả về data mảng top crypto trending kèm price, market cap, % change ở 4 khung thời gian.
Các field chung của envelope trong mọi response của Finhay API.
error_codelà"0"(string) khi thành công, mã khác"0"khi lỗi.messagelà thông điệp ngắn từ server.
⌘I