defistream 1.2.0__py3-none-any.whl → 1.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- defistream/__init__.py +1 -1
- {defistream-1.2.0.dist-info → defistream-1.2.1.dist-info}/METADATA +60 -1
- {defistream-1.2.0.dist-info → defistream-1.2.1.dist-info}/RECORD +5 -5
- {defistream-1.2.0.dist-info → defistream-1.2.1.dist-info}/WHEEL +0 -0
- {defistream-1.2.0.dist-info → defistream-1.2.1.dist-info}/licenses/LICENSE +0 -0
defistream/__init__.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: defistream
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.1
|
|
4
4
|
Summary: Python client for the DeFiStream API
|
|
5
5
|
Project-URL: Homepage, https://defistream.dev
|
|
6
6
|
Project-URL: Documentation, https://docs.defistream.dev
|
|
@@ -78,6 +78,7 @@ print(df.head())
|
|
|
78
78
|
## Features
|
|
79
79
|
|
|
80
80
|
- **Builder pattern**: Fluent query API with chainable methods
|
|
81
|
+
- **Aggregate queries**: Bucket events into time or block intervals with summary statistics
|
|
81
82
|
- **Type-safe**: Full type hints and Pydantic models
|
|
82
83
|
- **Multiple formats**: DataFrame (pandas/polars), CSV, Parquet, JSON
|
|
83
84
|
- **Async support**: Native async/await with `AsyncDeFiStream`
|
|
@@ -245,6 +246,57 @@ df = (
|
|
|
245
246
|
)
|
|
246
247
|
```
|
|
247
248
|
|
|
249
|
+
### Aggregate Queries
|
|
250
|
+
|
|
251
|
+
Use `.aggregate()` to bucket raw events into time or block intervals with summary statistics. All existing filters work before `.aggregate()` is called.
|
|
252
|
+
|
|
253
|
+
```python
|
|
254
|
+
# Aggregate USDT transfers into 2-hour buckets
|
|
255
|
+
df = (
|
|
256
|
+
client.erc20.transfers("USDT")
|
|
257
|
+
.network("ETH")
|
|
258
|
+
.block_range(21000000, 21100000)
|
|
259
|
+
.aggregate(group_by="time", period="2h")
|
|
260
|
+
.as_df()
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
# Aggregate by block intervals
|
|
264
|
+
df = (
|
|
265
|
+
client.erc20.transfers("USDT")
|
|
266
|
+
.network("ETH")
|
|
267
|
+
.block_range(21000000, 21100000)
|
|
268
|
+
.aggregate(group_by="block", period="100b")
|
|
269
|
+
.as_df()
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
# Combine with filters — large transfers from exchanges, bucketed hourly
|
|
273
|
+
df = (
|
|
274
|
+
client.erc20.transfers("USDT")
|
|
275
|
+
.network("ETH")
|
|
276
|
+
.block_range(21000000, 21100000)
|
|
277
|
+
.sender_category("exchange")
|
|
278
|
+
.min_amount(10000)
|
|
279
|
+
.aggregate(group_by="time", period="1h")
|
|
280
|
+
.as_df()
|
|
281
|
+
)
|
|
282
|
+
|
|
283
|
+
# Aggregate Uniswap swaps
|
|
284
|
+
df = (
|
|
285
|
+
client.uniswap.swaps("WETH", "USDC", 500)
|
|
286
|
+
.network("ETH")
|
|
287
|
+
.block_range(21000000, 21100000)
|
|
288
|
+
.aggregate(group_by="time", period="1h")
|
|
289
|
+
.as_df()
|
|
290
|
+
)
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
You can also discover what aggregate fields are available for a protocol:
|
|
294
|
+
|
|
295
|
+
```python
|
|
296
|
+
schema = client.aggregate_schema("erc20")
|
|
297
|
+
print(schema)
|
|
298
|
+
```
|
|
299
|
+
|
|
248
300
|
### Verbose Mode
|
|
249
301
|
|
|
250
302
|
By default, responses omit metadata fields to reduce payload size. Use `.verbose()` to include all fields:
|
|
@@ -507,6 +559,13 @@ Filter events by entity names or categories using the labels database. Available
|
|
|
507
559
|
|
|
508
560
|
**Mutual exclusivity:** Within each slot (involving/sender/receiver), only one of address/label/category can be set. `involving*` filters cannot be combined with `sender*`/`receiver*` filters.
|
|
509
561
|
|
|
562
|
+
### Aggregate Methods
|
|
563
|
+
|
|
564
|
+
| Method | Description |
|
|
565
|
+
|--------|-------------|
|
|
566
|
+
| `.aggregate(group_by, period)` | Transition to aggregate query. `group_by`: `"time"` or `"block"`. `period`: bucket size (e.g. `"1h"`, `"100b"`). Returns an `AggregateQueryBuilder` that supports all the same terminal and filter methods. |
|
|
567
|
+
| `client.aggregate_schema(protocol)` | Get available aggregate fields for a protocol (e.g. `"erc20"`, `"aave"`). |
|
|
568
|
+
|
|
510
569
|
### Terminal Methods
|
|
511
570
|
|
|
512
571
|
| Method | Description |
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
defistream/__init__.py,sha256=
|
|
1
|
+
defistream/__init__.py,sha256=jnSTX8AxaD5A8NIp059veFWnMkV9BOSWxgKfI-aau6k,1224
|
|
2
2
|
defistream/client.py,sha256=OZsaa7kgDxWCS37geoTGlp-IFaO3Kn8bm1ghNE9tqB4,13973
|
|
3
3
|
defistream/exceptions.py,sha256=_GxZQ18_YvXFtmNHeddWV8fHPIllHgFeP7fP0CmHF1k,1492
|
|
4
4
|
defistream/models.py,sha256=Zw3DHAISxB6pivKybNzyHXR5IcRwvTZl23DHbjfyKwM,622
|
|
5
5
|
defistream/protocols.py,sha256=5_bYd46lDy-mK6LZ8sTGW0Z2IVH4g0cQ5rBbbOXsw0U,15368
|
|
6
6
|
defistream/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
defistream/query.py,sha256=Pr-zwUCBcjBUkqa1CFzVJmsnZ4DpV29c0_9p1VtfGak,30433
|
|
8
|
-
defistream-1.2.
|
|
9
|
-
defistream-1.2.
|
|
10
|
-
defistream-1.2.
|
|
11
|
-
defistream-1.2.
|
|
8
|
+
defistream-1.2.1.dist-info/METADATA,sha256=S-XgsiQCjkgOLElZxcoFWfDSetIFxD17KmWOIwJQ1oM,15406
|
|
9
|
+
defistream-1.2.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
10
|
+
defistream-1.2.1.dist-info/licenses/LICENSE,sha256=72DWAof8dMePfFQmfaswClW5d-sE6k7p-7VpuSKLmU4,1067
|
|
11
|
+
defistream-1.2.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|