curl --request GET \
--url https://api.amberdata.com/defi/lending/wallets/{walletAddress}/returns \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/defi/lending/wallets/{walletAddress}/returns"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.amberdata.com/defi/lending/wallets/{walletAddress}/returns', 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/wallets/{walletAddress}/returns",
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.amberdata.com/defi/lending/wallets/{walletAddress}/returns"
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.amberdata.com/defi/lending/wallets/{walletAddress}/returns")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amberdata.com/defi/lending/wallets/{walletAddress}/returns")
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{
"status": 200,
"title": "OK",
"description": "Successful request",
"payload": {
"metadata": {
"blockchainId": "ethereum-mainnet"
},
"data": {
"metrics": [
{
"timestamp": "2023-02-01 23:59:59 999",
"totalLiquidityUSD": 8656.285473022097,
"totalCollateralUSD": 4358.700898606331,
"totalBorrowedUSD": 0,
"netWorthUSD": 8656.285473022097,
"changeInLendInterestUSD": 0.5259982184550633,
"changeInBorrowInterestUSD": 0.0014350103195127153,
"marketValueLendInterestUSD": 0.3368423914981944,
"marketValueBorrowInterestUSD": 0,
"cumulativeLendInterestUSD": 19.6001513365206,
"cumulativeBorrowInterestUSD": 0.049160105311165075,
"netWorthInProtocols": [
{
"protocolId": "aavev2",
"totalLiquidityUSD": 4358.700898606331,
"totalCollateralUSD": 4358.700898606331,
"totalBorrowedUSD": 0,
"netWorthUSD": 4358.700898606331,
"changeInLendInterestUSD": 0.3338916490191206,
"changeInBorrowInterestUSD": 0.0014350103195127153,
"marketValueLendInterestUSD": 0.18517998485067053,
"marketValueBorrowInterestUSD": 0,
"cumulativeLendInterestUSD": 11.058956431389353,
"cumulativeBorrowInterestUSD": 0.049160105311165075
}
]
}
]
}
}
}Profit & Loss Analytics in DeFi Lending
Analyze a wallet’s historical yield, net worth and interest owed from lending and borrowing assets across different DeFi protocols.
curl --request GET \
--url https://api.amberdata.com/defi/lending/wallets/{walletAddress}/returns \
--header 'x-api-key: <api-key>'import requests
url = "https://api.amberdata.com/defi/lending/wallets/{walletAddress}/returns"
headers = {"x-api-key": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.amberdata.com/defi/lending/wallets/{walletAddress}/returns', 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/wallets/{walletAddress}/returns",
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.amberdata.com/defi/lending/wallets/{walletAddress}/returns"
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.amberdata.com/defi/lending/wallets/{walletAddress}/returns")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.amberdata.com/defi/lending/wallets/{walletAddress}/returns")
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{
"status": 200,
"title": "OK",
"description": "Successful request",
"payload": {
"metadata": {
"blockchainId": "ethereum-mainnet"
},
"data": {
"metrics": [
{
"timestamp": "2023-02-01 23:59:59 999",
"totalLiquidityUSD": 8656.285473022097,
"totalCollateralUSD": 4358.700898606331,
"totalBorrowedUSD": 0,
"netWorthUSD": 8656.285473022097,
"changeInLendInterestUSD": 0.5259982184550633,
"changeInBorrowInterestUSD": 0.0014350103195127153,
"marketValueLendInterestUSD": 0.3368423914981944,
"marketValueBorrowInterestUSD": 0,
"cumulativeLendInterestUSD": 19.6001513365206,
"cumulativeBorrowInterestUSD": 0.049160105311165075,
"netWorthInProtocols": [
{
"protocolId": "aavev2",
"totalLiquidityUSD": 4358.700898606331,
"totalCollateralUSD": 4358.700898606331,
"totalBorrowedUSD": 0,
"netWorthUSD": 4358.700898606331,
"changeInLendInterestUSD": 0.3338916490191206,
"changeInBorrowInterestUSD": 0.0014350103195127153,
"marketValueLendInterestUSD": 0.18517998485067053,
"marketValueBorrowInterestUSD": 0,
"cumulativeLendInterestUSD": 11.058956431389353,
"cumulativeBorrowInterestUSD": 0.049160105311165075
}
]
}
]
}
}
}Authorizations
Headers
[Optional] The id of the blockchain for which you want data from. Defaults to ethereum-mainnet if not specified.
ethereum-mainnet, avalanche-mainnet, arbitrum-mainnet, optimism-mainnet Path Parameters
The address to analyze.
Note Across different blockchains, a single user will most likely have different addresses i.e. the address on ethereum-mainnet will not be the same address on avalanche-mainnet.
Query Parameters
[Optional] Payload only includes data after this date (inclusive).
[Formats] seconds | milliseconds | iso8601
[Examples] 1578531600 | 1578531600000 | 2020-09-01T01:00:00
[Optional] Payload only includes data after this date (inclusive).
[Formats] seconds | milliseconds | iso8601
[Examples] 1578531600 | 1578531600000 | 2020-09-01T01:00:00
[Optional] Time format of the timestamps in the return payload.
milliseconds, ms, iso, iso8601, hr, human_readable Was this page helpful?