Skip to content
We're currently creating a lot of content. Sign up to get notified when it's ready.

Readings

The Reading API lets you get readings data from the network. You can read data from any Asset object in the network using its readings property.

## latest()

Retrieves the latest reading for an asset.

Method signature

latest(): Promise<AssetReadings>
Parameters

None.

Returns

A promise that will resolve when the latest available readings are available in an AssetReadings object.

Examples

const sdk = window.qatium
const network = sdk.network
const asset = network.getAsset('Nellybay')
asset.readings.latest().then((reading) => {
console.log(reading)
})

forRange()

Retrieves readings for an asset between two dates.

Method signature

forRange(start: Date, end: Date): Promise<AssetReadings>
Parameters
  • start: Start date
  • end: End date
Returns

A promise that will resolve when the readings are available in an AssetReadings object.

Examples

Get readings for 24 hours for an asset.

const sdk = window.qatium
const network = sdk.network
const asset = network.getAsset('Nellybay')
asset.readings.forRange(new Date("2024-01-01"), new Date("2024-01-02")).then((readings) => {
readings.level.forEach((reading) => {
console.log(reading)
})
})