Get rates
Retrieve indicative exchange rate from specified providers for a given asset pair. Rates are non-executable price signals intended for discovery and display purposes.
Endpoint Permission: Owner, Admin, Non-Signing Admin, Signer, Approver, Editor, Viewer.
For detailed information about error codes and troubleshooting, please refer to our API Error Codes documentation.
const response: Promise<FireblocksResponse<RatesResponse>> = fireblocks.trading.fetchRates(tradingApiFetchRatesRequest);CompletableFuture<ApiResponse<RatesResponse>> response = fireblocks.trading().fetchRates(ratesRequest, idempotencyKey);response = fireblocks.trading.fetch_rates(rates_request, idempotency_key);curl --request POST \
--url https://api.fireblocks.io/v1/trading/rates \
--header 'Content-Type: application/json' \
--data '
{
"scope": [
{
"providerId": "prov_8c3f1a4b2d6e9f7c",
"accountId": "acc_5e9a2d1c4b7f3e8a"
}
],
"baseAssetId": "BTC",
"quoteAssetId": "USD",
"baseAmount": "100.00"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
scope: [{providerId: 'prov_8c3f1a4b2d6e9f7c', accountId: 'acc_5e9a2d1c4b7f3e8a'}],
baseAssetId: 'BTC',
quoteAssetId: 'USD',
baseAmount: '100.00'
})
};
fetch('https://api.fireblocks.io/v1/trading/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.fireblocks.io/v1/trading/rates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'scope' => [
[
'providerId' => 'prov_8c3f1a4b2d6e9f7c',
'accountId' => 'acc_5e9a2d1c4b7f3e8a'
]
],
'baseAssetId' => 'BTC',
'quoteAssetId' => 'USD',
'baseAmount' => '100.00'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fireblocks.io/v1/trading/rates"
payload := strings.NewReader("{\n \"scope\": [\n {\n \"providerId\": \"prov_8c3f1a4b2d6e9f7c\",\n \"accountId\": \"acc_5e9a2d1c4b7f3e8a\"\n }\n ],\n \"baseAssetId\": \"BTC\",\n \"quoteAssetId\": \"USD\",\n \"baseAmount\": \"100.00\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.fireblocks.io/v1/trading/rates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"scope\": [\n {\n \"providerId\": \"prov_8c3f1a4b2d6e9f7c\",\n \"accountId\": \"acc_5e9a2d1c4b7f3e8a\"\n }\n ],\n \"baseAssetId\": \"BTC\",\n \"quoteAssetId\": \"USD\",\n \"baseAmount\": \"100.00\"\n}"
response = http.request(request)
puts response.read_body{
"rates": [
{
"via": {
"type": "PROVIDER_ACCOUNT",
"providerId": "uniswap-v3-provider",
"accountId": "account-123"
},
"baseAssetId": "<string>",
"quoteAssetId": "<string>",
"rate": "1.2345",
"baseAssetRail": "BLOCKCHAIN",
"quoteAssetRail": "BLOCKCHAIN"
}
],
"errors": [
{
"providerId": "BRIDGE",
"error": {
"code": 900,
"message": "Invalid base amount: must be greater than 0"
},
"accountId": "acc_9f4e2d8b1c6a5e73"
}
]
}{
"code": 900,
"message": "Invalid base amount: must be greater than 0"
}{
"code": 900,
"message": "Invalid base amount: must be greater than 0"
}{
"code": 900,
"message": "Invalid base amount: must be greater than 0"
}{
"code": 900,
"message": "Invalid base amount: must be greater than 0"
}{
"code": 900,
"message": "Invalid base amount: must be greater than 0"
}{
"message": "<string>",
"code": 123
}Headers
A unique identifier for the request. If the request is sent multiple times with the same idempotency key, the server will return the same response as the first request. The idempotency key is valid for 24 hours.
Body
One or more providers/accounts to request rates from. At least one scope item is required.
1Show child attributes
Show child attributes
The source asset identifier.
"BTC"
The target asset identifier.
"USD"
The amount to convert from
^\d+(\.\d+)?$"100.00"
Was this page helpful?
const response: Promise<FireblocksResponse<RatesResponse>> = fireblocks.trading.fetchRates(tradingApiFetchRatesRequest);CompletableFuture<ApiResponse<RatesResponse>> response = fireblocks.trading().fetchRates(ratesRequest, idempotencyKey);response = fireblocks.trading.fetch_rates(rates_request, idempotency_key);curl --request POST \
--url https://api.fireblocks.io/v1/trading/rates \
--header 'Content-Type: application/json' \
--data '
{
"scope": [
{
"providerId": "prov_8c3f1a4b2d6e9f7c",
"accountId": "acc_5e9a2d1c4b7f3e8a"
}
],
"baseAssetId": "BTC",
"quoteAssetId": "USD",
"baseAmount": "100.00"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
scope: [{providerId: 'prov_8c3f1a4b2d6e9f7c', accountId: 'acc_5e9a2d1c4b7f3e8a'}],
baseAssetId: 'BTC',
quoteAssetId: 'USD',
baseAmount: '100.00'
})
};
fetch('https://api.fireblocks.io/v1/trading/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.fireblocks.io/v1/trading/rates",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'scope' => [
[
'providerId' => 'prov_8c3f1a4b2d6e9f7c',
'accountId' => 'acc_5e9a2d1c4b7f3e8a'
]
],
'baseAssetId' => 'BTC',
'quoteAssetId' => 'USD',
'baseAmount' => '100.00'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.fireblocks.io/v1/trading/rates"
payload := strings.NewReader("{\n \"scope\": [\n {\n \"providerId\": \"prov_8c3f1a4b2d6e9f7c\",\n \"accountId\": \"acc_5e9a2d1c4b7f3e8a\"\n }\n ],\n \"baseAssetId\": \"BTC\",\n \"quoteAssetId\": \"USD\",\n \"baseAmount\": \"100.00\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require 'uri'
require 'net/http'
url = URI("https://api.fireblocks.io/v1/trading/rates")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"scope\": [\n {\n \"providerId\": \"prov_8c3f1a4b2d6e9f7c\",\n \"accountId\": \"acc_5e9a2d1c4b7f3e8a\"\n }\n ],\n \"baseAssetId\": \"BTC\",\n \"quoteAssetId\": \"USD\",\n \"baseAmount\": \"100.00\"\n}"
response = http.request(request)
puts response.read_body{
"rates": [
{
"via": {
"type": "PROVIDER_ACCOUNT",
"providerId": "uniswap-v3-provider",
"accountId": "account-123"
},
"baseAssetId": "<string>",
"quoteAssetId": "<string>",
"rate": "1.2345",
"baseAssetRail": "BLOCKCHAIN",
"quoteAssetRail": "BLOCKCHAIN"
}
],
"errors": [
{
"providerId": "BRIDGE",
"error": {
"code": 900,
"message": "Invalid base amount: must be greater than 0"
},
"accountId": "acc_9f4e2d8b1c6a5e73"
}
]
}{
"code": 900,
"message": "Invalid base amount: must be greater than 0"
}{
"code": 900,
"message": "Invalid base amount: must be greater than 0"
}{
"code": 900,
"message": "Invalid base amount: must be greater than 0"
}{
"code": 900,
"message": "Invalid base amount: must be greater than 0"
}{
"code": 900,
"message": "Invalid base amount: must be greater than 0"
}{
"message": "<string>",
"code": 123
}