Available languages: [Python](https://databento.com/docs/api-historical/metadata/metadata-get-cost.python.md) · [C++](https://databento.com/docs/api-historical/metadata/metadata-get-cost.cpp.md) · [Rust](https://databento.com/docs/api-historical/metadata/metadata-get-cost.rust.md) · [HTTP](https://databento.com/docs/api-historical/metadata/metadata-get-cost.http.md)

Source: https://databento.com/docs/api-historical/metadata/metadata-get-cost



### Historical.metadata.get_cost

Get the cost in US dollars for a historical streaming or batch download request.
This cost respects any discounts provided by flat rate plans.

The cost may be overstated unless the start and end are aligned to 10-minute boundaries (e.g., 12:10, not 12:15).
For the definition and status schemas, the cost may be overstated unless aligned to UTC midnight.

> **Info**
>
> The amount billed will be based on the actual amount of bytes sent; see our [pricing documentation](https://databento.com/docs/faqs/usage-pricing-and-data-credits.md) for more details.

#### API method

```python
Historical.metadata.get_cost(
    dataset: Dataset | str,
    start: pd.Timestamp | datetime | date | str | int,
    end: pd.Timestamp | datetime | date | str | int | None = None,
    symbols: Iterable[str | int] | str | int | None = None,
    schema: Schema | str = "trades",
    stype_in: SType | str = "raw_symbol",
    limit: int | None = None,
) -> float
```

#### Parameters

| Parameter | Type | Required | Description |
| `dataset` | Dataset or str | required | The [dataset](https://databento.com/docs/api-historical/basics/datasets.md) code (string identifier). Must be one of the values from [list_datasets](https://databento.com/docs/api-historical/metadata/metadata-list-datasets.md). |
| `start` | pd.Timestamp, datetime, date, str, or int | required | The inclusive start of the request range. Takes [pd.Timestamp](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Timestamp.html), [Python datetime](https://docs.python.org/3/library/datetime.html#datetime-objects), [Python date](https://docs.python.org/3/library/datetime.html#date-objects), [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) string, or [UNIX timestamp](https://en.wikipedia.org/wiki/Unix_time) in nanoseconds. Assumes UTC as timezone unless otherwise specified. |
| `end` | pd.Timestamp, datetime, date, str, or int | optional | The exclusive end of the request range. Takes [pd.Timestamp](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Timestamp.html), [Python datetime](https://docs.python.org/3/library/datetime.html#datetime-objects), [Python date](https://docs.python.org/3/library/datetime.html#date-objects), [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) string, or [UNIX timestamp](https://en.wikipedia.org/wiki/Unix_time) in nanoseconds. Assumes UTC as timezone unless otherwise specified. Defaults to the [forward filled](https://databento.com/docs/conventions/common-fields-enums-types.md#forward-filling-end-parameters) value of `start` based on the resolution provided. |
| `symbols` | Iterable[str \ | int] or str or int | optional | The product symbols to filter for. Takes up to 2,000 symbols per request. If `'ALL_SYMBOLS'` or `None` then will select **all** symbols. |
| `schema` | Schema or str, default 'trades' | optional | The data record [schema](https://databento.com/docs/schemas/whats-a-schema.md). Must be one of the values from [list_schemas](https://databento.com/docs/api-historical/metadata/metadata-list-schemas.md). |
| `stype_in` | SType or str, default 'raw_symbol' | optional | The [symbology type](https://databento.com/docs/api-historical/basics/symbology.md) of input `symbols`. Must be one of 'raw_symbol', 'instrument_id', 'parent', or 'continuous'. |
| `limit` | int | optional | The maximum number of records to return. If `None` then no limit. |

#### Returns

`float`

The cost in US dollars.

#### Example usage

```python
import databento as db

client = db.Historical("$YOUR_API_KEY")

cost = client.metadata.get_cost(
    dataset="GLBX.MDP3",
    symbols=["ESM2"],
    schema="trades",
    start="2022-06-06T00:00:00",
    end="2022-06-10T12:10:00",
)
print(cost)
```
#### Example response

```plaintext
2.587353944778
```
