0xPlaygrounds / 0xPlaygrounds/subgrounds
Timeseries Support
- 主要语言
- Python
- 星标
- 73
- 派生
- 12
- PR 合并指标
- 30 天内没有已合并 PR
描述
**Is your feature request related to a problem? Please describe.**
## Description
Given a subgrounds fieldpath(s) representing a list of entities, then it should be possible to wrap those fieldpaths in a timeseries which would normalize the data according to time key, interval, aggregation method and interpolation method.
Supported intervals (to start):
* hourly
* daily
* weekly
* monthly
Supported aggregation methods:
* mean
* sum
* first
* last
* median
* min
* max
* count
Supported interpolation methods:
* backward fill (use next value to fill in missing value)
* forward fill (use previous value to fill in missing value)
**Describe the solution you'd like**
```python
sg = Subgrounds()
uniswapV2 = sg.load_subgraph("https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2")
Swap.price0 = abs(Swap.amount1In - Swap.amount1Out) / abs(Swap.amount0In - Swap.amount0Out)
Swap.price1 = abs(Swap.amount0In - Swap.amount0Out) / abs(Swap.amount1In - Swap.amount1Out)
swaps = uniswapV2.Query.swaps(
orderBy=Swap.timestamp,
orderDirection='desc',
first=500,
)
price0_hourly_close = Timeseries(
x=swaps.timestamp,
y=swaps.price0,
interval='hour',
aggregation='last',
interpolation='ffill'
)
```
*Originally from: cvauclair*
贡献指南
调研方向
The issue proposes a new Timeseries class to wrap Subgrounds fieldpaths. Start by examining the existing Subgrounds codebase to understand how fieldpaths and data fetching work. Look for existing data transformation or normalization modules. The implementation will require designing the Timeseries class, handling time intervals, aggregation methods, and interpolation. Check if there are similar data processing patterns in the code. 'Done' means the Timeseries class works as shown in the example, producing normalized time series data from GraphQL queries.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- graphql, pandas, python
- 领域
- backend-api-design, data, data-engineering
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 25/100