diff --git a/website/src/pages/en/subgraphs/cookbook/timeseries.mdx b/website/src/pages/en/subgraphs/cookbook/timeseries.mdx index 2c721a9cef23..ea6040d1931d 100644 --- a/website/src/pages/en/subgraphs/cookbook/timeseries.mdx +++ b/website/src/pages/en/subgraphs/cookbook/timeseries.mdx @@ -36,6 +36,10 @@ Timeseries and aggregations reduce data processing overhead and accelerate queri ## How to Implement Timeseries and Aggregations +### Prerequisites + +You need `spec version 1.1.0` for this feature. + ### Defining Timeseries Entities A timeseries entity represents raw data points collected over time. It is defined with the `@entity(timeseries: true)` annotation. Key requirements: @@ -51,7 +55,7 @@ Example: type Data @entity(timeseries: true) { id: Int8! timestamp: Timestamp! - price: BigDecimal! + amount: BigDecimal! } ``` @@ -68,11 +72,11 @@ Example: type Stats @aggregation(intervals: ["hour", "day"], source: "Data") { id: Int8! timestamp: Timestamp! - sum: BigDecimal! @aggregate(fn: "sum", arg: "price") + sum: BigDecimal! @aggregate(fn: "sum", arg: "amount") } ``` -In this example, Stats aggregates the price field from Data over hourly and daily intervals, computing the sum. +In this example, Stats aggregates the amount field from Data over hourly and daily intervals, computing the sum. ### Querying Aggregated Data