# otp.SymbologyMapping

### *class* SymbologyMapping(dest_symbology=None, tick_type=utils.adaptive, start=utils.adaptive, end=utils.adaptive, symbols=utils.adaptive, schema=None, \*\*kwargs)

Bases: [`Source`](../source/root.md#onetick.py.Source)

Shows symbology mapping information for specified securities stored in the reference database.

Input (source) symbology is taken from the input symbol,
if it has a symbology part in it (e.g., RIC::REUTERS::MSFT),
or defaults to that of the input database, which is specified in the locator file.

Parameter `symbol_date` must be set in [`otp.run`](../run.md#onetick.py.run)
for this source to work.

* **Parameters:**
  * **dest_symbology** (str, [`otp.param`](../misc/param.md#onetick.py.core.column_operations.base.OnetickParameter)) -- Specifying the destination symbology for symbol translation.
  * **tick_type** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) -- 

    Tick type to set on the OneTick's graph node.
    Can be used to specify database name with tick type or tick type only.

    By default setting this parameter is not required, database is usually set
    with parameter `symbols` or in [`otp.run`](../run.md#onetick.py.run).
  * **start** -- Custom start time of the source.
    If set, will override the value specified in [`otp.run`](../run.md#onetick.py.run).
  * **end** -- Custom end time of the source.
    If set, will override the value specified in [`otp.run`](../run.md#onetick.py.run).
  * **symbols** -- Symbol(s) from which data should be taken.
    If set, will override the value specified in [`otp.run`](../run.md#onetick.py.run).

### Examples

Getting mapping for OID symbology for one symbol:

```pycon
>>> data = otp.SymbologyMapping(dest_symbology='OID')
>>> otp.run(data, symbols='US_COMP::AAPL',  
...         symbol_date=otp.dt(2022, 1, 3),
...         date=otp.dt(2022, 1, 3))
        Time END_DATETIME MAPPED_SYMBOL_NAME
0 2022-01-03   2022-01-04               9706
```

Getting mapping for all symbols in US_COMP database in single source:

```pycon
>>> data = otp.SymbologyMapping(dest_symbology='OID')
>>> data = otp.merge([data],
...                  symbols=otp.Symbols('US_COMP', keep_db=True),
...                  identify_input_ts=True)
>>> data = data[['SYMBOL_NAME', 'MAPPED_SYMBOL_NAME']]
>>> otp.run(data,  
...         symbol_date=otp.dt(2022, 1, 3),
...         date=otp.dt(2022, 1, 3))
            Time    SYMBOL_NAME MAPPED_SYMBOL_NAME
0     2022-01-03     US_COMP::A               3751
1     2022-01-03    US_COMP::AA             647321
2     2022-01-03   US_COMP::AAA             695581
3     2022-01-03  US_COMP::AAAU             673522
4     2022-01-03   US_COMP::AAC             703090
...          ...            ...                ...
11746 2022-01-03   US_COMP::ZWS             273584
11747 2022-01-03    US_COMP::ZY             704054
11748 2022-01-03  US_COMP::ZYME             655470
11749 2022-01-03  US_COMP::ZYNE             633589
11750 2022-01-03  US_COMP::ZYXI             208375
```
