Markets
Get Market History
Read indexed time series of pool state, rates and volumes
GET
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
history
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/history?range=7d&resolution=hour" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/history?range=30d`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.available && data.indexed) {
chart(data.points);
}
{
"success": true,
"data": {
"marketId": "cmssh7p1k0001cghxq2m4v8rz",
"marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"borrowAssetSymbol": "USDC",
"collateralTokenSymbol": "NYF1",
"available": true,
"indexed": true,
"reason": null,
"message": null,
"range": "7d",
"resolution": "hour",
"borrowAsset": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"borrowAssetDecimals": 6,
"collateralToken": "0x9f8c1d4b2e7a3056c1b8f4d29e0a7c3518b6d24f",
"collateralDecimals": 18,
"snapshotCount": 412,
"firstIndexedAt": "2026-09-18T12:00:00.000Z",
"lastIndexedAt": "2026-09-25T11:00:00.000Z",
"truncated": false,
"rateMode": "CLAMPED",
"fixedStampRateBps": null,
"supplyRateBasis": "BORROW_RATE",
"points": [
{
"timestamp": 1789732800000,
"date": "2026-09-18T12:00:00.000Z",
"totalLiquidity": "250000.0",
"totalBorrowed": "112500.0",
"availableLiquidity": "137500.0",
"poolValue": "250412.881",
"pendingLiquidationDebt": "0.0",
"totalCollateral": "1500.0",
"collateralValue": "157230.0",
"collateralPrice": "104.82",
"utilizationRate": 4500,
"borrowRate": 620,
"supplyRate": 206.3205,
"exchangeRate": "1.001651",
"openLiquidity": "250000.0",
"highLiquidity": "250000.0",
"lowLiquidity": "250000.0",
"openBorrowed": "112500.0",
"highBorrowed": "112500.0",
"lowBorrowed": "112500.0",
"depositVolume": "0",
"withdrawVolume": "0",
"borrowVolume": "0",
"repayVolume": "0",
"liquidationVolume": "0",
"carriedForward": true
}
],
"totals": {
"totalLiquidity": "250000.0",
"totalBorrowed": "112500.0",
"poolValue": "250412.881",
"pendingLiquidationDebt": "0.0",
"totalCollateral": "1500.0",
"collateralValue": "157230.0",
"collateralPrice": "104.82",
"utilizationRate": 4500,
"borrowRate": 620,
"supplyRate": 206.3205,
"cumulativeDeposited": "400000.0",
"cumulativeWithdrawn": "150000.0",
"cumulativeBorrowed": "212500.0",
"cumulativePrincipalRepaid": "100000.0",
"cumulativeInterestPaid": "412.881",
"cumulativeBadDebt": "0.0",
"cumulativeBadDebtCovered": "0.0",
"loanCount": 9,
"activeLoanCount": 3,
"liquidationCount": 1,
"liquidityProviderCount": 4
}
}
}
{
"success": true,
"data": {
"marketId": "cmsv2q8n30007cghx5t1b4k9m",
"marketAddress": "0x1c74f9a2b0e63d581a47c02f9b8de3517a604c2b",
"borrowAssetSymbol": "USDC",
"collateralTokenSymbol": "NYF1",
"available": true,
"indexed": false,
"reason": "MARKET_NOT_INDEXED",
"message": "This market has not been indexed yet",
"range": "30d",
"resolution": "day",
"borrowAssetDecimals": 6,
"collateralDecimals": 18,
"snapshotCount": 0,
"points": [],
"totals": null,
"rateMode": "CURVE",
"fixedStampRateBps": null,
"supplyRateBasis": "BORROW_RATE"
}
}
{
"success": true,
"data": {
"marketId": "cmssh7p1k0001cghxq2m4v8rz",
"marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"borrowAssetSymbol": "USDC",
"collateralTokenSymbol": "NYF1",
"available": false,
"reason": "NOT_CONFIGURED",
"message": "Historical indexing is not configured for this network"
}
}
Returns a bucketed time series for the market, built from on-chain snapshots read through the event index. Use it to chart liquidity, utilization, rates and collateral price over time.
History is an enhancement rather than a dependency, so an indexing outage never fails the request. The call returns
200 with available: false and a reason instead, and callers should branch on available before reading points. A series is cached for up to a minute.
Path Parameters
string
required
Query Parameters
string
default:"30d"
Window to cover. One of
24h, 7d, 30d, 90d, 1y, all, lowercase. Any other value is rejected with VALIDATION_ERROR.string
Bucket size,
hour or day. Defaults to the natural resolution for the range: hour for 24h and 7d, day for everything else.Response Fields
object
Show child attributes
Show child attributes
string
Market ID.
string
Market contract address.
string
Settlement token (stablecoin) symbol.
string
Collateral token symbol, or null.
boolean
Whether indexed history could be read at all. When
false, only reason and message accompany it.boolean
Whether this market has produced at least one snapshot.
string
MARKET_NOT_INDEXED or AWAITING_FIRST_SNAPSHOT when indexed is false, otherwise null. When available is false, one of NOT_CONFIGURED, NO_MARKET_ADDRESS, INDEX_NOT_DEPLOYED, UPSTREAM_ERROR, QUERY_ERROR, EMPTY_RESPONSE, TIMEOUT, NETWORK_ERROR.string
Human-readable explanation accompanying
reason, otherwise null.string
Applied range.
string
Applied resolution.
string
Borrow asset address, as the index records it.
integer
Decimals used to format settlement amounts.
string
Collateral token address, as the index records it.
integer
Decimals used to format collateral amounts.
integer
Total snapshots recorded for this market.
string
ISO 8601 timestamp of the first point returned, or null.
string
ISO 8601 timestamp of the most recent snapshot, or null.
boolean
true when the index returned its cap of 1000 buckets for the window, so the series is incomplete. Narrow the range or use day resolution.string
The market’s rate mode as recorded:
CURVE, CLAMPED or FIXED.integer
The fixed rate new loans are stamped with, or null when the market stamps none.
string
FIXED_STAMP when supply rates were derived from fixedStampRateBps, BORROW_RATE when from each point’s borrow rate.array
Buckets ordered oldest first. The series is capped at the most recent 1000 points after gaps are filled.
Show child attributes
Show child attributes
integer
Bucket start, milliseconds since epoch.
string
Bucket start as an ISO 8601 timestamp.
string
Liquidity supplied to the pool.
string
Principal outstanding.
string
Uncommitted liquidity.
string
Pool value including accrued interest.
string
Debt sitting in unsettled liquidations.
string
Collateral locked, in collateral units.
string
Collateral locked, valued in the borrow asset.
string
Collateral price at the bucket.
integer
Utilization in basis points.
integer
The interest model’s curve rate in basis points, as indexed. On a
FIXED market this is the reference curve, not the stamped rate.number
Supply rate in basis points, derived from the applied borrow rate, the utilization and the market’s fee split. It can carry up to four decimal places.
string
LP share exchange rate.
string
Liquidity at bucket open.
highLiquidity and lowLiquidity accompany it.string
Borrowings at bucket open.
highBorrowed and lowBorrowed accompany it.string
Flow during the bucket.
withdrawVolume, borrowVolume, repayVolume and liquidationVolume accompany it.boolean
Present and
true on a synthesized opening point that carries pre-window state onto the left edge. Its flow volumes are zeroed because they belong to an earlier window.boolean
Present and
true on a point that fills a gap between buckets. It repeats the previous bucket’s state with zero flow volumes.object
Lifetime aggregates for the market, or null before the first snapshot. Carries
totalLiquidity, totalBorrowed, poolValue, pendingLiquidationDebt, totalCollateral, collateralValue, collateralPrice, utilizationRate, borrowRate, supplyRate, cumulativeDeposited, cumulativeWithdrawn, cumulativeBorrowed, cumulativePrincipalRepaid, cumulativeInterestPaid, cumulativeBadDebt, cumulativeBadDebtCovered, loanCount, activeLoanCount, liquidationCount and liquidityProviderCount.Supply rates are derived with today’s figures, not the ones in force at each point. The fee split is read from the market now, and on a
FIXED market the stamp is the rate the market stamps today. Points from before a change of either are restated at the current values.Buckets exist only where something happened. Gaps are filled by carrying the previous bucket forward, which is exact for pool state because balances genuinely do not change between mutations.
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/history?range=7d&resolution=hour" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/history?range=30d`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.available && data.indexed) {
chart(data.points);
}
{
"success": true,
"data": {
"marketId": "cmssh7p1k0001cghxq2m4v8rz",
"marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"borrowAssetSymbol": "USDC",
"collateralTokenSymbol": "NYF1",
"available": true,
"indexed": true,
"reason": null,
"message": null,
"range": "7d",
"resolution": "hour",
"borrowAsset": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"borrowAssetDecimals": 6,
"collateralToken": "0x9f8c1d4b2e7a3056c1b8f4d29e0a7c3518b6d24f",
"collateralDecimals": 18,
"snapshotCount": 412,
"firstIndexedAt": "2026-09-18T12:00:00.000Z",
"lastIndexedAt": "2026-09-25T11:00:00.000Z",
"truncated": false,
"rateMode": "CLAMPED",
"fixedStampRateBps": null,
"supplyRateBasis": "BORROW_RATE",
"points": [
{
"timestamp": 1789732800000,
"date": "2026-09-18T12:00:00.000Z",
"totalLiquidity": "250000.0",
"totalBorrowed": "112500.0",
"availableLiquidity": "137500.0",
"poolValue": "250412.881",
"pendingLiquidationDebt": "0.0",
"totalCollateral": "1500.0",
"collateralValue": "157230.0",
"collateralPrice": "104.82",
"utilizationRate": 4500,
"borrowRate": 620,
"supplyRate": 206.3205,
"exchangeRate": "1.001651",
"openLiquidity": "250000.0",
"highLiquidity": "250000.0",
"lowLiquidity": "250000.0",
"openBorrowed": "112500.0",
"highBorrowed": "112500.0",
"lowBorrowed": "112500.0",
"depositVolume": "0",
"withdrawVolume": "0",
"borrowVolume": "0",
"repayVolume": "0",
"liquidationVolume": "0",
"carriedForward": true
}
],
"totals": {
"totalLiquidity": "250000.0",
"totalBorrowed": "112500.0",
"poolValue": "250412.881",
"pendingLiquidationDebt": "0.0",
"totalCollateral": "1500.0",
"collateralValue": "157230.0",
"collateralPrice": "104.82",
"utilizationRate": 4500,
"borrowRate": 620,
"supplyRate": 206.3205,
"cumulativeDeposited": "400000.0",
"cumulativeWithdrawn": "150000.0",
"cumulativeBorrowed": "212500.0",
"cumulativePrincipalRepaid": "100000.0",
"cumulativeInterestPaid": "412.881",
"cumulativeBadDebt": "0.0",
"cumulativeBadDebtCovered": "0.0",
"loanCount": 9,
"activeLoanCount": 3,
"liquidationCount": 1,
"liquidityProviderCount": 4
}
}
}
{
"success": true,
"data": {
"marketId": "cmsv2q8n30007cghx5t1b4k9m",
"marketAddress": "0x1c74f9a2b0e63d581a47c02f9b8de3517a604c2b",
"borrowAssetSymbol": "USDC",
"collateralTokenSymbol": "NYF1",
"available": true,
"indexed": false,
"reason": "MARKET_NOT_INDEXED",
"message": "This market has not been indexed yet",
"range": "30d",
"resolution": "day",
"borrowAssetDecimals": 6,
"collateralDecimals": 18,
"snapshotCount": 0,
"points": [],
"totals": null,
"rateMode": "CURVE",
"fixedStampRateBps": null,
"supplyRateBasis": "BORROW_RATE"
}
}
{
"success": true,
"data": {
"marketId": "cmssh7p1k0001cghxq2m4v8rz",
"marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"borrowAssetSymbol": "USDC",
"collateralTokenSymbol": "NYF1",
"available": false,
"reason": "NOT_CONFIGURED",
"message": "Historical indexing is not configured for this network"
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
VALIDATION_ERROR | 400 | range or resolution is not one of the accepted values |
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}/history?range=7d&resolution=hour" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/history?range=30d`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
if (data.available && data.indexed) {
chart(data.points);
}
{
"success": true,
"data": {
"marketId": "cmssh7p1k0001cghxq2m4v8rz",
"marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"borrowAssetSymbol": "USDC",
"collateralTokenSymbol": "NYF1",
"available": true,
"indexed": true,
"reason": null,
"message": null,
"range": "7d",
"resolution": "hour",
"borrowAsset": "0x98ad0ca091552e23c564b41c74282e5343d03e8a",
"borrowAssetDecimals": 6,
"collateralToken": "0x9f8c1d4b2e7a3056c1b8f4d29e0a7c3518b6d24f",
"collateralDecimals": 18,
"snapshotCount": 412,
"firstIndexedAt": "2026-09-18T12:00:00.000Z",
"lastIndexedAt": "2026-09-25T11:00:00.000Z",
"truncated": false,
"rateMode": "CLAMPED",
"fixedStampRateBps": null,
"supplyRateBasis": "BORROW_RATE",
"points": [
{
"timestamp": 1789732800000,
"date": "2026-09-18T12:00:00.000Z",
"totalLiquidity": "250000.0",
"totalBorrowed": "112500.0",
"availableLiquidity": "137500.0",
"poolValue": "250412.881",
"pendingLiquidationDebt": "0.0",
"totalCollateral": "1500.0",
"collateralValue": "157230.0",
"collateralPrice": "104.82",
"utilizationRate": 4500,
"borrowRate": 620,
"supplyRate": 206.3205,
"exchangeRate": "1.001651",
"openLiquidity": "250000.0",
"highLiquidity": "250000.0",
"lowLiquidity": "250000.0",
"openBorrowed": "112500.0",
"highBorrowed": "112500.0",
"lowBorrowed": "112500.0",
"depositVolume": "0",
"withdrawVolume": "0",
"borrowVolume": "0",
"repayVolume": "0",
"liquidationVolume": "0",
"carriedForward": true
}
],
"totals": {
"totalLiquidity": "250000.0",
"totalBorrowed": "112500.0",
"poolValue": "250412.881",
"pendingLiquidationDebt": "0.0",
"totalCollateral": "1500.0",
"collateralValue": "157230.0",
"collateralPrice": "104.82",
"utilizationRate": 4500,
"borrowRate": 620,
"supplyRate": 206.3205,
"cumulativeDeposited": "400000.0",
"cumulativeWithdrawn": "150000.0",
"cumulativeBorrowed": "212500.0",
"cumulativePrincipalRepaid": "100000.0",
"cumulativeInterestPaid": "412.881",
"cumulativeBadDebt": "0.0",
"cumulativeBadDebtCovered": "0.0",
"loanCount": 9,
"activeLoanCount": 3,
"liquidationCount": 1,
"liquidityProviderCount": 4
}
}
}
{
"success": true,
"data": {
"marketId": "cmsv2q8n30007cghx5t1b4k9m",
"marketAddress": "0x1c74f9a2b0e63d581a47c02f9b8de3517a604c2b",
"borrowAssetSymbol": "USDC",
"collateralTokenSymbol": "NYF1",
"available": true,
"indexed": false,
"reason": "MARKET_NOT_INDEXED",
"message": "This market has not been indexed yet",
"range": "30d",
"resolution": "day",
"borrowAssetDecimals": 6,
"collateralDecimals": 18,
"snapshotCount": 0,
"points": [],
"totals": null,
"rateMode": "CURVE",
"fixedStampRateBps": null,
"supplyRateBasis": "BORROW_RATE"
}
}
{
"success": true,
"data": {
"marketId": "cmssh7p1k0001cghxq2m4v8rz",
"marketAddress": "0x70a0e25c7b768b87e658348b3b577678a173e038",
"borrowAssetSymbol": "USDC",
"collateralTokenSymbol": "NYF1",
"available": false,
"reason": "NOT_CONFIGURED",
"message": "Historical indexing is not configured for this network"
}
}
