Skip to main content

databento-python

test python pypi-version license code-style: black Slack

The official Python client library for Databento.

Key features include:

  • Fast, lightweight access to both live and historical data from multiple markets.
  • Multiple schemas such as MBO, MBP, top of book, OHLCV, last sale, and more.
  • Fully normalized, i.e. identical message schemas for both live and historical data, across multiple asset classes.
  • Provides mappings between different symbology systems, including smart symbology for futures rollovers.
  • Point-in-time instrument definitions, free of look-ahead bias and retroactive adjustments.
  • Reads and stores market data in an extremely efficient file format using Databento Binary Encoding.
  • Event-driven market replay, including at high-frequency order book granularity.
  • Support for batch download of flat files.
  • Support for pandas, CSV, and JSON.

Documentation

The best place to begin is with our Getting started guide.

You can find our full client API reference on the Historical Reference and Live Reference sections of our documentation. See also the Examples section for various tutorials and code samples.

Requirements

The library is fully compatible with distributions of Anaconda 2023.x and above. The minimum dependencies as found in the pyproject.toml are also listed below:

  • python = "^3.10"
  • aiohttp = "^3.8.3"
  • databento-dbn = "~0.69.0"
  • numpy = ">=1.23.5"
  • pandas = ">=1.5.3"
  • pip-system-certs = ">=4.0" (Windows only)
  • pyarrow = ">=13.0.0"
  • requests = ">=2.25.1"
  • zstandard = ">=0.21.0"

Installation

To install the latest stable version of the package from PyPI:

pip install -U databento

Usage

The library needs to be configured with an API key from your account. Sign up for free and you will automatically receive a set of API keys to start with. Each API key is a 32-character string starting with db-, that can be found on the API Keys page of your Databento user portal.

A simple Databento application looks like this:

import databento as db

client = db.Historical('YOUR_API_KEY')
data = client.timeseries.get_range(
    dataset='GLBX.MDP3',
    symbols='ES.FUT',
    stype_in='parent',
    start='2022-06-10T14:30',
    end='2022-06-10T14:40',
)

data.replay(callback=print)  # market replay, with `print` as event handler

Replace YOUR_API_KEY with an actual API key, then run this program.

This uses .replay() to access the entire block of data and dispatch each data event to an event handler. You can also use .to_df() or .to_ndarray() to cast the data into a Pandas DataFrame or numpy ndarray:

df = data.to_df()  # to DataFrame
array = data.to_ndarray()  # to ndarray

Note that the API key was also passed as a parameter, which is not recommended for production applications. Instead, you can leave out this parameter to pass your API key via the DATABENTO_API_KEY environment variable:

import databento as db

# Pass as parameter
client = db.Historical('YOUR_API_KEY')

# Or, pass as `DATABENTO_API_KEY` environment variable
client = db.Historical()

License

Distributed under the Apache 2.0 License.

Release files for databento 0.86.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 databento 0.86.0
File Size Uploaded
databento-0.86.0.tar.gz 75.3 kB Details

Built distribution (wheel)

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

Total release size: 168.6 kB

Release files / databento-0.86.0.tar.gz

Download URL databento-0.86.0.tar.gz
Size 75.3 kB
Tags Source
SHA-256 checksum
How to use checksums
2dbc893e3c874bf7aa02b43c5439d0850bb1ef27c1479ddd00dea408e3a996c7
BLAKE2b-256 checksum
How to use checksums
70c28382199cf3b530780f186348fc0c1752a28710556047b65d3e3ae3816425
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.2 CPython/3.12.14 Linux/6.17.0-1022-azure

Release files / databento-0.86.0-py3-none-any.whl

Download URL databento-0.86.0-py3-none-any.whl
Size 93.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
05aa4f97dfec3e0a18ce6c5fa98283e171f5ee579364ce32d4a5eb6c446867f9
BLAKE2b-256 checksum
How to use checksums
8929d513eb6ba11eb34e5baa81d03fe78bd6c64175e33f6c87c784b63e817a19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.2 CPython/3.12.14 Linux/6.17.0-1022-azure

Release history Release notifications | RSS feed

0.87.0

2 release files

This release

0.86.0 This release

2 release files

0.85.0

2 release files

0.84.0

2 release files

0.82.0

2 release files

0.80.0

2 release files

0.78.0

2 release files

0.77.0

2 release files

0.76.0

2 release files

0.74.0

2 release files

0.73.0

2 release files

0.72.0

2 release files

0.71.0

2 release files

0.70.0

2 release files

0.69.0

2 release files

0.68.1

2 release files

0.66.0

2 release files

0.65.0

2 release files

0.62.0

2 release files

0.61.0

2 release files

0.60.0

2 release files

0.59.0

2 release files

0.57.1

2 release files

0.57.0

2 release files

0.55.0

2 release files

0.54.0

2 release files

0.53.0

2 release files

0.52.0

2 release files

0.50.0

2 release files

0.48.0

2 release files

0.47.0

2 release files

0.46.0

2 release files

0.45.0

2 release files

0.44.1

2 release files

0.44.0

2 release files

0.43.1

2 release files

0.42.0

2 release files

0.40.0

2 release files

0.39.3

2 release files

0.39.2

2 release files

0.39.1

2 release files

0.39.0

2 release files

0.38.0

2 release files

0.36.2

2 release files

0.36.1

2 release files

0.36.0

2 release files

0.34.1

2 release files

0.34.0

2 release files

0.33.0

2 release files

0.31.1

2 release files

0.30.0

2 release files

0.29.0

2 release files

0.27.0

2 release files

0.26.0

2 release files

0.25.0

2 release files

0.24.1

2 release files

0.24.0

2 release files

0.23.1

2 release files

0.23.0

2 release files

0.22.1

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.0

2 release files

0.18.1

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.0

2 release files

0.15.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.11.0

2 release files

0.9.0

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

1 release file

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