binance_get_agg_trades
Fetch aggregated historical trades for a symbol, merging same-price/same-taker/same-timestamp trades. Use from_id for paging or a ≤1h time window to reconstruct trade flow.
Instructions
Fetch compressed/aggregate trades (same price, same taker order, same timestamp merged).
Calls GET /api/v3/aggTrades (weight 4). Filter with from_id for a stable cursor
walk, or start_time/end_time for a time window — Binance rejects a start/end
window wider than 1 hour on this endpoint; slice a longer range into ≤ 1h calls.
When to Use:
To page through historical trades by id (
from_id), whichbinance_get_recent_tradescannot do.To reconstruct a short time window of trade flow cheaply (weight 4 vs 25).
When NOT to Use:
For the very latest trades with no filter —
binance_get_recent_tradesis simpler.
Returns:
Markdown: a table of up to 100 aggregate trades (id, time, price, qty, first/last
trade ids, side). JSON: the full requested page (up to limit), uncapped.
Windows:
start_time/end_time together must not span more than 1 hour (per Binance's own
docs); omit both, or use from_id, for a wider walk.
Examples: params = {"symbol": "BTCUSDT", "from_id": 123456} params = {"symbol": "BTCUSDT", "start_time": "2024-01-01T00:00:00Z", "end_time": "2024-01-01T00:45:00Z"}
Error Handling:
A window wider than 1 hour raises Binance -1127 More than 1 hours between startTime and endTime; combining from_id with the time window is rejected locally.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |