Use @njit throughout

kraken_trades_data
Tyler Goodlet 2021-01-11 08:40:13 -05:00
parent 4bd42b52c9
commit 513646c802
4 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,5 @@
# piker: trading gear for hackers # piker: trading gear for hackers
# Copyright (C) 2018-present Tyler Goodlet (in stewardship of piker0) # Copyright (C) Tyler Goodlet (in stewardship for piker0)
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by

View File

@ -20,7 +20,7 @@ Momentum bby.
from typing import AsyncIterator, Optional from typing import AsyncIterator, Optional
import numpy as np import numpy as np
from numba import jit, float64, optional, int64 from numba import njit, float64, optional, int64
from ..data._normalize import iterticks from ..data._normalize import iterticks
@ -29,13 +29,12 @@ from ..data._normalize import iterticks
# - how to handle non-plottable values # - how to handle non-plottable values
# - composition of fsps / implicit chaining # - composition of fsps / implicit chaining
@jit( @njit(
float64[:]( float64[:](
float64[:], float64[:],
optional(float64), optional(float64),
optional(float64) optional(float64)
), ),
nopython=True,
nogil=True nogil=True
) )
def ema( def ema(
@ -94,7 +93,7 @@ def ema(
return s return s
# @jit( # @njit(
# float64[:]( # float64[:](
# float64[:], # float64[:],
# int64, # int64,

View File

@ -1,5 +1,5 @@
# piker: trading gear for hackers # piker: trading gear for hackers
# Copyright (C) 2018-present Tyler Goodlet (in stewardship of piker0) # Copyright (C) Tyler Goodlet (in stewardship for piker0)
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by # it under the terms of the GNU Affero General Public License as published by

View File

@ -21,7 +21,7 @@ from typing import List, Optional, Tuple
import numpy as np import numpy as np
import pyqtgraph as pg import pyqtgraph as pg
from numba import jit, float64, int64 # , optional from numba import njit, float64, int64 # , optional
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import QLineF, QPointF from PyQt5.QtCore import QLineF, QPointF
# from numba import types as ntypes # from numba import types as ntypes
@ -70,7 +70,7 @@ def lines_from_ohlc(row: np.ndarray, w: float) -> Tuple[QLineF]:
return [hl, o, c] return [hl, o, c]
@jit( @njit(
# TODO: for now need to construct this manually for readonly arrays, see # TODO: for now need to construct this manually for readonly arrays, see
# https://github.com/numba/numba/issues/4511 # https://github.com/numba/numba/issues/4511
# ntypes.Tuple((float64[:], float64[:], float64[:]))( # ntypes.Tuple((float64[:], float64[:], float64[:]))(
@ -78,7 +78,6 @@ def lines_from_ohlc(row: np.ndarray, w: float) -> Tuple[QLineF]:
# int64, # int64,
# optional(float64), # optional(float64),
# ), # ),
nopython=True,
nogil=True nogil=True
) )
def path_arrays_from_ohlc( def path_arrays_from_ohlc(