Invert normalizer branching logic, raise on edge case
parent
735fbc6259
commit
5d39b04552
|
@ -446,13 +446,16 @@ async def get_client() -> Client:
|
||||||
def normalize_symbol(
|
def normalize_symbol(
|
||||||
ticker: str
|
ticker: str
|
||||||
) -> str:
|
) -> str:
|
||||||
# This is to convert symbol names from what kraken
|
'''
|
||||||
# uses to the traditional 3x3 pair symbol syntax
|
Normalize symbol names to to a 3x3 pair.
|
||||||
|
|
||||||
|
'''
|
||||||
symlen = len(ticker)
|
symlen = len(ticker)
|
||||||
if symlen == 6:
|
if symlen != 6:
|
||||||
return ticker.lower()
|
|
||||||
else:
|
|
||||||
for sym in ['XXBT', 'XXMR', 'ZEUR']:
|
for sym in ['XXBT', 'XXMR', 'ZEUR']:
|
||||||
if sym in ticker:
|
if sym in ticker:
|
||||||
ticker = ticker.replace(sym, sym[1:])
|
ticker = ticker.replace(sym, sym[1:])
|
||||||
|
else:
|
||||||
|
raise ValueError(f'Unhandled symbol: {ticker}')
|
||||||
|
|
||||||
return ticker.lower()
|
return ticker.lower()
|
||||||
|
|
Loading…
Reference in New Issue