Skip to main content

dataonchain — the Python client

Download our hourly pump.fun and PumpSwap data files from Python or from a command line. One hour of one exchange is one Parquet file, and one credit.

The package, the import and the command are all called dataonchain, after the brand (it was the placeholder ticktape until 2026-11-13).

Install

pip install dataonchain

To build a wheel yourself instead, from a copy of this folder:

python -m pip wheel --no-build-isolation --no-deps -w dist .
pip install dist\dataonchain-0.1.1-py3-none-any.whl

Python 3.9 or newer. No dependencies: everything is the standard library, so it installs into whatever environment your research already lives in without moving any of its versions.

Set your key

$env:DATAONCHAIN_API_KEY = "doc_live_..."                 # make a key on the account page
$env:DATAONCHAIN_BASE_URL = "https://api.dataonchain.io"  # optional: this is the default

There is deliberately no --api-key option on the command line: a key typed there ends up in your shell history and in the list of running processes. Use the environment variable, or --api-key-file <path> for a file that holds nothing but the key.

DATAONCHAIN_BASE_URL is only needed to point the client somewhere else (a local development server). Without it the client talks to https://api.dataonchain.io.

A key file may be saved in any of the encodings Windows PowerShell writes (>, Out-File, Set-Content, with or without a byte-order mark): the mark is not treated as part of the key. The file (or the variable) must hold nothing but the key — a note on the next line, a second key, or a key that wrapped onto two lines is refused before anything is sent, with a message that never quotes the key.

The command line

dataonchain account                                  # credits, and how far back they reach
dataonchain range pump_fun                           # first and newest hour on file
dataonchain files pump_fun 2026-11-09                # one day, hour by hour
dataonchain coverage pump_fun --from 2026-10-01      # free, no key needed
dataonchain schema pump_fun                          # the column list (free)
dataonchain samples --out .\samples                  # the free sample files (free)

# A date range. --dry-run shows the cost and downloads nothing.
dataonchain download pump_fun 2026-11-01 2026-11-07 --out .\data --dry-run
# Without --dry-run it shows the cost, ASKS before spending, then downloads:
dataonchain download pump_fun 2026-11-01 2026-11-07 --out .\data --workers 4
# A script or scheduled job has nobody to ask: say yes in advance with --yes.
dataonchain download pump_fun 2026-11-01 2026-11-07 --out .\data --yes

# Check what is already on disk against the SHA-256 we publish, and fetch again
# anything that differs (hours you already own are free):
dataonchain download pump_fun 2026-11-01 2026-11-07 --out .\data --verify

# Print the result only. --quiet, --base-url and --api-key-file work on either
# side of the subcommand.
dataonchain download pump_fun 2026-11-01 2026-11-07 --out .\data --quiet

A date means the whole UTC day. 2026-11-09T07 means that one hour. from and to are both included. Files land as:

data/pump_fun/2026-11-09/07.parquet
data/pump_fun/2026-11-09/07.parquet.json   <- what it is, and how we know it is untouched

download always shows the plan and its cost before anything is charged, and asks before it spends a credit: type y to go ahead, anything else stops with nothing charged. With no terminal to ask on (a pipe, a scheduled job, CI) it stops before any charge unless you gave --yes. A plan that costs more than your balance stops before any charge too, rather than buying the first part of a long range and refusing the rest. The download then asks for exactly the hours the plan priced, so it can never cost more than the price you agreed to: an hour published while the question waited is left out, not charged. A run that costs nothing (everything owned or on disk) does not ask. Run it again and it downloads nothing: hours already on disk are not asked for, and no request even spans one of them — the API charges for every hour inside the range it is given, so a request that jumped over a file on your disk would buy that hour again. Runs of consecutive hours are therefore asked for one run at a time, which can mean several requests for a folder with many holes in it (the client waits out the rate limit by itself).

From Python

from dataonchain import Client

c = Client()                       # key from DATAONCHAIN_API_KEY, host from DATAONCHAIN_BASE_URL

print(c.account())                 # {'balance': 1000, 'full_history': False, ...}
print(c.range("pump_fun"))         # what exists
print(c.files("pump_fun", "2026-11-09"))
print(c.coverage("pump_fun", "2026-10-01", "2026-10-31"))   # free
print(c.schema("pump_fun"))                                  # free
print(c.samples())                                           # free

