Markets
Get Market Config
Read the on-chain risk parameters for a market
GET
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
config
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/config" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/config`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data === null) throw new Error('Market config unreadable, retry');
const bufferBps = Number(data.liquidationThreshold) - Number(data.collateralFactor);
{
"success": true,
"data": {
"collateralFactor": "7500",
"liquidationThreshold": "8500",
"liquidationPenalty": "500",
"protocolFeeRate": "0",
"minBorrowAmount": "100.0",
"closeFactor": "5000",
"maxTotalCollateral": "0.0",
"maxUserCollateral": "0.0",
"useDutchAuction": false,
"auctionDuration": "3600",
"auctionStartPremium": "13000",
"auctionMinPremium": "9500"
}
}
Returns the market’s live
config struct: risk parameters, the insurance-fund rate, supply caps, and auction settings. These are the values the contract enforces. The read also corrects the market record wherever it disagrees, on every instance’s record of the same market.
Two things a market operator often looks for are not in this struct. maxPriceAge, the staleness window, belongs to the oracle and is on Get Oracle Status. The rate mode, the term offering and the reserve ratio belong to the interest model and the market’s own storage, and are on Get Market Metrics.
Path Parameters
string
required
Response Fields
object
Show child attributes
Show child attributes
string
Maximum loan to value in basis points.
7500 allows borrowing up to 75 percent of collateral value.string
Loan to value at which the health factor reaches
1.0, in basis points.string
Penalty applied to liquidated debt in basis points. A loan liquidated on its term carries its term penalty instead.
string
The insurance-fund rate, in basis points. Of repaid interest, the Trusset infrastructure fee comes off first, then the fixed operator and distributor shares. This rate is taken from what remains and swept into the market’s insurance fund.
0 on a new market.string
Minimum borrow per loan, in borrow asset units.
string
Maximum fraction of a loan’s debt repayable in one liquidation, in basis points.
string
Global collateral cap in collateral token units.
0.0 means uncapped.string
Per-borrower collateral cap in collateral token units.
0.0 means uncapped.boolean
Whether liquidations open a Dutch auction instead of routing collateral straight to the liquidation router.
string
Auction length in seconds.
string
Opening price multiplier in basis points.
13000 starts the auction at 1.3 times oracle price.string
Floor price multiplier in basis points.
9500 ends the auction at 0.95 times oracle price.The endpoint returns
data: null when the contract read fails. It does not return an error status in that case, so check for null before destructuring.Reading the Parameters Together
A loan opens at up tocollateralFactor and becomes liquidatable when its loan to value crosses liquidationThreshold. The gap between the two is the borrower’s buffer. On liquidation, at most closeFactor of the debt is repaid in a single call, and liquidationPenalty is charged on the repaid portion.
A new market starts at a 75 percent collateral factor, an 85 percent liquidation threshold, a 5 percent penalty and a 50 percent close factor. It has no caps and no insurance-fund rate, and its minimum borrow is 100 whole units of the borrow asset. Dutch auctions start off, set to run one hour from a 130 percent start premium down to a 95 percent floor, or 98 percent on a MARKET-priced market. Update Market Config changes these within the contract’s bounds.
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/config" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/config`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data === null) throw new Error('Market config unreadable, retry');
const bufferBps = Number(data.liquidationThreshold) - Number(data.collateralFactor);
{
"success": true,
"data": {
"collateralFactor": "7500",
"liquidationThreshold": "8500",
"liquidationPenalty": "500",
"protocolFeeRate": "0",
"minBorrowAmount": "100.0",
"closeFactor": "5000",
"maxTotalCollateral": "0.0",
"maxUserCollateral": "0.0",
"useDutchAuction": false,
"auctionDuration": "3600",
"auctionStartPremium": "13000",
"auctionMinPremium": "9500"
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
NO_MARKET_ADDRESS | 400 | The market has no on-chain address recorded |
MISSING_MARKET_ID | 400 | marketId is longer than 100 characters |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
⌘I
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/config" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/config`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data === null) throw new Error('Market config unreadable, retry');
const bufferBps = Number(data.liquidationThreshold) - Number(data.collateralFactor);
{
"success": true,
"data": {
"collateralFactor": "7500",
"liquidationThreshold": "8500",
"liquidationPenalty": "500",
"protocolFeeRate": "0",
"minBorrowAmount": "100.0",
"closeFactor": "5000",
"maxTotalCollateral": "0.0",
"maxUserCollateral": "0.0",
"useDutchAuction": false,
"auctionDuration": "3600",
"auctionStartPremium": "13000",
"auctionMinPremium": "9500"
}
}
