Source: https://databento.com/docs/api-historical/symbology


## Symbology



### Historical.symbology.resolve

Resolve a list of symbols from an input [symbology type](https://databento.com/docs/api-historical/basics/symbology.md),
to an output symbology type.

Take, for example, a raw symbol to an instrument ID: `ESM2` → `3403`.

#### API method

```python
Historical.symbology.resolve(
    dataset: Dataset | str,
    symbols: Iterable[str | int] | str | int,
    stype_in: SType | str,
    stype_out: SType | str,
    start_date: date | str,
    end_date: date | str | None = None,
) -> dict[str, Any]
```

#### 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). |
| `symbols` | Iterable[str \ | int] or str or int | required | The symbols to resolve. Takes up to 2,000 symbols per request. Use `'ALL_SYMBOLS'` to request **all** symbols (not available for every dataset). |
| `stype_in` | SType or str | required | 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'. |
| `stype_out` | SType or str | required | The [symbology type](https://databento.com/docs/api-historical/basics/symbology.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.md#supported-symbology-combinations). |
| `start_date` | date or str | required | The inclusive UTC start date of the request range as a [Python date](https://docs.python.org/3/library/datetime.html#date-objects) or [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) date string. |
| `end_date` | date or str | optional | The exclusive UTC end date of the request range as a [Python date](https://docs.python.org/3/library/datetime.html#date-objects) or [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) date string. 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. |

#### Returns

`dict[str, Any]`

The results for the symbology resolution.

> **See also**
>
> For more information on symbology resolution, visit our [symbology documentation](https://databento.com/docs/conventions/symbology.md#symbology-resolve-endpoint).

| Field | Type | Description |
| `result` | dict[str, list[dict[str, str]]] | The symbology mapping result. For each requested symbol, a list of symbology mappings is provided. |
| `symbols` | list[str] | The requested symbols. |
| `stype_in` | str | The requested input symbology type. |
| `stype_out` | str | The requested output symbology type. |
| `start_date` | str | The requested symbology start date as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) date string. |
| `end_date` | str | The requested symbology end date as an [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) date string. |
| `partial` | list[str] | The list of symbols, if any, that partially resolved inside the start date and end date interval. |
| `not_found` | list[str] | The list of symbols, if any, that failed to resolve inside the start date and end date interval. |
| `message` | str | A short message indicating the overall symbology result. Can be one of: "OK", or "Partially resolved", or "Not found" |
| `status` | int | A numerical status field indicating the overall symbology result. Can be one of: 0 (OK), 1 (Partially resolved), or 2 (Not found). |

#### Example usage

```python
import databento as db

client = db.Historical("$YOUR_API_KEY")

result = client.symbology.resolve(
    dataset="GLBX.MDP3",
    symbols=["ESM2"],
    stype_in="raw_symbol",
    stype_out="instrument_id",
    start_date="2022-06-01",
    end_date="2022-06-30",
)
print(result)
```
#### Example response

```json
{
    "result": {
        "ESM2": [
            {
                "d0": "2022-06-01",
                "d1": "2022-06-26",
                "s": "3403"
            }
        ]
    },
    "symbols": [
        "ESM2"
    ],
    "stype_in": "raw_symbol",
    "stype_out": "instrument_id",
    "start_date": "2022-06-01",
    "end_date": "2022-06-30",
    "partial": [],
    "not_found": [],
    "message": "OK",
    "status": 0
}
```
