Skip to main content
The SubgraphClient class provides methods to query historical data from the CoW Protocol subgraph, including trading volumes, totals, and other aggregated metrics.

Initialization

Methods

last_days_volume

Query the trading volume for the last N days.
Returns: LastDaysVolume with daily_totals list containing:
  • timestamp (int): Unix timestamp for the day
  • volume_usd (Optional[Any]): Trading volume in USD
GraphQL Query:

last_hours_volume

Query the trading volume for the last N hours.
Returns: LastHoursVolume with hourly_totals list containing:
  • timestamp (int): Unix timestamp for the hour
  • volume_usd (Optional[Any]): Trading volume in USD
GraphQL Query:

totals

Query aggregate protocol statistics.
Returns: Totals with a totals list containing:
GraphQL Query:

execute

Execute a custom GraphQL query.

Complete Example

Last modified on March 11, 2026