Skip to main content

Overview

The Swaps endpoint provides per-swap fee accounting for AMM pools. Each swap record includes executed token amounts, computed fee amounts, and fee splits across recipients (LPs/users, protocol, extra destinations). This data enables revenue attribution, pool economics analysis, and feeds into yield prediction models.

Endpoint Matrix

Parameter Conventions

number
Starting block height (inclusive) for swap fee records.
number
Ending block height (inclusive) for swap fee records.
string
Starting timestamp (ISO-8601). If it falls between blocks, the next block after this timestamp is used.
string
Ending timestamp (ISO-8601). If it falls between blocks, the last block before this timestamp is used.
string[]
BlockDB pool identifiers for filtering swap fees by pool.
string[]
Pool contract addresses to scope swap fee data.
string[]
Filter by input token addresses.
string[]
Filter by output token addresses.
string[]
Filter by fee token addresses.
number
required
Chain identifier for the target EVM network. See Chain enumeration for supported values.

Usage Guidance

  • Join with fee terms โ€” Link swap fees to pool fee configuration via pool_uid to understand fee splits
  • Time-series analysis โ€” Swap fees are ordered by block/time; use ranges for historical revenue analysis
  • Filter by tokens โ€” Use token_in_addresses and token_out_addresses to analyze specific trading pairs
  • Revenue attribution โ€” Fee split fields (fee_amount_user, fee_amount_protocol, fee_amount_extra) enable precise revenue attribution
  • Feed yield models โ€” Swap fee data is the primary input for yield/ROI predictions (see /evm/yields)

Fee Calculation

Swap fees are computed using the poolโ€™s fee terms (from /evm/entities/pools/fee-terms):
  • fee_amount_total โ‰ˆ amount_in * total_fee
  • fee_amount_user โ‰ˆ amount_in * user_fee (when available)
  • fee_amount_protocol โ‰ˆ amount_in * protocol_fee (when available)
  • fee_amount_extra โ‰ˆ amount_in * extra_fee (when available)
Fee amounts are denominated in the fee_token, which may differ from token_in or token_out depending on the pool type.

Common Patterns

Calculate pool revenue over time:
Analyze fees for a specific trading pair:
Track protocol revenue:

Dataset Relationships

  • Pools โ†’ Swap Fees: Join pool metadata to swap fees using pool_uid
  • Fee Terms โ†’ Swap Fees: Fee terms define the fee calculation rules applied to each swap
  • Swap Fees โ†’ Yields: Yield predictions are derived from historical swap fees and current reserves
  • Swap Fees โ†’ Reserves: Swap fees indicate liquidity changes that affect reserve snapshots
  • Swap Fees โ†’ Prices: Swap execution prices are captured in the pricing layers

See Also

Last modified on July 19, 2026