> ## Documentation Index
> Fetch the complete documentation index at: https://systematica.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Db

> systematica.data.db

## `get_bfc_data`

```python theme={null}
get_bfc_data(
    symbols: str | List[str] = None,
    timeframe: str = '60m',
    table: str = 'candle',
    index_col: str = 'close_datetime',
    engine_name: str = 'research',
    engine: str = None,
    start: str = None,
    end: str = None,
    n_records: int = None,
    freq: str = None,
    **kwargs,
) ‑> vectorbtpro.data.base.Data
```

Fetch SQL data and return it as a vectorbt Data object.

**Parameters**:

| Name          | Type            | Default          | Description                                                                   |
| ------------- | --------------- | ---------------- | ----------------------------------------------------------------------------- |
| `symbols`     | `str, optional` | `--`             | Single symbol or list of symbols to query                                     |
| `timeframe`   | `str`           | `60m`            | Timeframe in minutes. Available timeframe are `1m` and `30m`. Defaults "30m". |
| `table`       | `str`           | `candle`         | SQL table name (default: `candle`)                                            |
| `index_col`   | `str`           | `close_datetime` | Column to use as index (default: `close_datetime`)                            |
| `engine_name` | `str`           | `research`       | Name of the SQL engine (default: `research`)                                  |
| `engine`      | `str`           | `None`           | SQL engine connection string (default: `None`)                                |
| `start`       | `str`           | `None`           | Start date for data (default: `None`)                                         |
| `end`         | `str`           | `None`           | End date for data (default: `None`)                                           |
| `n_records`   | `int`           | `None`           | Maximum number of records to return (default: `None`)                         |
| `freq`        | `str`           | `None`           | Resampling frequency. Default is `None`, which means no resampling.           |
| `kwargs`      | `tp.Kwargs`     | `--`             | Additional arguments passed to `vbt.SQLData.pull`.                            |

**Raises**:

| Type           | Description                               |
| -------------- | ----------------------------------------- |
| `ValueError`   | If timeframe not in \["1m", "30m", "60m"] |
| `RuntimeError` | If SQL data fetch fails                   |

**Returns**:

| Type       | Description                                      |
| ---------- | ------------------------------------------------ |
| `vbt.Data` | Vectorbt Data object containing the queried data |

## `ModelBFCSchema`

```python theme={null}
ModelBFCSchema(
    **data: Any,
)
```

Database schema.

Create a new model by parsing and validating input data from keyword arguments.

Raises \[`ValidationError`]\[pydantic\_core.ValidationError] if the input data cannot be
validated to form a valid model.

`self` is explicitly positional-only to allow `self` as a field name.

### Ancestors

* `pydantic.main.BaseModel`

### Class variables

* `strategy: str`: Strategy name.

* `type: str`: Type of the strategy.

* `perc_equity: float`: Percentage of equity to use for the strategy.

* `slippage: float`: Slippage in percentage.

* `model_config`: The type of the None singleton.

## `BFCData`

```python theme={null}
BFCData(
    wrapper: vectorbtpro.base.wrapping.ArrayWrapper,
    data: vectorbtpro.data.base.feature_dict | vectorbtpro.data.base.symbol_dict,
    single_key: bool = True,
    classes: vectorbtpro.data.base.feature_dict | vectorbtpro.data.base.symbol_dict | None = None,
    level_name: bool | Hashable | Iterable[Hashable] | None = None,
    fetch_kwargs: vectorbtpro.data.base.feature_dict | vectorbtpro.data.base.symbol_dict | None = None,
    returned_kwargs: vectorbtpro.data.base.feature_dict | vectorbtpro.data.base.symbol_dict | None = None,
    last_index: vectorbtpro.data.base.feature_dict | vectorbtpro.data.base.symbol_dict | None = None,
    delisted: vectorbtpro.data.base.feature_dict | vectorbtpro.data.base.symbol_dict | None = None,
    tz_localize: bool | str | int | float | datetime.timedelta | datetime.tzinfo | None = None,
    tz_convert: bool | str | int | float | datetime.timedelta | datetime.tzinfo | None = None,
    missing_index: str | None = None,
    missing_columns: str | None = None,
    **kwargs,
)
```

BFC SQL Data class.

### Ancestors

* `vectorbtpro.data.custom.sql.SQLData`
* `vectorbtpro.data.custom.db.DBData`
* `vectorbtpro.data.custom.local.LocalData`
* `vectorbtpro.data.custom.custom.CustomData`
* `vectorbtpro.data.base.Data`
* `vectorbtpro.generic.analyzable.Analyzable`
* `vectorbtpro.base.wrapping.Wrapping`
* `vectorbtpro.utils.config.Configured`
* `vectorbtpro.utils.config.HasSettings`
* `vectorbtpro.utils.caching.Cacheable`
* `vectorbtpro.utils.checks.Comparable`
* `vectorbtpro.utils.pickling.Pickleable`
* `vectorbtpro.utils.formatting.Prettified`
* `vectorbtpro.utils.chaining.Chainable`
* `vectorbtpro.base.wrapping.HasWrapper`
* `vectorbtpro.base.indexing.ExtPandasIndexer`
* `vectorbtpro.base.indexing.PandasIndexer`
* `vectorbtpro.base.indexing.IndexingBase`
* `vectorbtpro.utils.params.ItemParamable`
* `vectorbtpro.utils.params.Itemable`
* `vectorbtpro.utils.params.Paramable`
* `vectorbtpro.base.indexes.IndexApplier`
* `vectorbtpro.utils.attr_.AttrResolverMixin`
* `vectorbtpro.generic.stats_builder.StatsBuilderMixin`
* `vectorbtpro.generic.plots_builder.PlotsBuilderMixin`
* `vectorbtpro.data.base.OHLCDataMixin`
* `vectorbtpro.data.base.BaseDataMixin`
* `vectorbtpro.utils.base.Base`

### Static methods

#### `fetch_symbol`

```python theme={null}
fetch_symbol(
    symbol,
    **kwargs,
)
```

Fetch BFC SQL symbol.

**Parameters**:

| Name      | Type        | Default | Description                                        |
| --------- | ----------- | ------- | -------------------------------------------------- |
| `symbols` | `str`       | `--`    | Single symbol to fetch.                            |
| `kwargs`  | `tp.Kwargs` | `--`    | Additional arguments passed to `vbt.SQLData.pull`. |

**Returns**:

| Type          | Description                                      |
| ------------- | ------------------------------------------------ |
| `vbt.SQLData` | Vectorbt Data object containing the queried data |

#### `pull`

```python theme={null}
pull(
    symbols: str | List[str],
    **kwargs,
)
```

Pull BFC SQL data.

**Parameters**:

| Name      | Type        | Default | Description                                        |
| --------- | ----------- | ------- | -------------------------------------------------- |
| `symbols` | `str`       | `--`    | Symbol or list of symbols to query.                |
| `kwargs`  | `tp.Kwargs` | `--`    | Additional arguments passed to `vbt.SQLData.pull`. |

**Returns**:

| Type          | Description                                      |
| ------------- | ------------------------------------------------ |
| `vbt.SQLData` | Vectorbt Data object containing the queried data |
