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

Source: https://databento.com/docs/api-historical/timeseries/timeseries-get-range?lang=http


### /timeseries.get_range

Make a streaming request for time series data from Databento.

Primary method for getting historical intraday and daily market data,
instrument definitions, and market status data directly into your application.

For large requests, consider using [/batch.submit_job](https://databento.com/docs/api-historical/batch/batch-submit-job.http.md) instead.

#### API method

```http
POST https://hist.databento.com/v0/timeseries.get_range
```

#### Parameters

The following parameters should be encoded as form data (not in a JSON body).

| Parameter | Required | Description |
| `dataset` | required | The [dataset](https://databento.com/docs/api-historical/basics/datasets.http.md) code (string identifier). Must be one of the values from [list_datasets](https://databento.com/docs/api-historical/metadata/metadata-list-datasets.http.md). |
| `start` | required | The inclusive start of the request range. Filters on `ts_recv` if it exists in the schema, otherwise `ts_event`. Takes an [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` | optional | The exclusive end of the request range. Filters on `ts_recv` if it exists in the schema, otherwise `ts_event`. Takes an [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.http.md#forward-filling-end-parameters) value of `start` based on the resolution provided. |
| `symbols` | optional | The product symbols to filter for. Takes up to 2,000 symbols per request. If more than 1 symbol is specified, the data is merged and sorted by time. If `'ALL_SYMBOLS'` or not specified then will select **all** symbols. |
| `schema` | optional, default 'trades' | The data record [schema](https://databento.com/docs/schemas/whats-a-schema.http.md). Must be one of the values from [list_schemas](https://databento.com/docs/api-historical/metadata/metadata-list-schemas.http.md). |
| `encoding` | optional, default 'csv' | The data [encoding](https://databento.com/docs/api-historical/basics/encodings.http.md). Must be one of 'dbn', 'csv', 'json'. For fastest transfer speed, 'dbn' is recommended. |
| `compression` | optional, default 'none' | The data [compression](https://databento.com/docs/api-historical/basics/compression.http.md) mode. Must be either 'zstd' or 'none'. For fastest transfer speed, 'zstd' is recommended. |
| `stype_in` | optional, default 'raw_symbol' | The [symbology type](https://databento.com/docs/api-historical/basics/symbology.http.md) of input `symbols`. Must be one of 'raw_symbol', 'instrument_id', 'parent', or 'continuous'. |
| `stype_out` | optional, default 'instrument_id' | The [symbology type](https://databento.com/docs/api-historical/basics/symbology.http.md) of output symbols. Must be one of 'raw_symbol', 'instrument_id', 'parent', or 'continuous'. Must be a valid symbology combination with `stype_in`. See [symbology combinations](https://databento.com/docs/conventions/symbology.http.md#supported-symbology-combinations). |
| `limit` | optional | The maximum number of records to return. If not specified, then no limit. |
| `pretty_px` | optional, default 'false' | If prices should be formatted to the correct scale (using the fixed-precision scalar 1e-9). Only applicable for 'csv' or 'json' encodings. Must be a boolean-like value 'true' or 'false'. |
| `pretty_ts` | optional, default 'false' | If timestamps should be formatted as ISO 8601 strings. Only applicable for 'csv' or 'json' encodings. Must be a boolean-like value 'true' or 'false'. |
| `map_symbols` | optional, default 'false' | If a symbol field should be included with each text-encoded record. Only applicable for 'csv' or 'json' encodings. Must be a boolean-like value 'true' or 'false'. |

#### Returns

Either a DBN, CSV, or JSON file depending on the `encoding` parameter.

The JSON encoding follows the [JSON lines specification](https://jsonlines.org/) with one record per line.

A full list of fields for each schema is available through [/metadata.list_fields](https://databento.com/docs/api-historical/metadata/metadata-list-fields.http.md).

#### Example usage

```sh
curl -X POST 'https://hist.databento.com/v0/timeseries.get_range' \
 -u $YOUR_API_KEY: \
 -d dataset=GLBX.MDP3 \
 -d symbols=ESM2 \
 -d schema=trades \
 -d start='2022-06-06T00:00' \
 -d end='2022-06-10T00:10' \
 -d encoding=json \
 -d pretty_px=true \
 -d pretty_ts=true \
 -d map_symbols=true \
 -d limit=1
```
#### Example response

```json
{"ts_recv":"2022-06-06T00:00:00.070314216Z","hd":{"ts_event":"2022-06-06T00:00:00.070033767Z","rtype":0,"publisher_id":1,"instrument_id":3403},"action":"T","side":"A","depth":0,"price":"4108.500000000","size":1,"flags":0,"ts_in_delta":18681,"sequence":157862,"symbol":"ESM2"}
```
