Giter Club home page Giter Club logo

databento-python's Introduction

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 the latest distribution of Anaconda 3.8 and above. The minimum dependencies as found in the pyproject.toml are also listed below:

  • python = "^3.8"
  • aiohttp = "^3.8.3"
  • databento-dbn = "0.17.1"
  • numpy= ">=1.23.5"
  • pandas = ">=1.5.3"
  • pip-system-certs = ">=4.0" (Windows only)
  • pyarrow = ">=13.0.0"
  • requests = ">=2.24.0"
  • 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.

databento-python's People

Contributors

cjdsellers avatar nmacholl avatar renan-databento avatar rkrn avatar threecgreen avatar zcqian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

databento-python's Issues

decode_metadata not exported from python package

Expected Behaviour

Successfully import decode_metadata from the databento_dbn package

Actual Behaviour

I cannot import the decode_metadata method from the databento_dbn package and use it to decode the data I have just downloaded. I was able to download the package without any issues. Looking at the contents of the library and the python file for the decoder it looks like it is not exported from the library as suggested in the example.

Steps to Reproduce the Problem

  1. Open jupyter notebook
  2. !pip install databento_dbn
  3. from databento_dbn import decode_metadata

Specifications

  • OS Platform: Mac
  • Databento Version: Latest?
Screenshot 2023-11-13 at 21 15 02 Screenshot 2023-11-13 at 21 18 25

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.