From 0de2f863bd9d51ca38a5a39be88fa011a8380787 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sat, 10 Dec 2022 15:21:20 -0500 Subject: [PATCH 1/2] `kraken`: Explicitly report missing `Pair` fields in error --- piker/brokers/kraken/feed.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/piker/brokers/kraken/feed.py b/piker/brokers/kraken/feed.py index b9ef0789..7b3cf967 100644 --- a/piker/brokers/kraken/feed.py +++ b/piker/brokers/kraken/feed.py @@ -352,7 +352,13 @@ async def stream_quotes( # transform to upper since piker style is always lower sym = sym.upper() sym_info = await client.symbol_info(sym) - si = Pair(**sym_info) # validation + try: + si = Pair(**sym_info) # validation + except TypeError: + fields_diff = set(sym_info) - set(Pair.__struct_fields__) + raise TypeError( + f'Missing msg fields {fields_diff}' + ) syminfo = si.to_dict() syminfo['price_tick_size'] = 1 / 10**si.pair_decimals syminfo['lot_tick_size'] = 1 / 10**si.lot_decimals From fd296a557eb83e9bae540342963a7387911651ca Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 1 Dec 2022 10:30:27 -0500 Subject: [PATCH 2/2] Add position limit fields --- piker/brokers/kraken/feed.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/piker/brokers/kraken/feed.py b/piker/brokers/kraken/feed.py index 7b3cf967..7088011d 100644 --- a/piker/brokers/kraken/feed.py +++ b/piker/brokers/kraken/feed.py @@ -88,6 +88,9 @@ class Pair(Struct): tick_size: float # min price step size status: str + short_position_limit: float + long_position_limit: float + class OHLC(Struct): '''