# What a range would cost, charging nothing:
plan = c.download_range("pump_fun", "2026-11-01", "2026-11-07", "./data", dry_run=True)
print(plan.cost, "credits")

# Then do it (4 files at a time):
got = c.download_range("pump_fun", "2026-11-01", "2026-11-07", "./data", workers=4)
print(len(got.downloaded), "downloaded,", got.charged, "credits, balance", got.balance)
for missing in got.skipped:
    print("not for sale:", missing.date, missing.hour, missing.reason)

# One hour:
c.download("pump_fun", "2026-11-09", 7, "./data")

download_range returns a RangeResult: downloaded, already (on disk before it started), skipped (not for sale, each with a plain reason), failed, plus cost, charged, balance and bytes_downloaded.

What it does for your money

  • Your key never reaches the storage host. Links are always asked for in the JSON form, and redirects are never followed — an HTTP client that follows a redirect usually passes its headers on to wherever it lands.
  • Your key only travels over https. A base URL that is plain http:// (or any other scheme) is refused before the key is sent, unless it is a server on this machine (localhost, 127.0.0.1, ::1) — so a one-letter slip (http://api…) never puts the key on the network. The free calls (coverage, schema, samples) carry no key and are unaffected.
  • Only https links are opened. A link in an answer that is file:, ftp:, data: or plain http to another machine is refused, so no answer can make the client copy a local file into your data folder or reach an address inside your network.
  • What the API says is shown, never obeyed. Column notes, key names, statuses, sample names and error messages are printed with any terminal control sequence written out visibly (\x1b…), so no answer can write your clipboard, show a link whose text is not its target, or rewrite the line that told you what was charged. Ordinary text, accents and CJK included, is printed exactly as before.
  • A file is only kept if its bytes are the bytes the API promised. Each file is streamed to <HH>.parquet.part, hashed while it is written, and renamed into place only when both its length and its SHA-256 match. A mismatch leaves nothing behind.
  • Nothing is downloaded or charged twice. The .json beside a finished file holds its SHA-256 and its size and modification time. A later run that sees those unchanged skips the hour with no request at all.
  • A crash costs at most the file it was in the middle of. The .part file stays, and the next run asks the storage host to carry on from that byte. A host that ignores byte ranges just sends the file again.
  • An expired link is replaced for free. Links live minutes; asking again for an hour you already own costs nothing.
  • Money answers are never retried. "Not enough credits" (402) and "older than your credits reach" (403) stop at once. "Too many requests" (429) and "the server is busy" (5xx) are waited out, honouring Retry-After, with a little jitter so parallel workers do not all come back at the same moment.
  • A bad date never leaves your machine. Ranges are checked before anything is sent.
  • File trouble is reported, not raised. No folder, no permission, a full disk, a name taken by a directory: that one hour fails with a plain reason and the run still tells you what arrived and what it cost.
  • --verify when you do not trust what is on disk. The fast path above trusts the record beside a file while its size and modification time are unchanged, so a file some other tool changed in place (a restored older copy, rclone -t, a hand edit with the timestamp put back) would be taken on trust. --verify (or verify=True) hashes the file itself against the SHA-256 the API gives and fetches again only what differs. Hours you already own cost nothing, so for your own folder this is free.

Reading what you downloaded

The folder is laid out so one query reads any slice of it.

DuckDB

import duckdb

con = duckdb.connect()

# A whole week of pump.fun, in one query. The folder layout is not hive-style
# (there is no date=... in the names), so the date and hour are read out of the
# file path: `filename = true` adds that path as a column, and replace() makes
# the example work on Windows paths too.
rows = con.execute("""
    WITH f AS (
        SELECT *, replace(filename, chr(92), '/') AS p
        FROM read_parquet('data/pump_fun/*/*.parquet', filename = true)
    )
    SELECT split_part(p, '/', -2) AS date,
           replace(split_part(p, '/', -1), '.parquet', '') AS hour,
           count(*) AS events,
           -- SOL only: rows priced in SOL, and none flagged implausible (see below)
           sum(lamports_amount) FILTER (
               WHERE lamports_mint = 'So11111111111111111111111111111111111111112'
                 AND NOT implausible) / 1e9 AS sol
    FROM f GROUP BY 1, 2 ORDER BY 1, 2
""").fetchall()

