核心 API
获取带宽价格
公开带宽费率、订单数量限制及分钟时长折扣
GET
/
api
/
v1
/
bandwidth
/
prices
获取带宽价格
curl --request GET \
--url https://api.example.com/api/v1/bandwidth/pricesimport requests
url = "https://api.example.com/api/v1/bandwidth/prices"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/bandwidth/prices', 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://api.example.com/api/v1/bandwidth/prices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.example.com/api/v1/bandwidth/prices"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/bandwidth/prices")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/bandwidth/prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"price_per_day_trx": "<string>",
"price_sun_1h": 123,
"price_sun_1d": 123,
"min_volume": 123,
"max_volume": 123,
"fixed_fee_trx": "<string>",
"short_min_minutes": 123,
"short_max_minutes": 123,
"short_max_discount_pct": "<string>"
}获取带宽价格
返回1h 和 1d 的公开带宽费率、订单数量限制、固定手续费,以及分钟时长(5m … 59m)折扣的参数。
此端点为公开接口——无需身份验证。 它始终返回公开费率。如需按您自己的费率获得订单的准确金额,请使用带宽报价。
响应
string
按小时费率计算的 1,000 单位带宽 24 小时的 TRX 价格:
price_sun_1h × 24 / 1000。1d 订单则按 price_sun_1d 计价。number
1h 的公开费率,每 1 单位带宽的 SUN 价格。分钟时长以它为基础计价。number
1d 的公开费率,每 1 单位带宽的 SUN 价格number
最小订单量,以带宽单位计(1)
number
最大订单量,以带宽单位计(100,000)
number
最短分钟时长(5,即
"5m")number
最长分钟时长(59,即
"59m")。一小时为 "1h"。string
最短时长相对小时费率的折扣,以百分比计。折扣线性递减,至最长时长时为零:
discount % = short_max_discount_pct × (59 − minutes) / 54。折扣仅适用于租赁费,不适用于固定手续费。"0" 表示分钟时长按小时费率计价。示例
curl https://api.tronrental.com/v1/bandwidth/prices
import requests
resp = requests.get("https://api.tronrental.com/v1/bandwidth/prices")
print(resp.json())
const resp = await fetch("https://api.tronrental.com/v1/bandwidth/prices");
const data = await resp.json();
console.log(data);
以下数值仅为示例。费率和折扣可能会变化。
Response
{
"price_per_day_trx": "9.6",
"price_sun_1h": 400,
"price_sun_1d": 630,
"min_volume": 1,
"max_volume": 100000,
"fixed_fee_trx": "0.2",
"short_min_minutes": 5,
"short_max_minutes": 59,
"short_max_discount_pct": "5"
}
⌘I
获取带宽价格
curl --request GET \
--url https://api.example.com/api/v1/bandwidth/pricesimport requests
url = "https://api.example.com/api/v1/bandwidth/prices"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('https://api.example.com/api/v1/bandwidth/prices', 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://api.example.com/api/v1/bandwidth/prices",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$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://api.example.com/api/v1/bandwidth/prices"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.example.com/api/v1/bandwidth/prices")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/bandwidth/prices")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body{
"price_per_day_trx": "<string>",
"price_sun_1h": 123,
"price_sun_1d": 123,
"min_volume": 123,
"max_volume": 123,
"fixed_fee_trx": "<string>",
"short_min_minutes": 123,
"short_max_minutes": 123,
"short_max_discount_pct": "<string>"
}