From f6888057c30916c96ca58524866564e52e646f49 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 2 Jul 2022 15:48:42 -0400 Subject: [PATCH] Just do a naive lookup for symbol normalization --- piker/brokers/kraken/api.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/piker/brokers/kraken/api.py b/piker/brokers/kraken/api.py index 1c4c8045..68bdde6e 100644 --- a/piker/brokers/kraken/api.py +++ b/piker/brokers/kraken/api.py @@ -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()