Historical

To access Databento's historical API, first create an instance of the Historical client. The entire API is exposed through instance methods of the client.

Note that the API key can be 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:

Currently, only BO1 is supported for historical data.

Parameters

Parameter
Type
Required
Description
key
str
optional
32-character API key. Found on your API keys page. If None then DATABENTO_API_KEY environment variable is used.
gateway
HistoricalGateway or str
optional
Site of historical gateway to connect to. Currently only BO1 is supported. If None then will connect to the default historical gateway.
API method
1
2
3
4
class Historical(
    key: str | None = None,
    gateway: HistoricalGateway | str = HistoricalGateway.BO1,
)
Example usage
1
2
3
4
5
6
7
import databento as db

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

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