File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
website/src/pages/en/subgraphs/cookbook Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ Timeseries and aggregations reduce data processing overhead and accelerate queri
36
36
37
37
## How to Implement Timeseries and Aggregations
38
38
39
+ ### Prerequisites
40
+
41
+ You need ` spec version 1.1.0 ` for this feature.
42
+
39
43
### Defining Timeseries Entities
40
44
41
45
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:
51
55
type Data @entity (timeseries : true ) {
52
56
id : Int8 !
53
57
timestamp : Timestamp !
54
- price : BigDecimal !
58
+ amount : BigDecimal !
55
59
}
56
60
```
57
61
@@ -68,11 +72,11 @@ Example:
68
72
type Stats @aggregation (intervals : ["hour" , " day" ], source : " Data" ) {
69
73
id : Int8 !
70
74
timestamp : Timestamp !
71
- sum : BigDecimal ! @aggregate (fn : " sum" , arg : " price " )
75
+ sum : BigDecimal ! @aggregate (fn : " sum" , arg : " amount " )
72
76
}
73
77
```
74
78
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 .
76
80
77
81
### Querying Aggregated Data
78
82
You can’t perform that action at this time.
0 commit comments