Skip to content

bento module

Module with BentoData.


BentoData class

BentoData(
    wrapper,
    data,
    single_key=True,
    classes=None,
    level_name=None,
    fetch_kwargs=None,
    returned_kwargs=None,
    last_index=None,
    delisted=None,
    tz_localize=None,
    tz_convert=None,
    missing_index=None,
    missing_columns=None,
    **kwargs
)

Data class for fetching from Databento.

See https://github.com/databento/databento-python for API.

See BentoData.fetch_symbol() for arguments.

Usage

  • Set up the API key globally (optional):
>>> from vectorbtpro import *

>>> vbt.BentoData.set_custom_settings(
...     client_config=dict(
...         key="YOUR_KEY"
...     )
... )
  • Pull data:
>>> data = vbt.BentoData.pull(
...     "AAPL",
...     dataset="XNAS.ITCH"
... )
>>> data = vbt.BentoData.pull(
...     "AAPL",
...     dataset="XNAS.ITCH",
...     timeframe="hourly",
...     start="one week ago"
... )
>>> data = vbt.BentoData.pull(
...     "ES.FUT",
...     dataset="GLBX.MDP3",
...     stype_in="parent",
...     schema="mbo",
...     start="2022-06-10T14:30",
...     end="2022-06-11",
...     limit=1000
... )

Superclasses

Inherited members


fetch_symbol class method

BentoData.fetch_symbol(
    symbol,
    client=None,
    client_config=None,
    start=None,
    end=None,
    resolve_dates=None,
    timeframe=None,
    tz=None,
    dataset=None,
    schema=None,
    return_params=False,
    df_kwargs=None,
    **params
)

Override Data.fetch_symbol() to fetch a symbol from Databento.

Args

symbol : str

Symbol.

Symbol can be in the DATASET:SYMBOL format if dataset is None.

client : binance.client.Client

Client.

See BentoData.resolve_client().

client_config : dict

Client config.

See BentoData.resolve_client().

start : any

Start datetime.

See to_tzaware_datetime().

end : any

End datetime.

See to_tzaware_datetime().

resolve_dates : bool
Whether to resolve start and end, or pass them as they are.
timeframe : str

Timeframe to create schema from.

Allows human-readable strings such as "1 minute".

If timeframe and schema are both not None, will raise an error.

tz : any

Timezone.

See to_timezone().

dataset : str
See databento.historical.client.Historical.get_range.
schema : str
See databento.historical.client.Historical.get_range.
return_params : bool

Whether to return the client and (final) parameters instead of data.

Used by BentoData.get_cost().

df_kwargs : dict
Keyword arguments passed to databento.common.dbnstore.DBNStore.to_df.
**params
Keyword arguments passed to databento.historical.client.Historical.get_range.

For defaults, see custom.bento in data.


get_cost class method

BentoData.get_cost(
    symbols,
    **kwargs
)

Get the cost of calling BentoData.fetch_symbol() on one or more symbols.


resolve_client class method

BentoData.resolve_client(
    client=None,
    **client_config
)

Resolve the client.

If provided, must be of the type databento.historical.client.Historical. Otherwise, will be created using client_config.