SolanaDEX TradesClickHouseGraphQL APIDeveloper GuideStreams

Solana DEX Trades in ClickHouse: 8.7 Million Rows Match the API

Python code that loads Solana DEX trades into your own ClickHouse from an API and a stream. Our copy matched the API on all 8,686,214 trades of a seven-hour test.

Cover Image for Solana DEX Trades in ClickHouse: 8.7 Million Rows Match the API

We built a copy of Solana DEX trades in a ClickHouse table on our own machine, in Python. Solana historical data for the last 30 days comes from the Bitquery Solana DEX API, a hosted GraphQL API. A script saves that history as Parquet files. A WebSocket stream from the same API keeps the table current. The API holds 30 days of trades, and your table keeps every trade you load. A last script compares the table with the API, trade by trade.

We ran the code on a laptop on 4 December 2026. We checked six hours of history and the 58 minutes of stream after them. The table held 8,686,214 trades from the whole Solana DEX market for that time range, and the API returned the same trades. No trade was missing from the table, and no trade appeared twice.

Most of the work went into the cases where a simple copy loses or doubles trades. One second after a 10-second window closed, the API's count was short in 29 of 30 samples. A new stream subscription replays nothing, so each dropped connection leaves a gap in the table. One trade can come back from the API twice.

The stream of every Solana DEX trade sent 1.30 GB in 61 minutes. The stream of one token, JUP (Jupiter), sent 5.7 MB in 31 minutes. Each command in the steps loads JUP.

The code is in a public repo, bitquery/solana-dex-clickhouse. It has four scripts:

  1. backfill.py pulls history from the API into Parquet files.
  2. load.py loads the files into ClickHouse.
  3. live.py keeps the table current from the stream.
  4. verify.py compares the table with the API.

Key findings

  • The table matched the API on 8,686,214 trades. The range was 418 minutes of the whole market on 4 December 2026. The table also matched each of the three Bitquery servers that hold this data, minute by minute.
  • One second after a 10-second window closed, the API's count was short in 29 of 30 samples. The median shortfall was 5%, and the largest was 24%. The count stopped changing within about 4 seconds.
  • A new subscription replays nothing. After a forced disconnect, the script read 23 seconds again by query. The query returned 14,896 trades, and the stream had delivered 5,568 of them.
  • The API can return one trade more than once. On 10 November 2026 the source table held 5,925 extra copies. A table that removes duplicates by transaction hash and trade index would drop rows the source holds.
  • The whole market sent 1.30 GB of stream data in 61 minutes with 22 fields. At that rate, the 5 GB that the $69 Pro plan includes lasts under four hours. A one-token stream for JUP would use about 1.9 to 4.4 GB in 30 days, by our estimate.
  • A trade took 139 bytes in ClickHouse with ZSTD and 213 bytes with the default LZ4. The same trade was about 850 bytes as JSON from the API and about 140 bytes in a Parquet file.

What you build, and what each part needs

The data source is one GraphQL API, Trading { Trades }, on https://streaming.bitquery.io/graphql. It holds 30 days of DEX trades. A query reads history from the API, and a subscription on the same fields sends new trades over a WebSocket.

A trade here is one side of a swap in a pool, as the API lists it: a token, a quote token, amounts, a price, a trader and a market. Each trade has a key, the transaction hash plus TradeIndex.

A slice is a part of the market. The scripts take a slice as --tokens (one or more token addresses) or --family (one DEX protocol family, such as Pumpswap). With no slice, they take the whole market.

