The Subgraph is constantly indexing the protocol, making all the information more accessible. It provides information about trades, users, tokens and settlements. Additionally, it has some data aggregations which provides insights on the hourly/daily/totals USD volumes, trades, users, etc.
The SDK provides just an easy way to access all this information.
You can query the Cow Subgraph either by running some common queries exposed by the CowSubgraphApi or by building your own ones:
import { SubgraphApi, SupportedChainId } from'@cowprotocol/cow-sdk'constsubgraphApi=newSubgraphApi({ chainId:SupportedChainId.MAINNET })// Get CoW Protocol totalsconst { tokens,orders,traders,settlements,volumeUsd,volumeEth,feesUsd,feesEth } =awaitcsubgraphApi.getTotals()console.log({ tokens, orders, traders, settlements, volumeUsd, volumeEth, feesUsd, feesEth })// Get last 24 hours volume in usdconst { hourlyTotals } =awaitcowSubgraphApi.getLastHoursVolume(24)console.log(hourlyTotals)// Get last week volume in usdconst { dailyTotals } =awaitcowSubgraphApi.getLastDaysVolume(7)console.log(dailyTotals)// Get the last 5 batchesconstquery=` query LastBatches($n: Int!) { settlements(orderBy: firstTradeTimestamp, orderDirection: desc, first: $n) { txHash firstTradeTimestamp } }`constvariables= { n:5 }constresponse=awaitcowSubgraphApi.runQuery(query, variables)console.log(response)