Python (SDK)
from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.morpho.morpho_user_position(chain=models.V1MorphoUserPositionChain.BASE, user_address="0x81d310Eb515E05EB26322e2DeDE9e75b754885A4")
# 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.morpho.morphoUserPosition({
chain: "base",
userAddress: "0x81d310Eb515E05EB26322e2DeDE9e75b754885A4",
});
console.log(result);
}
run();curl --request GET \
--url https://api.compasslabs.ai/v1/morpho/user_position \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.compasslabs.ai/v1/morpho/user_position', 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/morpho/user_position",
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/morpho/user_position"
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/morpho/user_position")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v1/morpho/user_position")
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{
"state": {
"vaultsPnlUsd": "<string>",
"vaultsAssetsUsd": "<string>",
"marketsPnlUsd": "<string>",
"marketsBorrowAssetsUsd": "<string>",
"marketsCollateralUsd": "<string>",
"marketsSupplyAssetsUsd": "<string>"
},
"vaultPositions": [
{
"id": "<string>",
"state": {
"pnlUsd": "<string>",
"assets": "<string>",
"assetsUsd": "<string>",
"shares": "<string>"
},
"vault": {
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"whitelisted": true,
"asset": {
"name": "<string>",
"symbol": "<string>",
"address": "<string>",
"decimals": 123,
"priceUsd": "<string>",
"logoURI": "<string>"
},
"dailyApys": {
"apy": "<string>",
"netApy": "<string>"
},
"weeklyApys": {
"apy": "<string>",
"netApy": "<string>"
},
"monthlyApys": {
"apy": "<string>",
"netApy": "<string>"
}
}
}
],
"marketPositions": [
{
"market": {
"uniqueKey": "<string>"
},
"healthFactor": "<string>",
"priceVariationToLiquidationPrice": "<string>",
"state": {
"pnlUsd": "<string>",
"borrowAssets": "<string>",
"borrowShares": "<string>",
"borrowAssetsUsd": "<string>",
"collateral": "<string>",
"collateralUsd": "<string>",
"supplyAssets": "<string>",
"supplyShares": "<string>",
"supplyAssetsUsd": "<string>"
}
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Morpho
Check User Position
Check user’s overall position across the entire Morpho ecosystem.
Inlcuding all vault and market position metrics and relavant metadata of said vaults and markets.
GET
/
v1
/
morpho
/
user_position
Python (SDK)
from compass_api_sdk import CompassAPI, models
with CompassAPI(
api_key_auth="<YOUR_API_KEY_HERE>",
) as compass_api:
res = compass_api.morpho.morpho_user_position(chain=models.V1MorphoUserPositionChain.BASE, user_address="0x81d310Eb515E05EB26322e2DeDE9e75b754885A4")
# 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.morpho.morphoUserPosition({
chain: "base",
userAddress: "0x81d310Eb515E05EB26322e2DeDE9e75b754885A4",
});
console.log(result);
}
run();curl --request GET \
--url https://api.compasslabs.ai/v1/morpho/user_position \
--header 'x-api-key: <api-key>'const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.compasslabs.ai/v1/morpho/user_position', 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/morpho/user_position",
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/morpho/user_position"
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/morpho/user_position")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.compasslabs.ai/v1/morpho/user_position")
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{
"state": {
"vaultsPnlUsd": "<string>",
"vaultsAssetsUsd": "<string>",
"marketsPnlUsd": "<string>",
"marketsBorrowAssetsUsd": "<string>",
"marketsCollateralUsd": "<string>",
"marketsSupplyAssetsUsd": "<string>"
},
"vaultPositions": [
{
"id": "<string>",
"state": {
"pnlUsd": "<string>",
"assets": "<string>",
"assetsUsd": "<string>",
"shares": "<string>"
},
"vault": {
"address": "<string>",
"name": "<string>",
"symbol": "<string>",
"whitelisted": true,
"asset": {
"name": "<string>",
"symbol": "<string>",
"address": "<string>",
"decimals": 123,
"priceUsd": "<string>",
"logoURI": "<string>"
},
"dailyApys": {
"apy": "<string>",
"netApy": "<string>"
},
"weeklyApys": {
"apy": "<string>",
"netApy": "<string>"
},
"monthlyApys": {
"apy": "<string>",
"netApy": "<string>"
}
}
}
],
"marketPositions": [
{
"market": {
"uniqueKey": "<string>"
},
"healthFactor": "<string>",
"priceVariationToLiquidationPrice": "<string>",
"state": {
"pnlUsd": "<string>",
"borrowAssets": "<string>",
"borrowShares": "<string>",
"borrowAssetsUsd": "<string>",
"collateral": "<string>",
"collateralUsd": "<string>",
"supplyAssets": "<string>",
"supplyShares": "<string>",
"supplyAssetsUsd": "<string>"
}
}
]
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Query Parameters
Available options:
arbitrum, base, ethereum The user wallet address of the desired user position.
Response
Successful Response
A snapshot of the user's overall state in the Morpho ecosystem.
Show child attributes
Show child attributes
A list of the user's vault positions.
Show child attributes
Show child attributes
A list of the user's market positions.
Show child attributes
Show child attributes
Was this page helpful?
⌘I