From 7835c238d3fe94d92f5a866029df9bb4c0c4a999 Mon Sep 17 00:00:00 2001 From: Guillermo Rodriguez Date: Tue, 25 May 2021 09:42:40 -0300 Subject: [PATCH] Inline Kline init, add removed comment --- piker/brokers/binance.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/piker/brokers/binance.py b/piker/brokers/binance.py index ca158f0cd8..d9bbbd5856 100644 --- a/piker/brokers/binance.py +++ b/piker/brokers/binance.py @@ -56,6 +56,8 @@ _url = 'https://api.binance.com' +# XXX: some additional fields are defined in the docs: +# https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data ohlc_dtype = np.dtype(ohlc_with_index) @@ -226,13 +228,11 @@ async def bars( new_bars = [] for i, bar in enumerate(bars): - - init_dict = {} - for j, key in enumerate( - KLine.__dict__['__fields__'].keys()): - init_dict[key] = bar[j] - - bar = KLine(**init_dict) + bar = KLine(**{ + key: bar[j] + for j, key in enumerate( + KLine.__dict__['__fields__'].keys()) + }) bar_wap = .0 new_bars.append((i,) + tuple(bar.as_row()) + (bar_wap,))