# The busiest coins of a day, by SOL traded:
con.execute("""
    SELECT token_mint, count(*) AS trades, sum(lamports_amount) / 1e9 AS sol
    FROM 'data/pump_fun/2026-11-09/*.parquet'
    WHERE event_type = 'swap'
      AND lamports_mint = 'So11111111111111111111111111111111111111112'
      AND NOT implausible
    GROUP BY 1 ORDER BY sol DESC LIMIT 10
""").df()

Adding up SOL: two filters, every time. A pump.fun coin can be priced in another token (USDC and dozens more): lamports_amount is then in that token's own units, and lamports_mint says which token (SOL is written as So11111111111111111111111111111111111111112). And a few rows are flagged implausible (an amount no real trade can have; their currency is NULL). Summing lamports_amount without both filters mixes them all in: on one test hour of 2026-09-22 it said 2.5 billion SOL, where the SOL-priced rows hold about 28,000.

(The files themselves hold 45 columns and neither date nor hour is one of them — every row already carries its own timestamp — which is why the query above reads them out of the path. SELECT * FROM 'data/pump_fun/2026-11-09/*.parquet' needs none of that.)

Polars

import polars as pl

SOL = "So11111111111111111111111111111111111111112"

# Lazily, so only the columns and rows you ask for are read off disk.
# SOL-priced swaps only, none flagged implausible (see the note above):
day = (
    pl.scan_parquet("data/pump_fun/2026-11-09/*.parquet")
      .filter((pl.col("event_type") == "swap") & (pl.col("lamports_mint") == SOL)
              & ~pl.col("implausible"))
      .group_by("action")
      .agg(trades=pl.len(), sol=pl.col("lamports_amount").sum() / 1e9)
      .collect()
)
print(day)

# A whole month, one exchange:
month = pl.scan_parquet("data/pump_fun/**/*.parquet").select(
    pl.col("timestamp"), pl.col("token_mint"), pl.col("lamports_amount")
)

Amounts are raw integers: divide by 10^decimals (SOL 9, Pump.fun tokens 6). timestamp is Unix seconds. An empty value means unknown, never a guessed zero.

Its own tests

From this folder, with pytest installed:

python -m pytest -q

They run a small stand-in for the API over real HTTP (tests/stub.py) and cover each rule above, including the awkward ones: a link that has already expired, a storage host that ignores a byte range, bytes that do not match their SHA-256, 429 with a Retry-After, 402, an output folder that cannot be written, an output folder whose name the console cannot print, and an hour already on disk that this account never bought (which must not be paid for), the question before spending (a no, no terminal, a balance too small, an hour published while it waits), a part left from an older copy of a file, a sample that does not match its list, and a redirect that must never be followed. They also cover the client against a host that is not ours (tests/test_client_outside.py): a plain-http base URL that must not get the key, an answer handing back file:, ftp: or data: links, and terminal control sequences in everything the command prints (whose output for ordinary answers is checked byte for byte against what it was); a key with a line break inside it, which must never be quoted in an error, and a key file saved by Windows PowerShell (tests/test_g24_key_never_quoted.py); and the default address (tests/test_default_address.py). 141 tests. DATAONCHAIN_TEST_PORTS=18480-18489 moves the stub's ports if something else holds 18400-18404.

Metadata

Release files for dataonchain 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dataonchain 0.1.1
File Size Uploaded Provenance Actions
dataonchain-0.1.1.tar.gz 53.1 kB Without provenance Details for dataonchain-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dataonchain 0.1.1
File Interpreter ABI Platform Actions
dataonchain-0.1.1-py3-none-any.whl Python 3 none any Details for dataonchain-0.1.1-py3-none-any.whl

Total release size: 85.0 kB

Release files / dataonchain-0.1.1.tar.gz

Download URL dataonchain-0.1.1.tar.gz
Size 53.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9e45e6791a03268be765e3a8332f6dbc6e656c5cecd35603f5763ff33634332f
BLAKE2b-256 checksum
How to use checksums
4801437252857821b7ac517b46ee69c5e9e9b84c56d639697a9a401ad51719de
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / dataonchain-0.1.1-py3-none-any.whl

Download URL dataonchain-0.1.1-py3-none-any.whl
Size 31.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df94b24fb1df6902fd0fc03995623df34c96639ff50f671644c6e635cd012cca
BLAKE2b-256 checksum
How to use checksums
83c7f5ad7fc392a400ba37295213ad31485280f7f6ae9e812928507872d5792a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for dataonchain 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page