curl --request GET \
--url https://api.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio \
--header 'x-amberdata-blockchain-id: <x-amberdata-blockchain-id>' \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio"
headers = {
"x-amberdata-blockchain-id": "<x-amberdata-blockchain-id>",
"x-api-key": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'x-amberdata-blockchain-id': '<x-amberdata-blockchain-id>',
'x-api-key': '<api-key>'
}
};
fetch('https://api.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio', 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.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio",
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-amberdata-blockchain-id: <x-amberdata-blockchain-id>",
"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.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-amberdata-blockchain-id", "<x-amberdata-blockchain-id>")
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.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio")
.header("x-amberdata-blockchain-id", "<x-amberdata-blockchain-id>")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-amberdata-blockchain-id"] = '<x-amberdata-blockchain-id>'
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status": 200,
"title": "OK",
"description": "Successful request",
"payload": {
"metadata": {
"next": null
},
"data": {
"timestamp": "2022-11-07 20:02:00 000",
"totalLiquidityETH": 1.960386955045967,
"totalLiquidityUSD": 3141.9905883303727,
"totalCollateralETH": 1.960386955045967,
"totalCollateralUSD": 3141.9905883303727,
"totalBorrowedETH": 0.8354476352995496,
"totalBorrowedUSD": 1339.005343,
"availableToBorrowETH": 0.5745894213541245,
"availableToBorrowUSD": 920.9174491811094,
"netWorthETH": 1.1249393197464175,
"netWorthUSD": 1802.985245330373,
"lifetimeRewardsETH": 0,
"lifetimeRewardsUSD": 0,
"unclaimedRewardsETH": 0,
"unclaimedRewardsUSD": 0,
"healthFactor": 1.805087884251727,
"loanToValueRatio": 0.719264659981688,
"liquidationThresholdRatio": 0.769264659981688,
"positions": [
{
"assetId": "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6",
"assetSymbol": "WBTC",
"positionType": "Lend",
"isCollateral": true,
"loanToValueRatio": 0.7,
"liquidationThresholdRatio": 0.75,
"amountNative": 0.09259605,
"amountUSD": 1931.4029813334043,
"interestRateAPY": 0.00035615996484214454,
"interestRateType": "Stable"
}
]
}
}
}Track Positions - Lending Wallets
This API retrieves the balances of a given address within supported lending protocols.
curl --request GET \
--url https://api.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio \
--header 'x-amberdata-blockchain-id: <x-amberdata-blockchain-id>' \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio"
headers = {
"x-amberdata-blockchain-id": "<x-amberdata-blockchain-id>",
"x-api-key": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {
'x-amberdata-blockchain-id': '<x-amberdata-blockchain-id>',
'x-api-key': '<api-key>'
}
};
fetch('https://api.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio', 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.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio",
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-amberdata-blockchain-id: <x-amberdata-blockchain-id>",
"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.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("x-amberdata-blockchain-id", "<x-amberdata-blockchain-id>")
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.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio")
.header("x-amberdata-blockchain-id", "<x-amberdata-blockchain-id>")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amberdata.com/defi/lending/{protocolId}/wallets/{address}/portfolio")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["x-amberdata-blockchain-id"] = '<x-amberdata-blockchain-id>'
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"status": 200,
"title": "OK",
"description": "Successful request",
"payload": {
"metadata": {
"next": null
},
"data": {
"timestamp": "2022-11-07 20:02:00 000",
"totalLiquidityETH": 1.960386955045967,
"totalLiquidityUSD": 3141.9905883303727,
"totalCollateralETH": 1.960386955045967,
"totalCollateralUSD": 3141.9905883303727,
"totalBorrowedETH": 0.8354476352995496,
"totalBorrowedUSD": 1339.005343,
"availableToBorrowETH": 0.5745894213541245,
"availableToBorrowUSD": 920.9174491811094,
"netWorthETH": 1.1249393197464175,
"netWorthUSD": 1802.985245330373,
"lifetimeRewardsETH": 0,
"lifetimeRewardsUSD": 0,
"unclaimedRewardsETH": 0,
"unclaimedRewardsUSD": 0,
"healthFactor": 1.805087884251727,
"loanToValueRatio": 0.719264659981688,
"liquidationThresholdRatio": 0.769264659981688,
"positions": [
{
"assetId": "0x1bfd67037b42cf73acf2047067bd4f2c47d9bfd6",
"assetSymbol": "WBTC",
"positionType": "Lend",
"isCollateral": true,
"loanToValueRatio": 0.7,
"liquidationThresholdRatio": 0.75,
"amountNative": 0.09259605,
"amountUSD": 1931.4029813334043,
"interestRateAPY": 0.00035615996484214454,
"interestRateType": "Stable"
}
]
}
}
}Authorizations
Headers
[Optional] The id of the blockchain for which you want protocol data from. Defaults to ethereum-mainnet if not specified. Use the Information Protocols API to view the supported protocol and blockchain id combinations.
ethereum-mainnet, polygon-mainnet, avalanche-mainnet, arbitrum-mainnet, optimism-mainnet Path Parameters
aavev2, aavev3, compoundv2, compoundv3, makerdao The address for which the portfolio summary is desired. Example address is for aavev3 plus polygon-mainnet only.
Query Parameters
[Optional] Time format of the timestamps in the return payload.
milliseconds, ms, iso, iso8601, hr, human_readable [Optional] If provided, returns the balances of the address at this date. Enables historical look-back of the portfolio.
[Formats] seconds | milliseconds | iso8601
[Examples] 1578531600 | 1578531600000 | 2020-09-01T01:00:00
[Warning] Cannot be combined with blockNumber, use only one, either endDate or blockNumber.
[Optional] If provided, returns the balances of the address when this block was finalized. Enables historical look-back of the portfolio.
[Warning] Cannot be combined with endDate, use only one, either blockNumber or endDate.
Was this page helpful?