Skip to main content
GET
/
v1
/
aave
/
avg_rate
Python (SDK)
from compass_api_sdk import CompassAPI, models


with CompassAPI(
    api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:

    res = compass_api.aave_v3.aave_avg_rate(chain=models.V1AaveAvgRateChain.ETHEREUM, token="USDC", days=2)

    # Handle response
    print(res)
import { CompassApiSDK } from "@compass-labs/api-sdk";

const compassApiSDK = new CompassApiSDK({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});

async function run() {
const result = await compassApiSDK.aaveV3.aaveAvgRate({
chain: "ethereum",
token: "USDC",
days: 2,
});

console.log(result);
}

run();
curl --request GET \
--url https://api.compasslabs.ai/v1/aave/avg_rate \
--header 'x-api-key: <api-key>'
const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};

fetch('https://api.compasslabs.ai/v1/aave/avg_rate', 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.compasslabs.ai/v1/aave/avg_rate",
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-api-key: <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://api.compasslabs.ai/v1/aave/avg_rate"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("x-api-key", "<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://api.compasslabs.ai/v1/aave/avg_rate")
.header("x-api-key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.compasslabs.ai/v1/aave/avg_rate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "supply_apy_variable_rate": 0.5,
  "supply_apr_variable_rate": 0.5,
  "borrow_apy_variable_rate": 0.5,
  "borrow_apr_variable_rate": 0.5,
  "borrow_apy_fixed_rate": 0.5,
  "borrow_apr_fixed_rate": 0.5
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

x-api-key
string
header
required

Your Compass API Key. Get your key here.

Query Parameters

chain
enum<string>
default:ethereum
required
Available options:
arbitrum,
base,
ethereum
block
integer | null

Optional block number (defaults to latest).

token
string
default:USDC
required

The symbol or address of the token.. A token identifier - either a supported symbol (e.g., USDC, WETH) or a valid Ethereum address (0x...)

Examples:

"USDC"

"WETH"

"0xA0b86a33E6441ccF30EE5DdEF1E9b652C91ac1c8"

days
integer
default:2
required

The number of days for which the average shall be calculated.

Required range: 1 <= x <= 30

Response

Successful Response

supply_apy_variable_rate
number
required

Mean of the variable rate APY for deposits.

Required range: 0 <= x <= 1
supply_apr_variable_rate
number
required

Mean of the variable rate APR for deposits.

Required range: 0 <= x <= 1
borrow_apy_variable_rate
number
required

Mean of the variable rate APY for loans.

Required range: 0 <= x <= 1
borrow_apr_variable_rate
number
required

Mean of the variable rate APR for loans.

Required range: 0 <= x <= 1
borrow_apy_fixed_rate
number
required

Mean of the fixed rate APY for loans.

Required range: 0 <= x <= 1
borrow_apr_fixed_rate
number
required

Mean of the fixed rate APR for loans.

Required range: 0 <= x <= 1