16 lines
446 B
Python
16 lines
446 B
Python
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
import re
|
||
|
|
|
||
|
|
_SUFFIX_RE = re.compile(r"(?:_US)?(?:[a-z])?_EQ$")
|
||
|
|
|
||
|
|
|
||
|
|
def _normalise_ticker(raw: str) -> str:
|
||
|
|
"""Strip T212's exchange-suffix decoration from a ticker.
|
||
|
|
|
||
|
|
T212 tags every ticker with `_EQ`, optionally preceded by a lowercase
|
||
|
|
letter ("l" for LSE) or `_US` for a US listing. Peel those off so the
|
||
|
|
symbol matches what Schwab / InvestEngine emit.
|
||
|
|
"""
|
||
|
|
return _SUFFIX_RE.sub("", raw)
|