StepScriptBitquery access it needs
Pull historybackfill.pyAPI queries, billed in points (Bitquery's unit of query cost)
Load filesload.pynone
Stay livelive.pya stream, on a plan with streams, and a few queries for gaps
Check the copyverify.pyAPI queries, billed in points

You also need Linux or macOS, Python 3.10 or newer, and Docker for a local ClickHouse. Our laptop was an Apple M3 Pro with 36 GB of memory. ClickHouse 25.8 ran in Docker with 4 CPUs and 8 GB.

Step 1: start ClickHouse and create the table

Clone the repo and install its two packages, websockets and pyarrow.

git clone https://github.com/bitquery/solana-dex-clickhouse && cd solana-dex-clickhouse
python3 -m venv .venv && . .venv/bin/activate && pip install -r requirements.txt

Start ClickHouse, then set your Bitquery access token and the ClickHouse login. Sign up for Bitquery to create a token.

docker run -d --name trades-ch -p 127.0.0.1:8123:8123 \
  -e CLICKHOUSE_USER=trades -e CLICKHOUSE_PASSWORD=change-me -e CLICKHOUSE_DB=dex \
  clickhouse/clickhouse-server:25.8
export BITQUERY_TOKEN=your_access_token CLICKHOUSE_USER=trades CLICKHOUSE_PASSWORD=change-me

The scripts create the table on first use. It has 22 columns from the API and one more, source, which says where a row came from: history, stream or gap.

CREATE TABLE IF NOT EXISTS dex.trades (
    Block_Time DateTime('UTC'),
    TransactionHeader_Hash String,
    TransactionHeader_Index UInt32,
    TradeIndex UInt32,
    Side LowCardinality(String),
    Amounts_Base Float64,
    Amounts_Quote Float64,
    Price Float64,
    PriceInUsd Float64,
    AmountsInUsd_Base Float64,
    AmountsInUsd_Quote Float64,
    Trader_Address String,
    TransactionHeader_FeePayer String,
    TransactionHeader_Fee Float64,
    Pair_Token_Address String,
    Pair_Token_Symbol String,
    Pair_QuoteToken_Address LowCardinality(String),
    Pair_QuoteToken_Symbol LowCardinality(String),
    Pair_Market_Protocol LowCardinality(String),
    Pair_Market_ProtocolFamily LowCardinality(String),
    Pair_Market_Program LowCardinality(String),
    Pair_Pool_Address String,
    source LowCardinality(String)
) ENGINE = MergeTree
PARTITION BY toDate(Block_Time)
ORDER BY (Block_Time, TransactionHeader_Hash, TradeIndex);

The engine is a plain MergeTree with no expiry rule (TTL), so your copy keeps what you load. The API has 59 fields for a trade. To add one, add a line to the CORE list in fields.py. The GraphQL selection, the Parquet schema and the table all come from that list.

Step 2: start the live stream first

Start live.py before the backfill. The stream then covers the present while the backfill fills the past, and the two meet with no hole between them.

python3 live.py --tokens JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN

The script sends one subscription. For the JUP slice it looks like this, with the 22 fields in place of the dots:

subscription {
  Trading {
    Trades(
      where: {
        Pair: {Market: {NetworkBid: {is: "bid:solana"}}}
        any: [
          {Pair: {Token: {Address: {in: ["JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN"]}}}}
          {Pair: {QuoteToken: {Address: {in: ["JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN"]}}}}
        ]
      }
    ) {
      Block { Time }
      TransactionHeader { Hash Index FeePayer Fee }
      TradeIndex
      ...
    }
  }
}

After a few seconds live.py prints a JSON line with "event": "complete_from" and a block time. The table holds every trade of the slice from that block time on. Rows before that time are not stored, because the first seconds of a subscription arrive in part.

live.py writes rows in batches of 5,000 rows or 2 seconds. It counts the bytes it receives and stops at --max-gb, which is 1 by default, because stream data is billed.

Step 3: backfill history from the API into Parquet

In a second terminal, pull the history up to the complete_from time. Set --before at least one minute after that time and at least 60 seconds in the past.

python3 backfill.py --since 2026-12-04T14:00:00Z --before 2026-12-04T15:06:00Z \
  --tokens JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN --out files

backfill.py reads one minute at a time and writes one Parquet file per 10 minutes. A file that exists is skipped, so you can stop the script and run the same command again.

Each minute takes two calls. The first call asks for the count, and the second asks for the rows with a limit above the count. The minute in this example held 20,806 trades.

{
  Trading {
    Trades(
      limit: {count: 22896}
      where: {
        Pair: {Market: {NetworkBid: {is: "bid:solana"}}}
        Block: {Time: {since: "2026-12-04T06:10:00Z", before: "2026-12-04T06:11:00Z"}}
      }
    ) {
      Block { Time }
      TransactionHeader { Hash Index FeePayer Fee }
      TradeIndex
      ...
    }
  }
}

The paging rule has three parts, and we measured each one:

  • Each window includes its first second and excludes its last. The query uses since and before. The other upper bound, till, includes its second, so two pages written with till both return the boundary second.
  • Count first, then rows with a limit above the count. A query with no limit returns at most 25,000 rows and no error. A page passes only when the number of rows equals the count. If the two differ, the script reads the window again in two halves.
  • No window ends less than 60 seconds before now. The API is still adding trades to the last few seconds.

We ran the backfill once with no token filter:

Whole-market backfillMeasured
History readsix hours
Trades7,305,259
API calls720
JSON received6.2 GB
Time on one connection61 minutes
Parquet files36 files, about 1 GB

Step 4: load the Parquet files into ClickHouse

load.py sends each Parquet file to ClickHouse.

python3 load.py files/*.parquet

Each file records its time window and its slice. load.py deletes that window of that slice from the table and inserts the file. Loading a file twice leaves the same rows.

ClickHouse reads Parquet directly, so the script sends each file as it is:

INSERT INTO dex.trades (Block_Time, ..., source)
SELECT Block_Time, ..., 'history'
FROM input('Block_Time DateTime(''UTC''), ...')
FORMAT Parquet

We loaded those six hours three times:

LoadMeasured
Rows7,305,259
Time per run24 to 28 seconds
Rateabout 260,000 to 310,000 rows per second

Step 5: check your table against the API

verify.py reads the same time range from the API and compares the two.

python3 verify.py --since 2026-12-04T14:00:00Z --before 2026-12-04T15:30:00Z \
  --tokens JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN --self-test

For each minute, verify.py counts the copies of each key in your table and the copies the API returns. It prints the minutes that differ and ends with one line:

slice=all minutes=418 local_rows=8686214 api_rows=8686214 missing=0 extra=0 keys_the_api_returns_more_than_once=0 minutes_that_differ=0 api_calls=836

Exit code 0 means equal, and 1 means at least one minute differs. With --self-test the script first copies one minute into a scratch table, removes one row and doubles another, and shows that the check reports both.

verify.py caught a failed backfill on the first day. Our first backfill stopped after one of six hours, and a shell pipeline hid the error. The check reported the five hours that were not loaded as missing.

Query the table, stop the stream, and go to the whole market

Query the table. The table is plain ClickHouse. This query returns the trades and the USD volume of the slice per hour:

SELECT toStartOfHour(Block_Time) AS hour, count() AS trades, round(sum(AmountsInUsd_Quote)) AS usd
FROM dex.trades
GROUP BY hour ORDER BY hour;

When verify.py reports a difference. The script prints each minute that differs. Delete the Parquet files that cover those minutes, run the same backfill.py command again, and load the new files. load.py replaces the time window of each file, so the second load doubles nothing.

Stop and restart live.py. Stop the script with Ctrl-C or SIGTERM. It writes the rows it holds and leaves any open gap in the state file. Start the same command again, and the script reads the break by query. After a break of more than one hour, the script prints break_too_long with a backfill_since time. Run backfill.py and load.py from that time.

The whole market. Leave out --tokens in all four commands, and raise --max-gb. With the default of 1 GB, a whole-market stream stops after about 47 minutes at the rate we measured.

Eleven things that break a copy of DEX trades

We hit each of these eleven cases in a test. The repo's code handles each one.

A query that ends at the current second is short

We took 30 windows of ten seconds and polled the count from one second after each window closed. At one second the count was short in 29 of the 30 samples. The median shortfall was 5%, and the worst sample was 24% short.

Bar chart of 30 samples on 4 December 2026: the number of samples in which the API's count of a 10-second window equaled its final count. 1 of 30 at 1 second after the window closed, 15 at 2 seconds, 20 at 3 seconds, and all 30 at 4 and 5 seconds.

The count stopped changing by the poll at 4 seconds in every sample, and it stayed the same up to 45 seconds. In 6 samples the count went down between two polls before it stopped. The scripts wait 60 seconds, which is 15 times the 4 seconds the slowest sample needed.

A new subscription replays nothing

We closed the socket on purpose 30 minutes into the whole-market run. The close and the new subscription took 12 seconds. The script marked 23 seconds of block time as a gap. A gap is a time range that the stream may not have delivered in full. The script read that range by query 60 seconds later and replaced the table's rows of that range. The query returned 14,896 trades. The stream had delivered 5,568 trades of that range.

So every reconnect and every restart costs one read by query. live.py saves each gap to a state file before it does anything else, and a restart reads the file. A kill with kill -9 does not lose a gap.

The seconds around a drop arrive in part

The first rows of a new subscription were a few seconds older than the subscription. In one run, six trades were also missing in two seconds shortly before a drop, and only the stream had covered those two seconds.

A gap now starts 30 seconds before the newest trade seen before the drop. The script waits until the new connection has run for 5 seconds. The gap ends 6 seconds after the newest trade held at that moment. A gap replaces the table's rows of its range, so the overlap with stream rows doubles nothing.

The API can return one trade twice

We counted rows and distinct keys for every ten-minute window of three days.

DayRows above the number of keysWindows with a repeat
10 November 20265,9259 of 144
20 November 202611 of 144
3 December 202600 of 144

In a five-minute sample from the API, some repeats were two versions of one trade at different block times.

A table with a unique key, or a ReplacingMergeTree, would merge those rows, and the count would no longer match the API. The table in this guide replaces rows one time range at a time. A load or a gap read deletes a range and inserts what the API returns for that range.

Two API servers can disagree on which token is the base

The API lists one token of a swap as Pair.Token and the other as Pair.QuoteToken. For one transaction, two servers listed JUP as Pair.Token, and the third listed JUP as Pair.QuoteToken. A filter on Pair.Token.Address then returns a different set of trades from call to call. For one minute, four identical calls returned 803, 803, 801 and 801 rows.

A filter on either side returned 981 rows on all four calls. The scripts use the any: [...] form shown in step 2, and the table filter matches both address columns.

USD values change between calls

Two identical queries one second apart returned the same keys. At least one of seven USD, supply and ranking fields differed on 97% of rows, and PriceInUsd alone differed on 64%. Amounts, Price, the fee and the block time were equal. verify.py compares keys only, and you should treat the USD columns as estimates made at read time.

A slow write stops the socket read

In an early version, a gap read ran inside the socket loop. No frame was read while the query ran, and the socket closed with a keepalive ping timeout. verify.py then found 19,507 trades missing.

In the current code the socket is always read. ClickHouse and API work runs on one worker thread beside the socket, one job at a time.

A sleeping laptop skips frames

Two long runs happened to span laptop sleep. The process froze, the socket fell behind, and frames were skipped. live.py now treats a socket that was not read for more than 5 seconds as a drop and opens a gap. After a run that slept in 15-minute cycles for three hours, the table still matched the API on 99 minutes and 7,837 trades of the JUP slice.

One insert per frame makes too many parts

ClickHouse writes one part per insert. Writing as fast as rows arrived made 1,601 parts in 75 seconds. Writing in batches made 36 parts for about the same number of rows.

A cut reply stops a long backfill

One reply of about 2 MB was cut while the script read it, and Python raised IncompleteRead. The first version did not retry that error. api.py now tries a call up to five times after a cut reply, a 429 or a 5xx.

ClickHouse goes away for a minute

We stopped the ClickHouse container for 75 seconds during a whole-market run. live.py logged 85 failed inserts and held the rows in memory, up to 35,862 of them. When ClickHouse came back, the script wrote the rows. The table matched the API on every trade of those four minutes.

An insert with an unknown result is not trusted. Its seconds go on the gap list and are replaced from the API.

How much storage the trades take

We measured each form of the same 22 fields.

Bar chart of bytes per Solana DEX trade with 22 fields, measured on 4 December 2026: 905 bytes on the stream, 848 bytes as JSON from the API, 213 bytes in ClickHouse with LZ4, 140 bytes in Parquet with zstd and 139 bytes in ClickHouse with ZSTD(3).
FormBytes per tradeMeasured on
Stream frames, 22 fields9051,432,935 trades, 61 minutes
API replies (JSON), 22 fields8487,305,259 trades, six hours
ClickHouse, default LZ42138,708,461 trades
Parquet, zstd1407,305,259 trades
ClickHouse, CODEC(ZSTD(3)) on every column1398,708,461 trades
Stream frames, all 59 fields2,020142,055 trades, five minutes

The largest column is the transaction hash, at 37% of the bytes on disk.

We also loaded the same 8.7 million rows into four table designs and timed four queries.

DesignBytes per rowOne token, one hourTop 20 traders, all rowsOne transaction by hash, first run
Ordered by time, LZ421316 ms166 ms3,384 ms
Ordered by time, ZSTD(3)13920 ms205 ms957 ms
Ordered by token, then time16213 ms180 ms111 ms
ReplacingMergeTree, read with FINAL21334 ms279 ms222 ms

The first two time columns are the best of three runs, and the last is one first run. ZSTD cut disk use by 35%. The two repeated reads were 4 ms and 39 ms slower with ZSTD, and the first lookup by hash was 2.4 seconds faster. We did not measure the cost of ZSTD on writes. The ReplacingMergeTree design needs FINAL on every read, and its first runs took about 2 seconds on two of the queries.

For the whole Solana DEX market, by our estimate:

Whole marketFigure
Trades per day, on the five days we counted31.7 to 37.7 million
30 days in ClickHouse with ZSTD, at 139 bytes per tradeabout 130 to 160 GB

The storage figure is an estimate, scaled from the rows we loaded.

What it costs to run on Bitquery

Prices are from the Bitquery pricing page, read on 4 December 2026. A point is Bitquery's unit of query cost, and the page puts a real-time query at 5 points. Stream data is metered in GB.

PlanPricePoints per monthStreams
Free trial, 7 days, no card$01,00017 stream-minutes, 0.2 GB
Personal$29 per month, billed yearly100,000none
Pro$69 per month, billed yearly1,000,000100,000 stream-minutes, 5 GB
Scale$199 per month, billed yearly5,000,0002,000,000 stream-minutes, 50 GB

The three paid plans list 30 days of trades. The page limits the Personal plan to personal use, and that plan has no streams, so it covers backfill.py and verify.py only.

Bar chart of stream data per 30 days against plan allowances: the Pro plan includes 5 GB and the Scale plan 50 GB; a one-token stream for JUP is estimated at 1.9 to 4.4 GB; the whole Solana DEX market with 22 fields is estimated at 860 to 1,020 GB. The scale is logarithmic.
JobMeasured30 days, by our estimatePlan allowance
Stream of one token, JUP5.7 MB in 31 minutes, 947 bytes per trade; 68,261 to 154,105 trades per day on 2 to 4 December 20261.9 to 4.4 GB, 43,200 stream-minutesPro: 5 GB, 100,000 stream-minutes
Stream with no token filter, 22 fields1.30 GB in 61 minutes860 to 1,020 GBPro: 5 GB, used in under four hours. Scale: 50 GB, used in about 39 hours
Backfill of one slicetwo calls per minute of history, 5 points per callabout 86,400 calls, 432,000 pointsPro: 1,000,000 points
Backfill with no token filter7,305,259 trades and 6.2 GB of JSON in 61 minutes0.95 to 1.13 billion trades, 800 to 960 GB of JSON, 5.5 to 6.5 days on one connectionPro: 1,000,000 points, for the same two calls per minute

One token. By our estimate, a stream of JUP for 30 days stays inside the stream data and the stream-minutes of the Pro plan.

History. backfill.py makes two calls per minute of history, and one call for a minute with no trade. The estimate assumes that no call is tried again and no window is read again. Thirty days of history for one slice is inside the points of the Pro plan. verify.py costs the same per minute it checks. We did not read a bill to confirm either figure.

Every trade. A self-service plan covers a stream of every trade for a few hours only. The pricing page sells extra stream data at $1,000 per 500 GB bought monthly, and it names the Enterprise plan for a stream that is always on. Bitquery also sells Kafka streams for feeds of that size. We did not test Kafka for this guide.

For history older than 30 days, or for the whole market in bulk, Bitquery sells files. The Solana DEX trades dataset in the Data Store holds trades and pools as Parquet, in a different column layout from the table in this guide.

Limits

  • We measured on one laptop, on six hours of history and one hour of whole-market stream. Every 30-day figure in this guide is scaled from those runs and from daily counts, and each is marked as an estimate.
  • The check compares your table with the same service. It shows that the copy and the API agree. It cannot show that the API holds every trade on the chain.
  • Trading { Trades } is not every DEX transaction on Solana. For three DEX programs and two minutes, Bitquery's Solana { DEXTrades } API held 9, 192 and 43 more transactions, which is up to 4% more. That API also lists aggregators such as Jupiter as markets, and Trading { Trades } does not. Every sampled transaction in our table was in Solana { DEXTrades }.
  • We did not read a bill. We do not know whether the GB meter counts the decoded bytes we measured, or what happens when a plan's points or GB run out.
  • We did not test with a trial token. The trial figures are from the pricing page, which says the trial covers real-time data only.
  • The API holds 30 days. verify.py can check a minute only while the API still has it.
  • The three-server match used internal access. A reader can repeat the match with the API and cannot repeat the match with each server.
  • A token can sit in either address column. A query for one token must test Pair_Token_Address and Pair_QuoteToken_Address.
  • A null number is stored as 0. A missing USD price and a price of zero look the same in the table.
  • A page is always 60 seconds. A quiet slice could use longer pages and fewer calls. The scripts do not do that.
  • The delete and the insert of a range are two statements. A failure between them leaves the range empty until the step runs again, and verify.py shows it.
  • One table should hold one slice. load.py and live.py should also not write the same time range at the same moment.
  • The scripts run on Linux and macOS. The state-file lock and the signal handling do not exist on Windows.
  • The scripts trust the local clock. A clock that runs minutes fast would read a page before the API has settled it.
  • We ran the tests on Python 3.10, 3.12, 3.13 and 3.14. The live runs used 3.14.
  • The scripts are example code. The repo has 79 tests, and the socket loop is tested against a fake socket only. Review the code before you depend on it.

How we tested

TestWhen (UTC)What we measured
Stream, whole market4 December 2026, 12:08:04 to 13:09:03Trading { Trades } on wss://streaming.bitquery.io/graphql, 22 fields: 1,432,935 trades in 112,805 frames, with one forced disconnect
Backfill4 December 2026, block times 06:10:00 to 12:10:007,305,259 trades, 720 calls
Match with the API4 December 2026, block times 06:10:00 to 13:08:00verify.py --self-test: 418 minutes, 836 calls, 8,686,214 trades on each side
Match with the three serversthe same 418 minutesrow count and a checksum of the keys per minute, compared with each of the three Bitquery servers that hold the trades; no minute differed on any server
Repeated keys10 November, 20 November and 3 December 2026row counts and distinct keys of every ten-minute window, read from Bitquery's own database
Settle time4 December 2026, 12:09 to 12:3130 samples, each polled 12 times from 1 to 45 seconds after the window closed
One token5 December 2026, 12:41 to 13:12JUP: 6,007 trades, 5,691,617 bytes
Breaks, end to end5 December 2026the JUP slice through a stop, a stop 2 seconds after subscribing, two kill -9, a forced disconnect and 40 seconds without ClickHouse; after a backfill and a load, verify.py matched 2,622 trades on each side over 24 minutes, on the final code
  • Independent recount. We wrote the code and ran the analysis with an AI coding assistant. A separate AI agent then recomputed every count and byte total that has a raw file with its own code. The recount corrected five figures in the draft.
  • Code review. Three independent AI code reviews found ten faults rated high across three versions of the code, and we fixed all ten. The third review ran the scripts on the JUP slice through a forced drop and two kill -9. Its table matched the API on 2,614 trades. The README of the repo lists the low-rated faults that remain.

FAQ

How do I get Solana DEX trades into ClickHouse?

Pull history from an API into Parquet files, load the files, and keep the table current from a stream. The four scripts in bitquery/solana-dex-clickhouse do that with the Bitquery Trading { Trades } API. Start the stream first, then backfill up to the time the stream is complete from.

Where can I get Solana historical data for DEX trades?

The Bitquery Trading { Trades } API holds the last 30 days, and backfill.py reads them one minute at a time. For older history, the Bitquery Data Store sells older trades as Parquet files.

How do I load Parquet into ClickHouse?

Send the file as the body of an INSERT ... FORMAT Parquet statement over HTTP. ClickHouse reads the Parquet columns directly. load.py uses INSERT ... SELECT ... FROM input(...) FORMAT Parquet, which also lets it stamp a source column on each row. Our 7.3 million rows loaded in under 30 seconds.

How many DEX trades does Solana have per day?

Bitquery data held 31.7 to 37.7 million Solana DEX trades per day on five days in November and December 2026. Pumpswap made 50% of the trades in the seven hours we loaded.

How much storage does a day of Solana DEX trades need?

With the 22 fields of this guide, a trade took 139 bytes in ClickHouse with ZSTD and 213 bytes with LZ4. At 31.7 to 37.7 million trades per day, one day is about 4.4 to 5.2 GB with ZSTD. That figure is scaled from 8.7 million rows.

Which ClickHouse table engine fits DEX trades?

A plain MergeTree ordered by block time fits a table that mirrors an API. Do not use ReplacingMergeTree to remove duplicates by key. The source held 5,925 extra copies of keys on one day, and a merge by key would drop those rows.

How do I know my copy has every trade?

Compare keys per minute with the source. verify.py counts the copies of each transaction hash and TradeIndex in your table and in the API's reply, and reports each minute that differs. A row count alone can hide one missing trade next to one doubled trade.

What happens to the stream data when the connection drops?

The stream does not replay the trades of a dropped connection. A new subscription starts at the present, so the trades of the break never arrive on the stream. live.py records the break as a gap and reads those seconds by query once they are 60 seconds old.

Can I stream the whole Solana DEX market on a self-service plan?

A self-service plan covers the whole Solana DEX market for a few hours only. The whole market sent 1.30 GB in 61 minutes, and the Pro plan includes 5 GB. A stream of one token fits: JUP came to an estimated 1.9 to 4.4 GB per 30 days.

Can I run this on the Bitquery free trial?

The trial should cover a short test of one token, and we did not test with a trial token. The pricing page gives the trial 1,000 points, which is 200 queries at 5 points each, and 17 stream-minutes. By those figures the trial covers about 100 minutes of backfill for one token, or 17 minutes of one stream.

Why are the USD values in my table different from a new query?

The API computes USD prices, market cap and ranking values at read time. In two identical queries one second apart, PriceInUsd differed on 64% of rows. Amounts in tokens, Price and the fee were equal.

Related reading

Subscribe to our newsletter

Subscribe and never miss any updates related to our APIs, new developments & latest news etc. Our newsletter is sent once a week on Monday.