Skip to content

Commit

Permalink
Inline Kline init, add removed comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillermo Rodriguez committed May 25, 2021
1 parent d9c9ca0 commit 7835c23
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions piker/brokers/binance.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)


Expand Down Expand Up @@ -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,))

Expand Down

0 comments on commit 7835c23

Please sign in to comment.