Include vwap in kraken historical bars

unleash_the_kraken
Tyler Goodlet 2020-09-09 21:20:07 -04:00
parent 0b42ac1420
commit b13da849d0
1 changed files with 8 additions and 4 deletions

View File

@ -27,7 +27,7 @@ _url = 'https://api.kraken.com/0'
# conversion to numpy worthy types
ohlc_dtype = [
_ohlc_dtype = [
('index', int),
('time', int),
('open', float),
@ -39,6 +39,10 @@ ohlc_dtype = [
('count', int)
]
# UI components allow this to be declared such that additional
# (historical) fields can be exposed.
ohlc_dtype = np.dtype(_ohlc_dtype)
class Client:
@ -103,11 +107,11 @@ class Client:
lambda i, bar:
(i,) + tuple(
ftype(bar[i]) for i, (name, ftype)
in enumerate(ohlc_dtype[1:])
in enumerate(_ohlc_dtype[1:])
),
enumerate(bars))
)
return np.array(bars, dtype=ohlc_dtype) if as_np else bars
return np.array(bars, dtype=_ohlc_dtype) if as_np else bars
except KeyError:
raise SymbolNotFound(json['error'][0] + f': {symbol}')
@ -193,7 +197,7 @@ def normalize(
# in subscription systems...
topic = quote['pair'].replace('/', '')
print(quote)
# print(quote)
return topic, quote