Skip to main content
GET
/
v2
/
credit
/
looped_positions
Python (SDK)
from compass_api_sdk import CompassAPI, models


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

    res = compass_api.credit.credit_looped_positions(chain=models.V2CreditLoopedPositionsChain.BASE, owner="0x06A9aF046187895AcFc7258450B15397CAc67400")

    # 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.credit.creditLoopedPositions({
chain: "base",
owner: "0x06A9aF046187895AcFc7258450B15397CAc67400",
});

console.log(result);
}

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

fetch('https://api.compasslabs.ai/v2/credit/looped_positions', 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/v2/credit/looped_positions",
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/v2/credit/looped_positions"

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/v2/credit/looped_positions")
.header("x-api-key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.compasslabs.ai/v2/credit/looped_positions")

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
{
  "credit_account_address": "<string>",
  "positions": [
    {
      "collateral_symbol": "WETH",
      "collateral_token": "0x4200000000000000000000000000000000000006",
      "current": {
        "collateral_amount": "3.0000000000",
        "collateral_usd": "9000.0000000000",
        "debt_amount": "5000.0000000000",
        "debt_usd": "5000.0000000000",
        "health_factor": "1.5480000000",
        "health_factor_scope": "market",
        "leverage": "2.2500000000",
        "net_usd_value": "4000.0000000000"
      },
      "debt_symbol": "USDC",
      "debt_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "history": [
        {
          "block_number": 25000000,
          "block_timestamp": "2025-01-15T10:30:00Z",
          "classification": "loop_open",
          "collateral_delta": "3.0000000000",
          "debt_delta": "5000.0000000000",
          "events": [],
          "iterations": 2,
          "swap": {
            "bought_amount": "1.6600000000",
            "bought_symbol": "WETH",
            "bought_token": "0x4200000000000000000000000000000000000006",
            "sold_amount": "5000.0000000000",
            "sold_symbol": "USDC",
            "sold_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
          },
          "transaction_hash": "0x1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890"
        }
      ],
      "market_id": "0x8793cf302b8ffd655ab97bd1c695dbd967807e8367a65cb2f4edaf1380ba1bda",
      "opened_at": "2025-01-15T10:30:00Z",
      "protocol": "MORPHO",
      "status": "OPEN",
      "totals": {
        "liquidation_count": 0,
        "loop_tx_count": 1,
        "total_collateral_added": "3.0000000000",
        "total_collateral_removed": "0.0000000000",
        "total_debt_added": "5000.0000000000",
        "total_debt_removed": "0.0000000000",
        "unwind_tx_count": 0
      }
    }
  ],
  "aave_account_summary": {
    "health_factor": "<string>",
    "total_collateral_usd": "<string>",
    "total_debt_usd": "<string>",
    "available_borrows_usd": "<string>",
    "ltv": "<string>",
    "protocol": "AAVE",
    "sub_account_id": 123,
    "emode_category_id": 0,
    "emode_label": "<string>"
  }
}
{
"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:base
required
Available options:
arbitrum,
base,
bsc,
ethereum,
tempo
owner
string
default:0x06A9aF046187895AcFc7258450B15397CAc67400
required

The address of the owner of the credit account to get looped positions for.

Response

Successful Response

Looped positions across Aave V3 and Morpho Blue for a credit account.

credit_account_address
string
required

The credit product account address derived from the owner.

positions
LoopedPosition · object[]

All looped positions, on both Aave and Morpho.

Example:
[
{
"collateral_symbol": "WETH",
"collateral_token": "0x4200000000000000000000000000000000000006",
"current": {
"collateral_amount": "3.0000000000",
"collateral_usd": "9000.0000000000",
"debt_amount": "5000.0000000000",
"debt_usd": "5000.0000000000",
"health_factor": "1.5480000000",
"health_factor_scope": "market",
"leverage": "2.2500000000",
"net_usd_value": "4000.0000000000"
},
"debt_symbol": "USDC",
"debt_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"history": [
{
"block_number": 25000000,
"block_timestamp": "2025-01-15T10:30:00Z",
"classification": "loop_open",
"collateral_delta": "3.0000000000",
"debt_delta": "5000.0000000000",
"events": [],
"iterations": 2,
"swap": {
"bought_amount": "1.6600000000",
"bought_symbol": "WETH",
"bought_token": "0x4200000000000000000000000000000000000006",
"sold_amount": "5000.0000000000",
"sold_symbol": "USDC",
"sold_token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
},
"transaction_hash": "0x1a2b3c4d5e6f7890abcdef1234567890abcdef1234567890abcdef1234567890"
}
],
"market_id": "0x8793cf302b8ffd655ab97bd1c695dbd967807e8367a65cb2f4edaf1380ba1bda",
"opened_at": "2025-01-15T10:30:00Z",
"protocol": "MORPHO",
"status": "OPEN",
"totals": {
"liquidation_count": 0,
"loop_tx_count": 1,
"total_collateral_added": "3.0000000000",
"total_collateral_removed": "0.0000000000",
"total_debt_added": "5000.0000000000",
"total_debt_removed": "0.0000000000",
"unwind_tx_count": 0
}
}
]
aave_account_summary
AccountSummary · object | null

Aave account-level summary (health factor, LTV, borrow capacity). Present when the account holds any open Aave looped position, since Aave collateral is pooled and health is account-level. Null for Morpho-only accounts.