|
6508 | 6508 | } |
6509 | 6509 | } |
6510 | 6510 | }, |
| 6511 | + "/api/v2/chain/{chain}/token/{address}/activity/stats": { |
| 6512 | + "get": { |
| 6513 | + "tags": ["Token Endpoints"], |
| 6514 | + "summary": "Get token trading activity stats", |
| 6515 | + "description": "Get materialized trade count, USD volume, and average trade size for a token. Windows with no swaps are omitted; an omitted requested key means zero trades in that window. Each window ends at its own materialized snapshot; computed_at is the oldest snapshot among the returned windows and can precede request time because the response is cached.", |
| 6516 | + "operationId": "get_token_activity_stats", |
| 6517 | + "parameters": [ |
| 6518 | + { |
| 6519 | + "name": "chain", |
| 6520 | + "in": "path", |
| 6521 | + "description": "The blockchain on which to filter the results", |
| 6522 | + "required": true, |
| 6523 | + "schema": { |
| 6524 | + "$ref": "#/components/schemas/ChainIdentifier" |
| 6525 | + }, |
| 6526 | + "example": "ethereum" |
| 6527 | + }, |
| 6528 | + { |
| 6529 | + "name": "address", |
| 6530 | + "in": "path", |
| 6531 | + "description": "The token contract address", |
| 6532 | + "required": true, |
| 6533 | + "schema": { |
| 6534 | + "type": "string" |
| 6535 | + }, |
| 6536 | + "example": "0x0000000000000000000000000000000000000000" |
| 6537 | + }, |
| 6538 | + { |
| 6539 | + "name": "windows", |
| 6540 | + "in": "query", |
| 6541 | + "description": "Comma-separated windows. Defaults to 5m,1h,4h,24h.", |
| 6542 | + "required": false, |
| 6543 | + "schema": { |
| 6544 | + "type": "string", |
| 6545 | + "maxLength": 32, |
| 6546 | + "minLength": 0, |
| 6547 | + "pattern": "^(5m|1h|4h|24h)(,(5m|1h|4h|24h))*$" |
| 6548 | + }, |
| 6549 | + "example": "1h,24h" |
| 6550 | + } |
| 6551 | + ], |
| 6552 | + "responses": { |
| 6553 | + "200": { |
| 6554 | + "description": "OK", |
| 6555 | + "content": { |
| 6556 | + "*/*": { |
| 6557 | + "schema": { |
| 6558 | + "$ref": "#/components/schemas/TokenActivityStatsResponse" |
| 6559 | + } |
| 6560 | + } |
| 6561 | + } |
| 6562 | + }, |
| 6563 | + "400": { |
| 6564 | + "$ref": "#/components/responses/BadRequest" |
| 6565 | + }, |
| 6566 | + "404": { |
| 6567 | + "$ref": "#/components/responses/NotFound" |
| 6568 | + }, |
| 6569 | + "500": { |
| 6570 | + "$ref": "#/components/responses/InternalError" |
| 6571 | + } |
| 6572 | + } |
| 6573 | + } |
| 6574 | + }, |
6511 | 6575 | "/api/v2/chain/{chain}/payment_token/{address}": { |
6512 | 6576 | "get": { |
6513 | 6577 | "tags": ["Contract Endpoints"], |
|
16150 | 16214 | "transaction_hash" |
16151 | 16215 | ] |
16152 | 16216 | }, |
| 16217 | + "TokenActivityStatsResponse": { |
| 16218 | + "type": "object", |
| 16219 | + "description": "Windowed trading activity for a token", |
| 16220 | + "properties": { |
| 16221 | + "chain": { |
| 16222 | + "type": "string", |
| 16223 | + "description": "Blockchain slug", |
| 16224 | + "example": "base" |
| 16225 | + }, |
| 16226 | + "address": { |
| 16227 | + "type": "string", |
| 16228 | + "description": "Token contract address" |
| 16229 | + }, |
| 16230 | + "computed_at": { |
| 16231 | + "type": "string", |
| 16232 | + "format": "date-time", |
| 16233 | + "description": "End time of the oldest returned aggregation window, or null when no window is returned" |
| 16234 | + }, |
| 16235 | + "windows": { |
| 16236 | + "type": "object", |
| 16237 | + "additionalProperties": { |
| 16238 | + "$ref": "#/components/schemas/TokenActivityWindowStatsResponse" |
| 16239 | + }, |
| 16240 | + "description": "Trading activity keyed by requested window. A requested key is omitted when the token has no swaps in that window; an omitted key means zero trades." |
| 16241 | + } |
| 16242 | + }, |
| 16243 | + "required": ["address", "chain", "windows"] |
| 16244 | + }, |
| 16245 | + "TokenActivityWindowStatsResponse": { |
| 16246 | + "type": "object", |
| 16247 | + "description": "Trading activity within one time window", |
| 16248 | + "properties": { |
| 16249 | + "trades": { |
| 16250 | + "type": "integer", |
| 16251 | + "format": "int64", |
| 16252 | + "description": "Swap transaction count" |
| 16253 | + }, |
| 16254 | + "volume_usd": { |
| 16255 | + "type": "string", |
| 16256 | + "description": "Total buy and sell volume in USD", |
| 16257 | + "example": 710410.75, |
| 16258 | + "pattern": "^[0-9]+(?:\\.[0-9]+)?$" |
| 16259 | + }, |
| 16260 | + "average_trade_usd": { |
| 16261 | + "type": "string", |
| 16262 | + "description": "Average USD volume per trade", |
| 16263 | + "example": 232.92, |
| 16264 | + "pattern": "^[0-9]+(?:\\.[0-9]+)?$" |
| 16265 | + } |
| 16266 | + }, |
| 16267 | + "required": ["average_trade_usd", "trades", "volume_usd"] |
| 16268 | + }, |
16153 | 16269 | "ContractResponse": { |
16154 | 16270 | "type": "object", |
16155 | 16271 | "properties": { |
|
0 commit comments