Convert timeit thing to use print()
parent
8832804bab
commit
155c3eef2a
|
@ -102,11 +102,18 @@ class Client:
|
||||||
res.pop('last')
|
res.pop('last')
|
||||||
bars = next(iter(res.values()))
|
bars = next(iter(res.values()))
|
||||||
|
|
||||||
# convert all fields to native types
|
|
||||||
new_bars = []
|
new_bars = []
|
||||||
last_nz_vwap = None
|
|
||||||
|
first = bars[0]
|
||||||
|
last_nz_vwap = first[-3]
|
||||||
|
if last_nz_vwap == 0:
|
||||||
|
# use close if vwap is zero
|
||||||
|
last_nz_vwap = first[-4]
|
||||||
|
|
||||||
|
# convert all fields to native types
|
||||||
for i, bar in enumerate(bars):
|
for i, bar in enumerate(bars):
|
||||||
# normalize weird zero-ed vwap values..cmon kraken..
|
# normalize weird zero-ed vwap values..cmon kraken..
|
||||||
|
# indicates vwap didn't change since last bar
|
||||||
vwap = float(bar[-3])
|
vwap = float(bar[-3])
|
||||||
if vwap != 0:
|
if vwap != 0:
|
||||||
last_nz_vwap = vwap
|
last_nz_vwap = vwap
|
||||||
|
@ -211,6 +218,7 @@ def normalize(
|
||||||
@tractor.msg.pub
|
@tractor.msg.pub
|
||||||
async def stream_quotes(
|
async def stream_quotes(
|
||||||
get_topics: Callable,
|
get_topics: Callable,
|
||||||
|
shared_array_token: Tuple[str, str, str],
|
||||||
# These are the symbols not expected by the ws api
|
# These are the symbols not expected by the ws api
|
||||||
# they are looked up inside this routine.
|
# they are looked up inside this routine.
|
||||||
symbols: List[str] = ['XBTUSD', 'XMRUSD'],
|
symbols: List[str] = ['XBTUSD', 'XMRUSD'],
|
||||||
|
|
|
@ -50,8 +50,7 @@ def timeit(fn):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
t = time.time()
|
t = time.time()
|
||||||
res = fn(*args, **kwargs)
|
res = fn(*args, **kwargs)
|
||||||
logger = logging.getLogger('runtime')
|
print(
|
||||||
logger.debug(
|
|
||||||
'%s.%s: %.4f sec'
|
'%s.%s: %.4f sec'
|
||||||
% (fn.__module__, fn.__qualname__, time.time() - t)
|
% (fn.__module__, fn.__qualname__, time.time() - t)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue