GET /networks/{network}/pools/{pool_address}/transactions returns the swaps in one pool, newest first: who swapped, how much of each token moved, and both tokens’ prices in USD at that moment. It needs a Dev, Pro or Enterprise key on api-pro.dexpaprika.com, sent as the whole Authorization header:
Which plan you need
Without a paid key the same call answers:
Reading a swap
Which way did it go? The token with a negative amount left the pool, so that is what the trader bought. In the example
amount_1 is negative: the trader sold WETH for USDC. The buys and sells that pool details reports count swaps the same way, from the pool’s base token: a buy takes the base token out of the pool.
What was it worth? volume_0 * price_0_usd, or the same for token 1.
Parameters
page stops at 100: page=101 answers 400. To read further back, switch to cursor. A response to a cursor request carries next_cursor instead of page_info, and following it keeps going past where page stops.
The last hour of swaps in Python
This script reads every swap in the last hour, classifies each as a buy or a sell of the pool’s base token, and lists the largest. One request for the pool, then one per 100 swaps:1h window of pool details for the same pool, give or take the swaps that landed between the two calls: pool details read 189 buys and 134 sells a minute earlier.
Things to know
Usenext_cursor, not the last id. A cursor includes the swap it names. Passing the id of the last swap you already have returns that swap again as the first row; next_cursor points at the next one.
Raw amounts overflow JavaScript numbers. amount_0 and amount_1 are integers in the token’s smallest unit, and an 18-decimal token easily passes 2^53. JSON.parse rounds them silently. Use volume_0 and volume_1, or a JSON parser that keeps big integers.
total_pages can be larger than you can reach. It counts every matching swap, while page stops at 100. Bound the range with from and to, or walk it with cursor.
Each response costs one credit, whatever the limit, so ask for 100 at a time. See credit usage.
For a live feed, stream instead of polling. The transactions stream pushes each swap as it happens, on the same plans.
Where to go next
- Pool details: the windowed totals, on every plan
- Transactions stream: the same swaps, live
- Pool transactions reference
- Pricing, console.dexpaprika.com and docs home