Get asset rates
curl --request GET \
--url https://api.enterprise.sandbox.uphold.com/core/assets/{asset}/rates \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.enterprise.sandbox.uphold.com/core/assets/{asset}/rates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.enterprise.sandbox.uphold.com/core/assets/{asset}/rates', 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.enterprise.sandbox.uphold.com/core/assets/{asset}/rates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.enterprise.sandbox.uphold.com/core/assets/{asset}/rates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.enterprise.sandbox.uphold.com/core/assets/{asset}/rates")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enterprise.sandbox.uphold.com/core/assets/{asset}/rates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"rates": {
"ETH": {
"ask": "22.910619213684715739",
"bid": "22.85842248147463121064",
"mid": "22.88452084757967347482"
},
"GBP": {
"ask": "47027.64159916551332431855",
"bid": "46908.53407930127413227339",
"mid": "46968.08783923339372829597"
},
"USD": {
"ask": "61023.8527432818",
"bid": "60946.4628910217",
"mid": "60985.15781715175"
}
}
}{
"code": "entity_not_found",
"message": "The asset cannot be found",
"details": {
"entity": "asset"
}
}{
"code": "asset_pair_not_supported",
"message": "Rates are not available for the requested asset pair"
}Assets
Get asset rates
Retrieve asset rates against other assets.
GET
/
core
/
assets
/
{asset}
/
rates
Get asset rates
curl --request GET \
--url https://api.enterprise.sandbox.uphold.com/core/assets/{asset}/rates \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.enterprise.sandbox.uphold.com/core/assets/{asset}/rates"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.enterprise.sandbox.uphold.com/core/assets/{asset}/rates', 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.enterprise.sandbox.uphold.com/core/assets/{asset}/rates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.enterprise.sandbox.uphold.com/core/assets/{asset}/rates"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.enterprise.sandbox.uphold.com/core/assets/{asset}/rates")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.enterprise.sandbox.uphold.com/core/assets/{asset}/rates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"rates": {
"ETH": {
"ask": "22.910619213684715739",
"bid": "22.85842248147463121064",
"mid": "22.88452084757967347482"
},
"GBP": {
"ask": "47027.64159916551332431855",
"bid": "46908.53407930127413227339",
"mid": "46968.08783923339372829597"
},
"USD": {
"ask": "61023.8527432818",
"bid": "60946.4628910217",
"mid": "60985.15781715175"
}
}
}{
"code": "entity_not_found",
"message": "The asset cannot be found",
"details": {
"entity": "asset"
}
}{
"code": "asset_pair_not_supported",
"message": "Rates are not available for the requested asset pair"
}Denomination
Thedenomination query parameter allows you to denominate rates against one or multiple assets. If no value is set for this parameter, the rates for all available assets will be returned.
There is a specific set of assets allowed, including but not limited to: USD, EUR, GBP, AUD, CAD, NZD, MXN, and BTC. If you need a particular asset added to this list, please reach out to your Account Manager.
For a more detailed explanation of the denomination concept, check the Core API introduction page.
Retrieving multiple asset rates at once
You can use the denomination currency as a proxy for retrieving the specific asset rates you’re interested in. This way, you won’t have to:- Make one Get Asset Rates request per each asset rate desired
- Discard all the undesired assets rates retrieved by default
BTC and ETH in USD:
- Define
assetasUSD - Set
denominationas the list of desired assets:BTC,ETH - Calculate the inverse for each returned asset rate: rate1
denomination parameter per request.Query Parameters
Was this page helpful?