Skip to main content

sqd_py

Python client for querying blockchain data from SQD Network.

Installation

pip install sqd_py

Install the fast extra to also pull in uvloop (auto-enabled on import, not available on Windows):

pip install sqd_py[fast]

Quick Start

import asyncio
from sqd import SQD, Dataset, EvmFields

async def main():
    sqd = SQD(dataset=Dataset.ETHEREUM)
    
    query = sqd.get_transactions(
        from_block=17_000_000,
        to_block=17_000_010,
        address="0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
    )
    
    async for block in query:
        for tx in block.get("transactions", []):
            print(tx["hash"])

asyncio.run(main())

Usage

Querying Logs

query = sqd.get_logs(
    from_block=17_000_000,
    to_block=17_000_100,
    address="0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    topic0="0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
)

async for block in query:
    for log in block.get("logs", []):
        print(log)

ERC-20 Transfers

query = sqd.get_transfers(
    from_block=17_000_000,
    to_block=17_100_000,
    contract_address="0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
)

async for block in query.with_progress():
    for log in block.get("logs", []):
        print(log)

Selecting Fields

query = sqd.get_transactions(
    from_block=17_000_000,
    to_block=17_000_010,
    include_fields=[
        EvmFields.TransactionField.hash,
        EvmFields.TransactionField.from_,
        EvmFields.TransactionField.gasUsed,
    ],
)

Chaining Queries

query = sqd.get_transactions(
    from_block=17_000_000,
    to_block=17_000_010,
    address="0x...",
).get_logs(
    address="0x...",
    topic0="0x...",
)

async for block in query:
    # block contains both transactions and logs
    pass

Progress Bar

async for block in query.with_progress():
    pass

Prefetch is enabled by default (2 concurrent workers) whenever the end of the range is known, and falls back to a single serial worker otherwise. Use prefetch_workers to change the worker count, or pass prefetch_workers=1 to force the serial path:

async for block in query.with_progress(prefetch_workers=4):
    pass

shards is still accepted as a deprecated alias for prefetch_workers.

Hyperliquid (HyperCore fills)

The hyperliquid-fills dataset exposes individual perpetual-futures trade executions (fills). Every filter accepts a single value or a list (OR-match); different filters combine with AND.

from sqd import SQD, HyperliquidFields

sqd = SQD(dataset="hyperliquid-fills", stream_type="finalized")

query = sqd.get_fills(
    from_block=905_000_000,
    to_block=905_001_000,
    coin=["BTC", "ETH"],          # OR; or a single string for one coin
    include_fields=list(HyperliquidFields.FillField),
)

async for block in query:
    for fill in block.get("fills", []):
        print(fill["coin"], fill["px"], fill["sz"], fill["side"])

Available filters: coin, user, builder, dir, fee_token, cloid.

SQD does not serve OHLCV candles directly. Build them by bucketing fills by the time field per coin — see examples/hyperliquid_candles.py.

Supported Datasets

72 EVM chains (Ethereum, Arbitrum, Base, Optimism, Polygon, zkSync, and more — see Dataset for the full list), plus Solana and Hyperliquid:

Chain Dataset
Ethereum Dataset.ETHEREUM or "ethereum-mainnet"
Arbitrum One Dataset.ARBITRUM_ONE or "arbitrum-one"
Base Dataset.BASE or "base-mainnet"
Optimism Dataset.OPTIMISM or "optimism-mainnet"
Polygon Dataset.POLYGON or "polygon-mainnet"
Binance Smart Chain Dataset.BINANCE or "binance-mainnet"
Solana Dataset.SOLANA or "solana-mainnet"
Hyperliquid (HyperCore fills) Dataset.HYPERLIQUID_FILLS or "hyperliquid-fills"

Any other EVM dataset slug served by the SQD portal also works — pass it as a plain string (e.g. SQD(dataset="scroll-mainnet")) even without a matching Dataset member.

API

SQD

SQD(
    dataset: Dataset | str,
    portal_url: str = "https://portal.sqd.dev",
    stream_type: Literal["finalized", "realtime"] = "realtime",
)

Query Methods

EVM:

  • get_blocks(from_block, to_block, ...)
  • get_transactions(from_block, address, to_block, ...)
  • get_logs(from_block, address, topic0, to_block, ...)
  • get_transfers(from_block, contract_address, ...)
  • get_traces(from_block, to_block, ...)
  • get_state_diffs(from_block, to_block, ...)

Hyperliquid:

  • get_fills(from_block, to_block, coin, user, builder, dir, fee_token, cloid, ...)

Iteration

  • async for block in query — default iteration
  • query.with_progress(prefetch_workers=N) — with progress bar; prefetching on by default

Requirements

  • Python 3.10+
  • aiohttp >= 3.9.0
  • tqdm >= 4.67.1
  • orjson >= 3.10.0

License

MIT

Metadata

Release files for sqd-py 0.4.0

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

Source distribution (sdist)

Source distribution for sqd-py 0.4.0
File Size Uploaded Provenance
sqd_py-0.4.0.tar.gz 30.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sqd-py 0.4.0
File Interpreter ABI Platform
sqd_py-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 70.4 kB

Release files / sqd_py-0.4.0.tar.gz

Download URL sqd_py-0.4.0.tar.gz
Size 30.7 kB
Tags Source
SHA-256 checksum
How to use checksums
8183559c8c64d79909824810fe55aaae70cfb16e6ba4eb9b08cab1050ee71949
BLAKE2b-256 checksum
How to use checksums
8bb755e749c1775eb410e5cec59cdb66543b77286ba6fc3096b401f0db7a1f95
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Release files / sqd_py-0.4.0-py3-none-any.whl

Download URL sqd_py-0.4.0-py3-none-any.whl
Size 39.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
08bcd46e75a51a49b5f75244cac7a6a6290711143f82a078c5038009a956bf23
BLAKE2b-256 checksum
How to use checksums
7ae8892b20bca6f871f41fc4f3a651e017cd780a1cdb7185915677d4db4de346
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

Security for sqd-py 0.4.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sqd_py-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 12, 2026.

Transparency log

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.

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