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_user_position_per_token(chain=models.V1AaveUserPositionPerTokenChain.BASE, user="0x3254f3b1918637ba924e3F18968Cb74219974b63", token="USDC")
# 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.aaveUserPositionPerToken({
chain: "base",
user: "0x3254f3b1918637ba924e3F18968Cb74219974b63",
token: "USDC",
});
console.log(result);
}
run();curl --request GET \
--url https://api.compasslabs.ai/v1/aave/user_position_per_token \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.compasslabs.ai/v1/aave/user_position_per_token', 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/user_position_per_token",
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/user_position_per_token"
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/user_position_per_token")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v1/aave/user_position_per_token")
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{
"token_balance": "<string>",
"stable_debt": "<string>",
"variable_debt": "<string>",
"principal_stable_debt": "<string>",
"principal_variable_debt": "<string>",
"stable_borrow_rate": "<string>",
"stable_borrow_rate_for_new_loans": "<string>",
"variable_borrow_rate": "<string>",
"liquidity_rate": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Positions - per Token
This endpoint retrieves the user’s position for a specific token on the AAVE platform.
It provides key financial metrics including the current aToken balance, current stable debt, current variable debt, principal stable debt, principal variable debt, stable borrow rate, stable borrow rate for new loans, variable borrow rate, and liquidity rate. These metrics are calculated by aggregating data across all open positions held by the user for the specified token, offering a detailed view of their financial standing within the AAVE ecosystem.
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_user_position_per_token(chain=models.V1AaveUserPositionPerTokenChain.BASE, user="0x3254f3b1918637ba924e3F18968Cb74219974b63", token="USDC")
# 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.aaveUserPositionPerToken({
chain: "base",
user: "0x3254f3b1918637ba924e3F18968Cb74219974b63",
token: "USDC",
});
console.log(result);
}
run();curl --request GET \
--url https://api.compasslabs.ai/v1/aave/user_position_per_token \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.compasslabs.ai/v1/aave/user_position_per_token', 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/user_position_per_token",
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/user_position_per_token"
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/user_position_per_token")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v1/aave/user_position_per_token")
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{
"token_balance": "<string>",
"stable_debt": "<string>",
"variable_debt": "<string>",
"principal_stable_debt": "<string>",
"principal_variable_debt": "<string>",
"stable_borrow_rate": "<string>",
"stable_borrow_rate_for_new_loans": "<string>",
"variable_borrow_rate": "<string>",
"liquidity_rate": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Your Compass API Key. Get your key here.
Query Parameters
Response
Successful Response
The amount of the user's debt that was part of the initial principal of all loans with a variable interest rate. This is the value stored by AAVE, which may be slightly inaccurate, but reflects what AAVE believes you initially paid.
^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$Was this page helpful?