Oracle
Get Oracle History
List recorded price attestations beside the prices that landed on the oracle
GET
/
lending-external-securities-v2
/
api
/
markets
/
{marketId}
/
oracle-history
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/oracle-history?limit=20" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/oracle-history?limit=20`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"signed": [
{
"id": "clx4k2p9e0001m8tq3v7h5z2a",
"price": "105.4",
"priceWei": "105400000",
"attestedAt": "2024-06-15T10:00:00.000Z",
"validUntil": "2024-06-15T10:05:00.000Z",
"signer": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"source": "API",
"pushedTxHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"pushedAt": "2024-06-15T10:01:12.000Z"
}
],
"pushed": [
{
"id": "clx4k3a1f0004m8tq9c2d6e1b",
"price": "105.4",
"priceWei": "105400000",
"previousPrice": "104.82",
"updater": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"txHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"blockNumber": 6120451,
"pushedAt": "2024-06-15T10:01:12.000Z"
}
],
"syncedBlock": 6120448,
"settlementSymbol": "USDC",
"limit": 20,
"offset": 0,
"signedTotal": 1,
"pushedTotal": 1,
"signedHasMore": false,
"pushedHasMore": false
}
}
{
"success": false,
"error": {
"code": "NO_ORACLE",
"message": "No oracle is configured for this market"
}
}
Returns two lists, newest first.
signed holds the price attestations recorded for the market, through Record Price Attestation or the Trusset app. pushed holds every price that actually landed on the oracle, read from its PriceUpdated events. An attestation that has landed carries the pushedTxHash of the transaction that landed it.
Neither list is complete on its own. signed shows only attestations someone recorded; a signature from Sign Price that was never recorded is absent. pushed never holds the price set at deployment, which emits no event. An ORACLE-priced market reads an external feed, so its pushed list stays empty. A FIXED market takes no signed price, so its signed list stays empty and pushed holds only its mark-downs.
How the Pushed List Stays Current
Each read first sweeps the oracle’s events forward from where the last sweep stopped, then answers from the stored rows. The first sweep starts at the deployment block, or 200,000 blocks back when the deployment transaction is not on record. The sweep stays 3 blocks behind the chain head, so a push from the last few blocks may not appear yet. It runs at most once every 15 seconds per market and reads at most 400 events per run, so a long backlog can take several reads to catch up. A failed sweep leaves the stored rows unchanged and the read still answers.Path Parameters
string
required
Query Parameters
integer
default:"20"
Entries per list, from 1 to 100. Values above 100 are lowered to 100; zero or a non-numeric value falls back to 20.
integer
default:"0"
Entries to skip in each list, newest first. Page both lists with the same
offset until signedHasMore and pushedHasMore are both false.Response Fields
object
Show child attributes
Show child attributes
object[]
Recorded attestations, newest signed timestamp first.
Show child attributes
Show child attributes
string
Attestation ID.
string
The attested price as a decimal string.
string
The same price in base units.
string
The signed timestamp, as an ISO 8601 string.
string
The signed expiry, as an ISO 8601 string.
string
The key that signed.
string
API or APP, the face it was recorded through.string
The transaction that landed this attestation, or
null.string
When that transaction was mined, or
null.object[]
Prices that landed on the oracle, newest block first.
Show child attributes
Show child attributes
string
Row ID.
string
The new price as a decimal string.
string
The same price in base units.
string
The price it replaced, as a decimal string.
string
The wallet that sent a pushed price, or the key that signed a signed price.
string
The transaction that landed it.
integer
Its block.
string
The block’s time, as an ISO 8601 string.
integer
The block the event mirror had reached when this read started, before its own sweep.
null before the first sweep.string
The borrow asset’s symbol, or
null.integer
The page size applied to each list.
integer
The entries skipped in each list.
integer
Recorded attestations across every page.
integer
Prices that landed on chain across every page.
boolean
true while attestations beyond this page exist.boolean
true while on-chain prices beyond this page exist.curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/oracle-history?limit=20" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/oracle-history?limit=20`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"signed": [
{
"id": "clx4k2p9e0001m8tq3v7h5z2a",
"price": "105.4",
"priceWei": "105400000",
"attestedAt": "2024-06-15T10:00:00.000Z",
"validUntil": "2024-06-15T10:05:00.000Z",
"signer": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"source": "API",
"pushedTxHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"pushedAt": "2024-06-15T10:01:12.000Z"
}
],
"pushed": [
{
"id": "clx4k3a1f0004m8tq9c2d6e1b",
"price": "105.4",
"priceWei": "105400000",
"previousPrice": "104.82",
"updater": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"txHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"blockNumber": 6120451,
"pushedAt": "2024-06-15T10:01:12.000Z"
}
],
"syncedBlock": 6120448,
"settlementSymbol": "USDC",
"limit": 20,
"offset": 0,
"signedTotal": 1,
"pushedTotal": 1,
"signedHasMore": false,
"pushedHasMore": false
}
}
{
"success": false,
"error": {
"code": "NO_ORACLE",
"message": "No oracle is configured for this market"
}
}
Error Codes
| Code | HTTP | Cause |
|---|---|---|
NO_ORACLE | 400 | The market records no oracle address |
MISSING_MARKET_ID | 400 | marketId is longer than 100 characters |
MARKET_NOT_FOUND | 404 | No market with this ID on your instance |
ORACLE_HISTORY_FAILED | 500 | The history could not be read and no more specific code applied |
⌘I
curl "https://api.trusset.org/lending-external-securities-v2/api/markets/{marketId}/oracle-history?limit=20" \
-H "X-API-Key: trusset_your_key_here"
const res = await fetch(
`https://api.trusset.org/lending-external-securities-v2/api/markets/${marketId}/oracle-history?limit=20`,
{ headers: { 'X-API-Key': 'trusset_your_key_here' } }
);
const { data } = await res.json();
{
"success": true,
"data": {
"signed": [
{
"id": "clx4k2p9e0001m8tq3v7h5z2a",
"price": "105.4",
"priceWei": "105400000",
"attestedAt": "2024-06-15T10:00:00.000Z",
"validUntil": "2024-06-15T10:05:00.000Z",
"signer": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"source": "API",
"pushedTxHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"pushedAt": "2024-06-15T10:01:12.000Z"
}
],
"pushed": [
{
"id": "clx4k3a1f0004m8tq9c2d6e1b",
"price": "105.4",
"priceWei": "105400000",
"previousPrice": "104.82",
"updater": "0x9c1e57a2d0b34f86e7a15c9d2b4f60e38a7d4b70",
"txHash": "0x9f2c41d8b7e05a3164c2870fbd935e1a4c7802db6135ea9048f7c21b5d3ea41b",
"blockNumber": 6120451,
"pushedAt": "2024-06-15T10:01:12.000Z"
}
],
"syncedBlock": 6120448,
"settlementSymbol": "USDC",
"limit": 20,
"offset": 0,
"signedTotal": 1,
"pushedTotal": 1,
"signedHasMore": false,
"pushedHasMore": false
}
}
{
"success": false,
"error": {
"code": "NO_ORACLE",
"message": "No oracle is configured for this market"
}
}
