Liquidations
Get Liquidation Stats
Aggregate liquidation counters from chain and from Trusset records
GET
/
lending-external-securities-v2
/
api
/
liquidations
/
{marketId}
/
liquidation-stats
curl "https://api.trusset.org/lending-external-securities-v2/api/liquidations/{marketId}/liquidation-stats" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/liquidations/${marketId}/liquidation-stats`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.onChain?.readFailed) console.warn('On-chain counters are incomplete');
{
"success": true,
"data": {
"onChain": {
"totalLiquidations": 5,
"pendingLiquidationDebt": "21159.2",
"totalAuctions": 2
},
"database": {
"pending": 1,
"settled": 3,
"stuck": 0,
"writtenOff": 1
}
}
}
Returns liquidation totals from two sources side by side: counters read from the market contract and its auction venue, and record counts grouped by status from the Trusset database.
The endpoint reconciles pending liquidations from the chain before counting, so adopted records are included.
A failed database read answers
Path Parameters
string
required
The market’s record ID, as
id on List Markets, not its contract address. See Market IDs. At most 100 characters.Response Fields
object
Show child attributes
Show child attributes
object
Contract counters.
null only when the market has no on-chain address.Show child attributes
Show child attributes
integer
Liquidation records the market has opened over its lifetime, on either trigger and on either path.
string
Debt seized but not yet settled or written off, in borrow asset units.
integer
Dutch auctions the market’s auction venue has opened.
0 when no venue is wired.boolean
Present and
true when a counter could not be read. The unread counters then read 0, so zeros alongside this flag are not a fact about the market.object
Show child attributes
Show child attributes
integer
Records awaiting settlement, including records whose auction is still open and records the router administrator reopened.
integer
Records settled. This includes auctions that sold their whole lot, atomic sales to the sale recipient, and router records closed without proceeds.
integer
Liquidations written off after the 7 day timeout, with bad debt covered by the insurance fund. The fund pays what its balance allows, and the pool bears the principal it does not cover.
integer
Always
0 for external securities markets. See the note below.stuck counts intermediate states produced by the automated sell orchestrator, which external securities markets do not use. It is always 0 here and carries no signal. A settlement that has genuinely stalled shows up as a long-lived pending record. Compare createdAt on Get Pending Liquidations against the 7 day write-off window to find them.onChain.pendingLiquidationDebt above zero with database.pending at zero means the market still carries debt that no open record here accounts for. A router record settled at zero directly on-chain, before its collateral left the router, produces exactly this. The market’s own record then stays open until the write-off, and List Settled Liquidations flags the collateral left behind as collateralStranded.curl "https://api.trusset.org/lending-external-securities-v2/api/liquidations/{marketId}/liquidation-stats" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/liquidations/${marketId}/liquidation-stats`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.onChain?.readFailed) console.warn('On-chain counters are incomplete');
{
"success": true,
"data": {
"onChain": {
"totalLiquidations": 5,
"pendingLiquidationDebt": "21159.2",
"totalAuctions": 2
},
"database": {
"pending": 1,
"settled": 3,
"stuck": 0,
"writtenOff": 1
}
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
MISSING_MARKET_ID | 400 | marketId is longer than 100 characters |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
200 with every database count at 0.⌘I
curl "https://api.trusset.org/lending-external-securities-v2/api/liquidations/{marketId}/liquidation-stats" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/liquidations/${marketId}/liquidation-stats`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.onChain?.readFailed) console.warn('On-chain counters are incomplete');
{
"success": true,
"data": {
"onChain": {
"totalLiquidations": 5,
"pendingLiquidationDebt": "21159.2",
"totalAuctions": 2
},
"database": {
"pending": 1,
"settled": 3,
"stuck": 0,
"writtenOff": 1
}
}
}
