# DEX Trades API - Bitquery OHLCV, Transfers, Balances, Holders (`nabeelbaghoor/dex-trades-blockchain-data-api`) Actor

Blockchain DEX trades API for Bitquery: token swaps, OHLCV candles, token transfers, wallet balances and token holders on Ethereum, BSC, Base, Arbitrum, Optimism, Polygon, Solana and Tron, with token, trader, pool, DEX and time filters. Bring your own Bitquery access token.

- **URL**: https://apify.com/nabeelbaghoor/dex-trades-blockchain-data-api.md
- **Developed by:** [Nabeel Hassan](https://apify.com/nabeelbaghoor) (community)
- **Categories:** Developer tools, Business, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 blockchain record returneds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## DEX Trades API: OHLCV, Transfers, Balances and Holders (works with the Bitquery API)

Pull on-chain DEX trades, swaps, OHLCV candles, token transfers, wallet balances and token holders for Ethereum, BNB Smart Chain, Base, Arbitrum, Optimism, Polygon, Solana and Tron into a clean dataset, using your own Bitquery access token.

### Features

- **Token DEX trades**: every swap of one token from the token's point of view (Bitquery `DEXTradeByTokens` cube): amount, USD value, price in USD, counter token, buyer, seller, DEX protocol and pool. Filter by counter token, trader, pool, DEX protocol and time window.
- **DEX swaps**: raw swaps from the pool's point of view (`DEXTrades` cube), filtered by token, DEX protocol (uniswap_v3, pancake_swap_v3, pump_amm and so on) or transaction signer.
- **OHLCV candles**: open, high, low, close, USD volume, market rank, market cap and fully diluted valuation per interval from the cross-chain `Trading.Pairs` cube, from 1 second to 1 hour bars, on the token's top market or every market.
- **Token transfers**: ERC-20, TRC-20, SPL and native transfers by token, sender, receiver or a list of wallets.
- **Wallet balances**: what up to 100 addresses hold right now, per token or native coin only, with USD value, update count and last change time (EVM chains and Tron).
- **Token holders**: a token's holders ranked by balance on a snapshot date, with a minimum balance floor (EVM chains and Tron).
- Realtime, archive or combined datasets; the full record Bitquery returns is kept beside the flat columns.
- Read only GraphQL queries. Pay per result; empty answers are never charged.

### How to get a Bitquery access token

1. Sign in at account.bitquery.io.
2. Open **Authorization, Applications** and click **New Application**. Pick a token lifespan.
3. Open **Authorization, Tokens**, choose the application and click **Generate New Token**. Copy the token (it starts `ory_at_`).
4. Paste it into the **Bitquery access token** field, or store it as the `DATA_API_KEY` secret.

You can instead paste your application's `client_id:client_secret`: the actor then mints a token for the run with the documented OAuth client credentials grant (`scope=api`). A token generated in the IDE without an application expires every 12 hours, so an application token is the better choice for scheduled runs. Without a token the run ends cleanly with a message and no charge.

### Input

| Field | Modes | What it does |
| --- | --- | --- |
| `mode` | all | `tokenTrades`, `dexTrades`, `ohlcv`, `transfers`, `balances` or `tokenHolders` |
| `chain` | all | `eth`, `bsc`, `base`, `arbitrum`, `optimism`, `matic`, `solana`, `tron` |
| `tokenAddress` | all | Token contract or mint address. Required for token trades, OHLCV and holders |
| `sideTokenAddress` | tokenTrades | Keep trades against this counter token |
| `traderAddress` | tokenTrades, dexTrades | Buyer or seller (EVM, Tron) or signer (Solana) |
| `poolAddress` | tokenTrades | DEX pair contract (EVM, Tron) or market address (Solana) |
| `dexProtocol` | tokenTrades, dexTrades | Bitquery protocol name, for example `uniswap_v3` |
| `senderAddress`, `receiverAddress` | transfers | Transfers from or to one address |
| `walletAddresses` | transfers, balances | Up to 100 addresses, one per line |
| `nativeOnly` | balances | Native coin only (ETH, BNB, POL, TRX) |
| `intervalSeconds` | ohlcv | 1, 3, 5, 10, 30, 60, 300, 900, 1800 or 3600 |
| `topMarketOnly` | ohlcv | Rank 1 market only (default on) |
| `quotedInUsd` | ohlcv | Prices in USD (default on) or in quote token units |
| `holdersDate`, `minBalance` | tokenHolders | Snapshot day and minimum balance |
| `since`, `until` | trades, swaps, OHLCV, transfers | UTC date or time window |
| `dataset` | trades, swaps, transfers, balances | `auto`, `realtime`, `archive` or `combined` |
| `maxResults` | all | Row cap, default 100 |
| `apiKey` | all | Your Bitquery access token (secret) |

### Example output

A token DEX trades row. The flat columns come first; `data` holds the record exactly as the Bitquery `DEXTradeByTokens` query returns it.

```json
{
  "mode": "tokenTrades",
  "recordType": "tokenTrade",
  "chain": "eth",
  "found": true,
  "time": "2026-10-11T09:14:23Z",
  "block": "23561042",
  "txHash": "0x5f1c...e2a9",
  "protocol": "uniswap_v3",
  "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "tokenSymbol": "WETH",
  "sideTokenSymbol": "USDC",
  "side": "buy",
  "amount": "1.250000000000000000",
  "amountUsd": "4512.37",
  "priceUsd": 3609.9,
  "sender": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
  "receiver": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad",
  "data": {
    "Block": { "Time": "2026-10-11T09:14:23Z", "Number": "23561042" },
    "Transaction": { "Hash": "0x5f1c...e2a9", "From": "0x7a25...b81c" },
    "Trade": {
      "Amount": "1.250000000000000000", "AmountInUSD": "4512.37", "Price": 3609.9, "PriceInUSD": 3609.9,
      "Buyer": "0x3fc91a3afd70395cd496c647d5a6cc9d4b2b7fad", "Seller": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640",
      "Currency": { "Symbol": "WETH", "Name": "Wrapped Ether", "SmartContract": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" },
      "Dex": { "ProtocolName": "uniswap_v3", "ProtocolFamily": "Uniswap", "SmartContract": "0x88e6a0c2ddd26feeb64f039a2c41296fcb3f5640" },
      "Side": { "Type": "buy", "Amount": "4512.370000", "AmountInUSD": "4512.37", "Currency": { "Symbol": "USDC", "SmartContract": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48" } }
    }
  }
}
```

OHLCV rows fill `open`, `high`, `low`, `close`, `volumeUsd` and `marketCap`; balance and holder rows fill `address`, `amount` and `amountUsd`. A query that matches nothing becomes one uncharged row with `found: false` and a `note`.

### FAQ

#### What is the Bitquery API?

Bitquery is a blockchain data platform that indexes DEX trades, transfers, balances, holders, transactions and mempool data for 40+ chains and serves it over GraphQL. This actor uses its V2 API at streaming.bitquery.io, which covers Ethereum, BNB Smart Chain, Base, Arbitrum, Optimism, Polygon, Solana and Tron.

#### Which chains and DEXs does this DEX trades API cover?

Ethereum, BNB Smart Chain, Base, Arbitrum, Optimism, Polygon (Matic), Solana and Tron. DEX coverage is whatever Bitquery indexes on each chain, including Uniswap v2, v3 and v4, PancakeSwap, Four Meme, Raydium, Meteora, Pump.fun, PumpSwap and SunPump.

#### How far back does the data go?

The `realtime` dataset, which every plan can read, keeps a recent window only: about 12 hours of Solana DEX trades, a few days of EVM trades and transfers, and about 30 days of OHLCV in the Trading cube. It returns fewer rows rather than an error when asked beyond that. Full history needs the `archive` or `combined` dataset, which requires the historical data add-on on your Bitquery plan. Combined does not currently work on Solana.

#### How do I get OHLCV candles for a token?

Choose OHLCV candles, set the chain and the token address, and pick an interval. With "Top market only" on, the actor reads the token's rank 1 market, which Bitquery recommends for the price of one token. For candles older than about 30 days, use token DEX trades with the archive dataset.

#### Why are wallet balances not available on Solana?

Bitquery has no Balances or Holders cube on Solana; Solana balances are derived from balance updates. Use token transfers with wallet addresses on Solana instead.

#### What does a run cost?

You pay the actor's per-result price for each row that carries a record, plus your own Bitquery points for the queries, which Bitquery bills to your account. Empty answers and refused queries are never charged by the actor.

#### Is my token safe?

The token is a secret input, sent only in the Authorization header to Bitquery, and never written to the log or the dataset.

### Keywords

DEX trades API, blockchain data API, Bitquery API, on-chain DEX data, crypto OHLCV API, token transfers API, wallet balance API, token holders API, Uniswap trades, PancakeSwap trades, Solana DEX trades, Pump.fun trades, Tron TRC-20 transfers, Base and Arbitrum DEX data.

### Licensing

Data comes from your own Bitquery account and stays under Bitquery's Terms of Service. Those terms limit data from free plans to technical development, allow publication of data only for paid plans, and forbid reselling Bitquery material or using the service as a substitute for Bitquery. Use the results within your own plan's rights.

# Actor input Schema

## `mode` (type: `string`):

Token DEX trades reads swaps from one token's point of view (DEXTradeByTokens): amount, USD value, price, counter token, buyer, seller and DEX. DEX swaps reads raw swaps from the pool's point of view (DEXTrades), optionally filtered by token, DEX protocol or signer. OHLCV candles reads open, high, low, close, volume, rank and market cap for a token per interval (Trading cube, about the last 30 days). Token transfers reads transfers of a token or to and from wallets. Wallet balances reads what addresses hold now (EVM chains and Tron). Token holders ranks a token's holders on a date (EVM chains and Tron).

## `chain` (type: `string`):

The blockchain to read. EVM chains, Solana and Tron are all served by the Bitquery V2 API. Balances and holders are not available on Solana.

## `tokenAddress` (type: `string`):

The token contract (EVM, Tron) or mint address (Solana). Required for token DEX trades, OHLCV candles and token holders; an optional filter for DEX swaps, transfers and balances. EVM addresses are lowercased, as the Trading cube requires. Examples: 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2 (WETH), So11111111111111111111111111111111111111112 (wrapped SOL), TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t (USDT on Tron).

## `sideTokenAddress` (type: `string`):

Token DEX trades only: keep trades against this counter token, for example WETH or USDC, so you read one pair.

## `traderAddress` (type: `string`):

Token DEX trades: trades where this address is the buyer or seller (EVM, Tron) or the transaction signer (Solana). DEX swaps: swaps signed by this address.

## `poolAddress` (type: `string`):

Token DEX trades only: the pool (DEX pair contract on EVM and Tron, market address on Solana) to keep.

## `dexProtocol` (type: `string`):

Token DEX trades and DEX swaps: a Bitquery protocol name such as uniswap_v2, uniswap_v3, uniswap_v4, pancake_swap_v3, pump, pump_amm or raydium_launchpad.

## `senderAddress` (type: `string`):

Token transfers only: transfers sent by this address.

## `receiverAddress` (type: `string`):

Token transfers only: transfers received by this address.

## `walletAddresses` (type: `array`):

Wallet balances: the addresses to read (required, up to 100). Token transfers: transfers sent or received by any of these addresses. One per line.

## `nativeOnly` (type: `boolean`):

Wallet balances only: read the chain's native coin (ETH, BNB, POL, TRX) instead of every token. Ignored when a token address is set.

## `intervalSeconds` (type: `string`):

OHLCV candles only: the bar duration the Trading cube stores.

## `topMarketOnly` (type: `boolean`):

OHLCV candles only: keep the token's rank 1 market (the pool carrying the most volume), which Bitquery recommends for the price of one token. Turn off to get one row per market and quote token.

## `quotedInUsd` (type: `boolean`):

OHLCV candles only: prices in USD. Turn off to get prices in quote token units.

## `holdersDate` (type: `string`):

Token holders only: the snapshot day as YYYY-MM-DD. Defaults to today (UTC).

## `minBalance` (type: `string`):

Token holders only: keep holders with at least this many tokens, for example 1000000. Needed on very large tokens, where an unbounded ranking times out.

## `since` (type: `string`):

Trades, swaps, candles and transfers: read from this UTC date or time, for example 2026-10-01 or 2026-10-01T12:00:00Z.

## `until` (type: `string`):

Trades, swaps, candles and transfers: read up to this UTC date or time.

## `dataset` (type: `string`):

Realtime keeps a recent window only (hours on Solana trades, days on EVM trades and transfers) and is on every plan. Archive is full history and combined is both; they need the historical data add-on, and combined does not work on Solana. Auto uses realtime, or combined for balances.

## `maxResults` (type: `integer`):

The most rows to collect. You pay only for rows that carry a record.

## `requestsPerMinute` (type: `integer`):

Pacing ceiling for GraphQL requests. Lower it if other jobs share the token.

## `apiKey` (type: `string`):

Your own Bitquery OAuth access token (it starts ory_at\_), from an application at account.bitquery.io under Authorization, Tokens. You can instead paste your application's client_id:client_secret and the actor mints a token for the run. Falls back to the DATA_API_KEY secret.

## Actor input object example

```json
{
  "mode": "tokenTrades",
  "chain": "eth",
  "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "nativeOnly": false,
  "intervalSeconds": "3600",
  "topMarketOnly": true,
  "quotedInUsd": true,
  "dataset": "auto",
  "maxResults": 100,
  "requestsPerMinute": 30
}
```

# Actor output Schema

## `records` (type: `string`):

One row per DEX trade, swap, candle, transfer, balance or holder.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
};

// Run the Actor and wait for it to finish
const run = await client.actor("nabeelbaghoor/dex-trades-blockchain-data-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" }

# Run the Actor and wait for it to finish
run = client.actor("nabeelbaghoor/dex-trades-blockchain-data-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "tokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
}' |
apify call nabeelbaghoor/dex-trades-blockchain-data-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nabeelbaghoor/dex-trades-blockchain-data-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/UHg5bKAoBe1bcNWVI/builds/NtkfUTVTZLvJ1FyWS/openapi.json
