gapless-deribit-clickhouse
Deribit options data pipeline with ClickHouse storage.
Features
- Historical trades: Backfillable from 2018 via
history.deribit.com - Schema-first: YAML schemas generate types, DDL, and documentation
- Python API: Clean interface for querying options data
- BTC + ETH options: Focused on Deribit options trading data
Installation
pip install gapless-deribit-clickhouse
Quick Start
import gapless_deribit_clickhouse as gdch
# Fetch historical trades
df = gdch.fetch_trades(
underlying="BTC",
start="2024-01-01",
end="2024-01-31",
option_type="C" # Calls only
)
# Collect trades to ClickHouse
gdch.collect_trades(
underlying="BTC",
start="2024-01-01"
)
Data Sources
Trades Table
| Field | Type | Description |
|---|---|---|
| trade_id | String | Unique trade identifier |
| instrument_name | String | e.g., BTC-27DEC24-100000-C |
| timestamp | DateTime64 | Trade time (ms precision) |
| price | Float64 | Trade price in USD |
| amount | Float64 | Contract amount |
| direction | String | buy or sell |
| iv | Float64 | Implied volatility |
| underlying | String | BTC or ETH (derived) |
| expiry | Date | Option expiration (derived) |
| strike | Float64 | Strike price (derived) |
| option_type | String | C or P (derived) |
Instrument Name Format
{UNDERLYING}-{DDMMMYY}-{STRIKE}-{TYPE}
Examples:
BTC-27DEC24-100000-C- BTC call, $100k strike, expires Dec 27 2024ETH-28MAR25-5000-P- ETH put, $5k strike, expires Mar 28 2025
Configuration
Credentials
Set ClickHouse credentials via one of:
-
Environment variables:
export CLICKHOUSE_HOST_READONLY=<host> export CLICKHOUSE_USER_READONLY=<user> export CLICKHOUSE_PASSWORD_READONLY=<password>
-
.envfile in project root -
Doppler (recommended for production):
doppler setup --project gapless-deribit-clickhouse --config prd
Development
# Install with dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run linting
ruff check src/
Architecture
+---------------------+
| history.deribit.com |
| /get_last_trades |
+---------------------+
|
v
+---------------------+
| TradesCollector | Historical
| (Backfill) | Backfill
+---------------------+
|
v
+=====================+
| deribit |
| .options_trades |
+=====================+
|
v
+---------------------+
| Python API |
| fetch_trades() |
| collect_trades() |
+---------------------+
ADR: 2025-12-08-clickhouse-naming-convention
License
MIT
Metadata
Release files for gapless-deribit-clickhouse 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| gapless_deribit_clickhouse-2.2.0.tar.gz | 223.9 kB | Without provenance | Details for gapless_deribit_clickhouse-2.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gapless_deribit_clickhouse-2.2.0-py3-none-any.whl | Python 3 | none | any | Details for gapless_deribit_clickhouse-2.2.0-py3-none-any.whl |
Total release size: 281.7 kB
Release files / gapless_deribit_clickhouse-2.2.0.tar.gz
| Download URL | gapless_deribit_clickhouse-2.2.0.tar.gz |
|---|---|
| Size | 223.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a30f0b06f6915904d2da1522150113fddbe840a34c38f0ee2d322699eedb3e3d
|
|
BLAKE2b-256 checksum How to use checksums |
caf5d6dc1251f038df97dd7da0a6ecbb5d6383223c782ce14ecafe626e2b5377
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / gapless_deribit_clickhouse-2.2.0-py3-none-any.whl
| Download URL | gapless_deribit_clickhouse-2.2.0-py3-none-any.whl |
|---|---|
| Size | 57.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1bf58ed3bab956b4ad39cbaa244bcf35cfe5049896c43d734df2428719ee445d
|
|
BLAKE2b-256 checksum How to use checksums |
b789888b8ba931431f043a7aa2ae6289ef9a2ba8e1c8f79354e6d7f214a51592
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for gapless-deribit-clickhouse 2.2.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.
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.