Skip to content

Commit 4a8fd7a

Browse files
authored
Updating Timeseries (#883)
Updates
1 parent d5de9f3 commit 4a8fd7a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

website/src/pages/en/subgraphs/cookbook/timeseries.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ Timeseries and aggregations reduce data processing overhead and accelerate queri
3636

3737
## How to Implement Timeseries and Aggregations
3838

39+
### Prerequisites
40+
41+
You need `spec version 1.1.0` for this feature.
42+
3943
### Defining Timeseries Entities
4044

4145
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:
5155
type Data @entity(timeseries: true) {
5256
id: Int8!
5357
timestamp: Timestamp!
54-
price: BigDecimal!
58+
amount: BigDecimal!
5559
}
5660
```
5761

@@ -68,11 +72,11 @@ Example:
6872
type Stats @aggregation(intervals: ["hour", "day"], source: "Data") {
6973
id: Int8!
7074
timestamp: Timestamp!
71-
sum: BigDecimal! @aggregate(fn: "sum", arg: "price")
75+
sum: BigDecimal! @aggregate(fn: "sum", arg: "amount")
7276
}
7377
```
7478

75-
In this example, Stats aggregates the price field from Data over hourly and daily intervals, computing the sum.
79+
In this example, Stats aggregates the amount field from Data over hourly and daily intervals, computing the sum.
7680

7781
### Querying Aggregated Data
7882

0 commit comments

Comments
 (0)