Just do a naive lookup for symbol normalization

notokeninwswrapper
Tyler Goodlet 2022-07-02 15:48:42 -04:00
parent f65f56ec75
commit f6888057c3
1 changed files with 7 additions and 5 deletions

View File

@ -450,12 +450,14 @@ def normalize_symbol(
Normalize symbol names to to a 3x3 pair.
'''
remap = {
'XXBTZEUR': 'XBTEUR',
'XXMRZEUR': 'XMREUR',
}
symlen = len(ticker)
if symlen != 6:
for sym in ['XXBT', 'XXMR', 'ZEUR']:
if sym in ticker:
ticker = ticker.replace(sym, sym[1:])
else:
raise ValueError(f'Unhandled symbol: {ticker}')
ticker = remap[ticker]
else:
raise ValueError(f'Unhandled symbol: {ticker}')
return ticker.lower()