From bbbe8506dada495fc4839ee9210ef44b5d99bcde Mon Sep 17 00:00:00 2001 From: Andy Date: Sat, 16 Mar 2024 07:38:24 +0100 Subject: [PATCH 1/6] also test python 3.11 --- .github/workflows/python-package.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 94b83f339..11c9c24b8 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -8,8 +8,8 @@ on: branches: [ master ] pull_request: branches: [ master ] - -concurrency: + +concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true @@ -21,15 +21,15 @@ jobs: matrix: # os: [ubuntu-latest, macos-latest, windows-latest] os: [ubuntu-latest] - include: + include: - os: ubuntu-latest path: ~/.cache/pip #- os: macos-latest # path: ~/Library/Caches/pip #- os: windows-latest # path: ~\AppData\Local\pip\Cache - python-version: [3.8, 3.9, '3.10'] - + python-version: [3.8, 3.9, '3.10', '3.11'] + steps: - name: Checkout From 92618dcc32522190fc628a8992ade20d4dbd33ef Mon Sep 17 00:00:00 2001 From: Andy Date: Sat, 16 Mar 2024 16:38:29 +0100 Subject: [PATCH 2/6] added numba to requirements, removed the try catch from the indicators and sorted the imports from all indicators using isort Also activated the arm osx github action .. lets see if it just runs --- .github/workflows/python-package.yml | 10 +++++----- jesse/indicators/alma.py | 1 + jesse/indicators/apo.py | 2 +- jesse/indicators/bandpass.py | 9 +++------ jesse/indicators/bollinger_bands.py | 4 ++-- jesse/indicators/bollinger_bands_width.py | 4 ++-- jesse/indicators/cfo.py | 3 +-- jesse/indicators/cg.py | 5 +---- jesse/indicators/cksp.py | 1 - jesse/indicators/cmo.py | 3 +-- jesse/indicators/correlation_cycle.py | 5 +---- jesse/indicators/cvi.py | 2 +- jesse/indicators/cwma.py | 8 ++------ jesse/indicators/damiani_volatmeter.py | 8 ++------ jesse/indicators/dec_osc.py | 1 + jesse/indicators/decycler.py | 1 + jesse/indicators/devstop.py | 4 ++-- jesse/indicators/edcf.py | 6 +----- jesse/indicators/efi.py | 5 +---- jesse/indicators/emd.py | 5 +---- jesse/indicators/emv.py | 2 +- jesse/indicators/epma.py | 8 ++------ jesse/indicators/er.py | 2 +- jesse/indicators/eri.py | 2 +- jesse/indicators/fisher.py | 2 +- jesse/indicators/frama.py | 5 +---- jesse/indicators/fwma.py | 2 +- jesse/indicators/gatorosc.py | 3 +-- jesse/indicators/gauss.py | 5 +---- jesse/indicators/heikin_ashi_candles.py | 14 ++++++-------- jesse/indicators/high_pass.py | 5 +---- jesse/indicators/high_pass_2_pole.py | 5 +---- jesse/indicators/ht_dcperiod.py | 3 +-- jesse/indicators/ht_dcphase.py | 3 +-- jesse/indicators/ht_phasor.py | 3 +-- jesse/indicators/ht_sine.py | 3 +-- jesse/indicators/ht_trendline.py | 3 +-- jesse/indicators/ht_trendmode.py | 3 +-- jesse/indicators/hurst_exponent.py | 9 +++------ jesse/indicators/hwma.py | 7 ++----- jesse/indicators/ichimoku_cloud_seq.py | 3 +-- jesse/indicators/ift_rsi.py | 4 ++-- jesse/indicators/itrend.py | 5 +---- jesse/indicators/jma.py | 5 +---- jesse/indicators/jsa.py | 2 +- jesse/indicators/kama.py | 3 +-- jesse/indicators/kaufmanstop.py | 2 +- jesse/indicators/kdj.py | 2 +- jesse/indicators/keltner.py | 4 +--- jesse/indicators/kst.py | 3 +-- jesse/indicators/kurtosis.py | 4 ++-- jesse/indicators/kvo.py | 2 +- jesse/indicators/linearreg.py | 3 +-- jesse/indicators/linearreg_angle.py | 3 +-- jesse/indicators/linearreg_intercept.py | 3 +-- jesse/indicators/linearreg_slope.py | 3 +-- jesse/indicators/lrsi.py | 5 +---- jesse/indicators/maaq.py | 12 +++++------- jesse/indicators/mab.py | 3 +-- jesse/indicators/macd.py | 3 +-- jesse/indicators/macdext.py | 2 +- jesse/indicators/mama.py | 3 +-- jesse/indicators/marketfi.py | 3 +-- jesse/indicators/mass.py | 2 +- jesse/indicators/mcginley_dynamic.py | 5 +---- jesse/indicators/mean_ad.py | 3 ++- jesse/indicators/median_ad.py | 4 ++-- jesse/indicators/midpoint.py | 3 +-- jesse/indicators/mom.py | 3 +-- jesse/indicators/mwdx.py | 6 +----- jesse/indicators/nma.py | 7 ++----- jesse/indicators/nvi.py | 3 +-- jesse/indicators/pfe.py | 2 +- jesse/indicators/pma.py | 8 ++------ jesse/indicators/ppo.py | 5 ++--- jesse/indicators/pvi.py | 3 +-- jesse/indicators/pwma.py | 4 ++-- jesse/indicators/qstick.py | 2 +- jesse/indicators/reflex.py | 6 ++---- jesse/indicators/rma.py | 7 ++----- jesse/indicators/roc.py | 3 +-- jesse/indicators/rocp.py | 3 +-- jesse/indicators/rocr.py | 3 +-- jesse/indicators/rocr100.py | 3 +-- jesse/indicators/roofing.py | 1 + jesse/indicators/rsi.py | 3 +-- jesse/indicators/rsmk.py | 2 +- jesse/indicators/rsx.py | 7 ++----- jesse/indicators/rvi.py | 6 +++--- jesse/indicators/safezonestop.py | 3 +-- jesse/indicators/sinwma.py | 2 +- jesse/indicators/skew.py | 4 ++-- jesse/indicators/sma.py | 3 +-- jesse/indicators/sqwma.py | 8 ++------ jesse/indicators/srwma.py | 8 ++------ jesse/indicators/stc.py | 4 ++-- jesse/indicators/stddev.py | 3 +-- jesse/indicators/stochastic.py | 2 +- jesse/indicators/supersmoother.py | 5 +---- jesse/indicators/supersmoother_3_pole.py | 1 + jesse/indicators/supertrend.py | 7 ++----- jesse/indicators/swma.py | 5 +++-- jesse/indicators/t3.py | 3 +-- jesse/indicators/tema.py | 3 +-- jesse/indicators/trendflex.py | 6 ++---- jesse/indicators/trima.py | 3 +-- jesse/indicators/trix.py | 3 +-- jesse/indicators/tsf.py | 3 +-- jesse/indicators/tsi.py | 3 +-- jesse/indicators/ttm_trend.py | 2 +- jesse/indicators/ui.py | 3 +-- jesse/indicators/var.py | 3 +-- jesse/indicators/vi.py | 5 +---- jesse/indicators/vidya.py | 3 +-- jesse/indicators/vlma.py | 12 ++++-------- jesse/indicators/vosc.py | 2 +- jesse/indicators/voss.py | 5 +---- jesse/indicators/vpwma.py | 8 ++------ jesse/indicators/vwap.py | 7 ++----- jesse/indicators/vwma.py | 3 +-- jesse/indicators/wad.py | 2 +- jesse/indicators/wilders.py | 3 +-- jesse/indicators/wma.py | 3 +-- jesse/indicators/zlema.py | 3 +-- jesse/indicators/zscore.py | 5 ++--- requirements.txt | 1 + 126 files changed, 176 insertions(+), 335 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 11c9c24b8..6c9dd399f 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -24,11 +24,11 @@ jobs: include: - os: ubuntu-latest path: ~/.cache/pip - #- os: macos-latest - # path: ~/Library/Caches/pip - #- os: windows-latest - # path: ~\AppData\Local\pip\Cache - python-version: [3.8, 3.9, '3.10', '3.11'] + - os: macos-latest-xlarge + path: ~/Library/Caches/pip + - os: windows-latest + path: ~\AppData\Local\pip\Cache + python-version: [3.8, 3.9, '3.10', 3.11] steps: diff --git a/jesse/indicators/alma.py b/jesse/indicators/alma.py index 1b6381e7e..6623e2708 100644 --- a/jesse/indicators/alma.py +++ b/jesse/indicators/alma.py @@ -4,6 +4,7 @@ from jesse.helpers import get_candle_source, slice_candles + def alma(candles: np.ndarray, period: int = 9, sigma: float = 6.0, distribution_offset: float = 0.85, source_type: str = "close", sequential: bool = False) -> Union[ float, np.ndarray]: diff --git a/jesse/indicators/apo.py b/jesse/indicators/apo.py index 048b21d59..1b4389d4a 100644 --- a/jesse/indicators/apo.py +++ b/jesse/indicators/apo.py @@ -1,9 +1,9 @@ from typing import Union import numpy as np -from jesse.indicators.ma import ma from jesse.helpers import get_candle_source, slice_candles +from jesse.indicators.ma import ma def apo(candles: np.ndarray, fast_period: int = 12, slow_period: int = 26, matype: int = 0, source_type: str = "close", diff --git a/jesse/indicators/bandpass.py b/jesse/indicators/bandpass.py index 4f8b3e055..62e20260e 100644 --- a/jesse/indicators/bandpass.py +++ b/jesse/indicators/bandpass.py @@ -1,15 +1,12 @@ from collections import namedtuple import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a - -from .high_pass import high_pass_fast +from numba import njit from jesse.helpers import get_candle_source, slice_candles +from .high_pass import high_pass_fast + BandPass = namedtuple('BandPass', ['bp', 'bp_normalized', 'signal', 'trigger']) diff --git a/jesse/indicators/bollinger_bands.py b/jesse/indicators/bollinger_bands.py index fb419c84c..a95365e47 100644 --- a/jesse/indicators/bollinger_bands.py +++ b/jesse/indicators/bollinger_bands.py @@ -2,12 +2,12 @@ import numpy as np import talib + +from jesse.helpers import get_candle_source, slice_candles from jesse.indicators.ma import ma from jesse.indicators.mean_ad import mean_ad from jesse.indicators.median_ad import median_ad -from jesse.helpers import get_candle_source, slice_candles - BollingerBands = namedtuple('BollingerBands', ['upperband', 'middleband', 'lowerband']) diff --git a/jesse/indicators/bollinger_bands_width.py b/jesse/indicators/bollinger_bands_width.py index 2a4b2c13b..3e1cea1a2 100644 --- a/jesse/indicators/bollinger_bands_width.py +++ b/jesse/indicators/bollinger_bands_width.py @@ -2,12 +2,12 @@ import numpy as np import talib + +from jesse.helpers import get_candle_source, slice_candles from jesse.indicators.ma import ma from jesse.indicators.mean_ad import mean_ad from jesse.indicators.median_ad import median_ad -from jesse.helpers import get_candle_source, slice_candles - def bollinger_bands_width(candles: np.ndarray, period: int = 20, devup: float = 2, devdn: float = 2, matype: int = 0, devtype: int = 0, diff --git a/jesse/indicators/cfo.py b/jesse/indicators/cfo.py index 258148457..3eb7a7bad 100644 --- a/jesse/indicators/cfo.py +++ b/jesse/indicators/cfo.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def cfo(candles: np.ndarray, period: int = 14, scalar: float = 100, source_type: str = "close", diff --git a/jesse/indicators/cg.py b/jesse/indicators/cg.py index 81ba6b928..2025456de 100644 --- a/jesse/indicators/cg.py +++ b/jesse/indicators/cg.py @@ -1,10 +1,7 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, same_length, slice_candles diff --git a/jesse/indicators/cksp.py b/jesse/indicators/cksp.py index 1fba11e4a..b8317a7fe 100644 --- a/jesse/indicators/cksp.py +++ b/jesse/indicators/cksp.py @@ -5,7 +5,6 @@ from jesse.helpers import slice_candles - CKSP = namedtuple('CKSP', ['long', 'short']) def cksp(candles: np.ndarray, p: int = 10, x: float = 1.0, q: int = 9, sequential: bool = False) -> CKSP: diff --git a/jesse/indicators/cmo.py b/jesse/indicators/cmo.py index a9a3c36ea..d32d82363 100644 --- a/jesse/indicators/cmo.py +++ b/jesse/indicators/cmo.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def cmo(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/correlation_cycle.py b/jesse/indicators/correlation_cycle.py index 2ce557581..3ec165e44 100644 --- a/jesse/indicators/correlation_cycle.py +++ b/jesse/indicators/correlation_cycle.py @@ -1,10 +1,7 @@ from collections import namedtuple import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, np_shift, slice_candles diff --git a/jesse/indicators/cvi.py b/jesse/indicators/cvi.py index 3a0cc6ecd..1bc940d33 100644 --- a/jesse/indicators/cvi.py +++ b/jesse/indicators/cvi.py @@ -3,7 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import slice_candles, same_length +from jesse.helpers import same_length, slice_candles def cvi(candles: np.ndarray, period: int = 5, sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/cwma.py b/jesse/indicators/cwma.py index eeb5c5396..4cec25768 100644 --- a/jesse/indicators/cwma.py +++ b/jesse/indicators/cwma.py @@ -1,11 +1,7 @@ from typing import Union -import numpy as np - -try: - from numba import njit -except ImportError: - njit = lambda a : a +import numpy as np +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/damiani_volatmeter.py b/jesse/indicators/damiani_volatmeter.py index 856ce19a2..a1c99340c 100644 --- a/jesse/indicators/damiani_volatmeter.py +++ b/jesse/indicators/damiani_volatmeter.py @@ -2,13 +2,9 @@ import numpy as np import talib -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles DamianiVolatmeter = namedtuple('DamianiVolatmeter', ['vol', 'anti']) diff --git a/jesse/indicators/dec_osc.py b/jesse/indicators/dec_osc.py index 517a6243f..00514ba6f 100644 --- a/jesse/indicators/dec_osc.py +++ b/jesse/indicators/dec_osc.py @@ -3,6 +3,7 @@ import numpy as np from jesse.helpers import get_candle_source, slice_candles + from .high_pass_2_pole import high_pass_2_pole_fast diff --git a/jesse/indicators/decycler.py b/jesse/indicators/decycler.py index a5ebe1293..e532ca67c 100644 --- a/jesse/indicators/decycler.py +++ b/jesse/indicators/decycler.py @@ -3,6 +3,7 @@ import numpy as np from jesse.helpers import get_candle_source, slice_candles + from .high_pass_2_pole import high_pass_2_pole_fast diff --git a/jesse/indicators/devstop.py b/jesse/indicators/devstop.py index 0f50f9e40..049523e14 100644 --- a/jesse/indicators/devstop.py +++ b/jesse/indicators/devstop.py @@ -2,10 +2,10 @@ import numpy as np import talib -from jesse.indicators.mean_ad import mean_ad -from jesse.indicators.median_ad import median_ad from jesse.helpers import slice_candles +from jesse.indicators.mean_ad import mean_ad +from jesse.indicators.median_ad import median_ad def devstop(candles: np.ndarray, period: int = 20, mult: float = 0, devtype: int = 0, direction: str = "long", diff --git a/jesse/indicators/edcf.py b/jesse/indicators/edcf.py index bd23e3957..b9883dc1b 100644 --- a/jesse/indicators/edcf.py +++ b/jesse/indicators/edcf.py @@ -1,11 +1,7 @@ from typing import Union import numpy as np - -try: - from numba import njit -except ImportError: - njit = lambda a: a +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/efi.py b/jesse/indicators/efi.py index ba1677227..1d12ff9cb 100644 --- a/jesse/indicators/efi.py +++ b/jesse/indicators/efi.py @@ -2,10 +2,7 @@ import numpy as np import talib -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, same_length, slice_candles diff --git a/jesse/indicators/emd.py b/jesse/indicators/emd.py index 8ed48611d..89efc133a 100644 --- a/jesse/indicators/emd.py +++ b/jesse/indicators/emd.py @@ -2,10 +2,7 @@ import numpy as np import talib -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import slice_candles diff --git a/jesse/indicators/emv.py b/jesse/indicators/emv.py index 1173b33f3..0995d5a82 100644 --- a/jesse/indicators/emv.py +++ b/jesse/indicators/emv.py @@ -3,7 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import slice_candles, same_length +from jesse.helpers import same_length, slice_candles def emv(candles: np.ndarray, sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/epma.py b/jesse/indicators/epma.py index f19e73b7e..1fd7b7a75 100644 --- a/jesse/indicators/epma.py +++ b/jesse/indicators/epma.py @@ -1,11 +1,7 @@ from typing import Union -import numpy as np - -try: - from numba import njit -except ImportError: - njit = lambda a : a +import numpy as np +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/er.py b/jesse/indicators/er.py index 815cc852c..3ccd341b7 100644 --- a/jesse/indicators/er.py +++ b/jesse/indicators/er.py @@ -3,7 +3,7 @@ import numpy as np from numpy.lib.stride_tricks import sliding_window_view -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def er(candles: np.ndarray, period: int = 5, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/eri.py b/jesse/indicators/eri.py index 2107d09f1..7faccda1b 100644 --- a/jesse/indicators/eri.py +++ b/jesse/indicators/eri.py @@ -1,9 +1,9 @@ from collections import namedtuple import numpy as np -from jesse.indicators.ma import ma from jesse.helpers import get_candle_source, slice_candles +from jesse.indicators.ma import ma ERI = namedtuple('ERI', ['bull', 'bear']) diff --git a/jesse/indicators/fisher.py b/jesse/indicators/fisher.py index 0ea7e8a81..f4710e873 100644 --- a/jesse/indicators/fisher.py +++ b/jesse/indicators/fisher.py @@ -3,7 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import slice_candles, same_length +from jesse.helpers import same_length, slice_candles FisherTransform = namedtuple('FisherTransform', ['fisher', 'signal']) diff --git a/jesse/indicators/frama.py b/jesse/indicators/frama.py index 9191d09d2..a300cef02 100644 --- a/jesse/indicators/frama.py +++ b/jesse/indicators/frama.py @@ -1,10 +1,7 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import slice_candles diff --git a/jesse/indicators/fwma.py b/jesse/indicators/fwma.py index f52d62e79..4340a9e6e 100644 --- a/jesse/indicators/fwma.py +++ b/jesse/indicators/fwma.py @@ -4,7 +4,7 @@ import numpy as np from numpy.lib.stride_tricks import sliding_window_view -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def fwma(candles: np.ndarray, period: int = 5, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/gatorosc.py b/jesse/indicators/gatorosc.py index f73e9c93e..e154899f2 100644 --- a/jesse/indicators/gatorosc.py +++ b/jesse/indicators/gatorosc.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source, np_shift -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, np_shift, slice_candles GATOR = namedtuple('GATOR', ['upper', 'lower', 'upper_change', 'lower_change']) diff --git a/jesse/indicators/gauss.py b/jesse/indicators/gauss.py index 799465477..0a64aae15 100644 --- a/jesse/indicators/gauss.py +++ b/jesse/indicators/gauss.py @@ -1,10 +1,7 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/heikin_ashi_candles.py b/jesse/indicators/heikin_ashi_candles.py index 0e874c29c..4b2e533a0 100755 --- a/jesse/indicators/heikin_ashi_candles.py +++ b/jesse/indicators/heikin_ashi_candles.py @@ -1,11 +1,9 @@ -import numpy as np from collections import namedtuple -from jesse.helpers import slice_candles -try: - from numba import njit -except ImportError: - njit = lambda a : a +import numpy as np +from numba import njit + +from jesse.helpers import slice_candles HA = namedtuple('HA', ['open', 'close', 'high', 'low']) @@ -44,8 +42,8 @@ def ha_fast(source): ha_candles[i][CLOSE] = (source[i][OPEN]+source[i][CLOSE]+source[i][HIGH]+source[i][LOW])/4 # Using builtins Python min,max and not numpy one since we get this Error: # No implementation of function Function() found for signature: - # Still fast since numba supports it + # Still fast since numba supports it ha_candles[i][HIGH] = max([source[i][HIGH], ha_candles[i][OPEN], ha_candles[i][CLOSE]]) ha_candles[i][LOW] = min([source[i][LOW], ha_candles[i][OPEN], ha_candles[i][CLOSE]]) - return ha_candles[:,OPEN], ha_candles[:,CLOSE], ha_candles[:,HIGH], ha_candles[:,LOW] \ No newline at end of file + return ha_candles[:,OPEN], ha_candles[:,CLOSE], ha_candles[:,HIGH], ha_candles[:,LOW] diff --git a/jesse/indicators/high_pass.py b/jesse/indicators/high_pass.py index e66451474..e4e3f4122 100644 --- a/jesse/indicators/high_pass.py +++ b/jesse/indicators/high_pass.py @@ -1,10 +1,7 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/high_pass_2_pole.py b/jesse/indicators/high_pass_2_pole.py index 68b8f41f4..f00eae1b4 100644 --- a/jesse/indicators/high_pass_2_pole.py +++ b/jesse/indicators/high_pass_2_pole.py @@ -1,10 +1,7 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/ht_dcperiod.py b/jesse/indicators/ht_dcperiod.py index 3880fe4f7..d798cc7a8 100644 --- a/jesse/indicators/ht_dcperiod.py +++ b/jesse/indicators/ht_dcperiod.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def ht_dcperiod(candles: np.ndarray, source_type: str = "close", sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/ht_dcphase.py b/jesse/indicators/ht_dcphase.py index 1e291b117..0adb21319 100644 --- a/jesse/indicators/ht_dcphase.py +++ b/jesse/indicators/ht_dcphase.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def ht_dcphase(candles: np.ndarray, source_type: str = "close", sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/ht_phasor.py b/jesse/indicators/ht_phasor.py index a85f2beda..2dccb3a8c 100644 --- a/jesse/indicators/ht_phasor.py +++ b/jesse/indicators/ht_phasor.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles IQ = namedtuple('IQ', ['inphase', 'quadrature']) diff --git a/jesse/indicators/ht_sine.py b/jesse/indicators/ht_sine.py index c45535ba0..1518481ee 100644 --- a/jesse/indicators/ht_sine.py +++ b/jesse/indicators/ht_sine.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles SINEWAVE = namedtuple('SINEWAVE', ['sine', 'lead']) diff --git a/jesse/indicators/ht_trendline.py b/jesse/indicators/ht_trendline.py index a4a4bd41f..da5d32817 100644 --- a/jesse/indicators/ht_trendline.py +++ b/jesse/indicators/ht_trendline.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def ht_trendline(candles: np.ndarray, source_type: str = "close", sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/ht_trendmode.py b/jesse/indicators/ht_trendmode.py index 96e66fbe0..4f0003527 100644 --- a/jesse/indicators/ht_trendmode.py +++ b/jesse/indicators/ht_trendmode.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def ht_trendmode(candles: np.ndarray, source_type: str = "close", sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/hurst_exponent.py b/jesse/indicators/hurst_exponent.py index c6e57e19b..b30feeb12 100644 --- a/jesse/indicators/hurst_exponent.py +++ b/jesse/indicators/hurst_exponent.py @@ -1,12 +1,9 @@ import numpy as np - -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit +from scipy import signal from jesse.helpers import get_candle_source, slice_candles -from scipy import signal + def hurst_exponent(candles: np.ndarray, min_chunksize: int = 8, max_chunksize: int = 200, num_chunksize:int=5, method:int=1, source_type: str = "close") -> float: """ diff --git a/jesse/indicators/hwma.py b/jesse/indicators/hwma.py index ec989e72a..26acf70f5 100644 --- a/jesse/indicators/hwma.py +++ b/jesse/indicators/hwma.py @@ -1,12 +1,9 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def hwma(candles: np.ndarray, na: float = 0.2, nb: float = 0.1, nc: float = 0.1, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/ichimoku_cloud_seq.py b/jesse/indicators/ichimoku_cloud_seq.py index 01bbcc6b0..f78b20b59 100644 --- a/jesse/indicators/ichimoku_cloud_seq.py +++ b/jesse/indicators/ichimoku_cloud_seq.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import np_shift -from jesse.helpers import slice_candles +from jesse.helpers import np_shift, slice_candles IchimokuCloud = namedtuple('IchimokuCloud', ['conversion_line', 'base_line', 'span_a', 'span_b', 'lagging_line', 'future_span_a', diff --git a/jesse/indicators/ift_rsi.py b/jesse/indicators/ift_rsi.py index fe999186c..3f296a07f 100644 --- a/jesse/indicators/ift_rsi.py +++ b/jesse/indicators/ift_rsi.py @@ -1,9 +1,9 @@ from typing import Union -import talib import numpy as np +import talib -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def ift_rsi(candles: np.ndarray, rsi_period: int = 5, wma_period: int =9, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/itrend.py b/jesse/indicators/itrend.py index ee8fe0f2a..01c8f6c9f 100644 --- a/jesse/indicators/itrend.py +++ b/jesse/indicators/itrend.py @@ -1,10 +1,7 @@ from collections import namedtuple import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/jma.py b/jesse/indicators/jma.py index 67cd83c9b..c997e4925 100644 --- a/jesse/indicators/jma.py +++ b/jesse/indicators/jma.py @@ -1,10 +1,7 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/jsa.py b/jesse/indicators/jsa.py index e9c49e09f..ebda46d08 100644 --- a/jesse/indicators/jsa.py +++ b/jesse/indicators/jsa.py @@ -2,7 +2,7 @@ import numpy as np -from jesse.helpers import get_candle_source, slice_candles, np_shift +from jesse.helpers import get_candle_source, np_shift, slice_candles def jsa(candles: np.ndarray, period: int = 30, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/kama.py b/jesse/indicators/kama.py index 5b539b2b6..dff02c8c8 100644 --- a/jesse/indicators/kama.py +++ b/jesse/indicators/kama.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def kama(candles: np.ndarray, period: int = 30, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/kaufmanstop.py b/jesse/indicators/kaufmanstop.py index c1f3efdc0..4e98f1613 100644 --- a/jesse/indicators/kaufmanstop.py +++ b/jesse/indicators/kaufmanstop.py @@ -2,8 +2,8 @@ import numpy as np -from jesse.indicators.ma import ma from jesse.helpers import slice_candles +from jesse.indicators.ma import ma def kaufmanstop(candles: np.ndarray, period: int = 22, mult: float = 2, direction: str = "long", matype: int = 0, diff --git a/jesse/indicators/kdj.py b/jesse/indicators/kdj.py index 49d66cc8a..6222f5c5a 100644 --- a/jesse/indicators/kdj.py +++ b/jesse/indicators/kdj.py @@ -2,9 +2,9 @@ import numpy as np import talib -from jesse.indicators.ma import ma from jesse.helpers import slice_candles +from jesse.indicators.ma import ma KDJ = namedtuple('KDJ', ['k', 'd', 'j']) diff --git a/jesse/indicators/keltner.py b/jesse/indicators/keltner.py index eabed9e62..a8f807800 100644 --- a/jesse/indicators/keltner.py +++ b/jesse/indicators/keltner.py @@ -3,11 +3,9 @@ import numpy as np import talib +from jesse.helpers import get_candle_source, slice_candles from jesse.indicators.ma import ma -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles - KeltnerChannel = namedtuple('KeltnerChannel', ['upperband', 'middleband', 'lowerband']) diff --git a/jesse/indicators/kst.py b/jesse/indicators/kst.py index c5bacf1ba..d83b97a44 100644 --- a/jesse/indicators/kst.py +++ b/jesse/indicators/kst.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles KST = namedtuple('KST', ['line', 'signal']) diff --git a/jesse/indicators/kurtosis.py b/jesse/indicators/kurtosis.py index 6a5eafa45..ea10480c9 100644 --- a/jesse/indicators/kurtosis.py +++ b/jesse/indicators/kurtosis.py @@ -1,10 +1,10 @@ from typing import Union import numpy as np -from scipy import stats from numpy.lib.stride_tricks import sliding_window_view +from scipy import stats -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def kurtosis(candles: np.ndarray, period: int = 5, source_type: str = "hl2", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/kvo.py b/jesse/indicators/kvo.py index 52bf32547..2f658df12 100644 --- a/jesse/indicators/kvo.py +++ b/jesse/indicators/kvo.py @@ -3,7 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import slice_candles, same_length +from jesse.helpers import same_length, slice_candles def kvo(candles: np.ndarray, short_period: int = 2, long_period: int = 5, sequential: bool = False) -> Union[ diff --git a/jesse/indicators/linearreg.py b/jesse/indicators/linearreg.py index 481aa82a8..af51592d4 100644 --- a/jesse/indicators/linearreg.py +++ b/jesse/indicators/linearreg.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def linearreg(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/linearreg_angle.py b/jesse/indicators/linearreg_angle.py index 05abe5b98..d1d782859 100644 --- a/jesse/indicators/linearreg_angle.py +++ b/jesse/indicators/linearreg_angle.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def linearreg_angle(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> \ diff --git a/jesse/indicators/linearreg_intercept.py b/jesse/indicators/linearreg_intercept.py index 7038d2a06..15b363a8a 100644 --- a/jesse/indicators/linearreg_intercept.py +++ b/jesse/indicators/linearreg_intercept.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def linearreg_intercept(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> \ diff --git a/jesse/indicators/linearreg_slope.py b/jesse/indicators/linearreg_slope.py index 8f920df82..cabeee40b 100644 --- a/jesse/indicators/linearreg_slope.py +++ b/jesse/indicators/linearreg_slope.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def linearreg_slope(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> \ diff --git a/jesse/indicators/lrsi.py b/jesse/indicators/lrsi.py index 5b9d46bee..08c0f05dd 100644 --- a/jesse/indicators/lrsi.py +++ b/jesse/indicators/lrsi.py @@ -1,10 +1,7 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import slice_candles diff --git a/jesse/indicators/maaq.py b/jesse/indicators/maaq.py index 98e8aa50c..96cec8d28 100644 --- a/jesse/indicators/maaq.py +++ b/jesse/indicators/maaq.py @@ -1,13 +1,11 @@ from typing import Union -import talib -import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a: a +import numpy as np +import talib +from numba import njit -from jesse.helpers import get_candle_source, slice_candles, np_shift, same_length +from jesse.helpers import (get_candle_source, np_shift, same_length, + slice_candles) def maaq(candles: np.ndarray, period: int = 11, fast_period: int = 2, slow_period: int = 30, source_type: str = "close", sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/mab.py b/jesse/indicators/mab.py index 20eda98e0..fac1bb796 100644 --- a/jesse/indicators/mab.py +++ b/jesse/indicators/mab.py @@ -2,10 +2,9 @@ import numpy as np import talib -from jesse.indicators.ma import ma - from jesse.helpers import get_candle_source, slice_candles +from jesse.indicators.ma import ma MAB = namedtuple('MAB', ['upperband', 'middleband', 'lowerband']) diff --git a/jesse/indicators/macd.py b/jesse/indicators/macd.py index 5d47bb556..5207b5f5b 100644 --- a/jesse/indicators/macd.py +++ b/jesse/indicators/macd.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles MACD = namedtuple('MACD', ['macd', 'signal', 'hist']) diff --git a/jesse/indicators/macdext.py b/jesse/indicators/macdext.py index cfc63d03d..29498ea31 100644 --- a/jesse/indicators/macdext.py +++ b/jesse/indicators/macdext.py @@ -2,7 +2,7 @@ import numpy as np -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles from jesse.indicators.ma import ma MACDEXT = namedtuple('MACDEXT', ['macd', 'signal', 'hist']) diff --git a/jesse/indicators/mama.py b/jesse/indicators/mama.py index c8c8f8f7e..4bac153a9 100644 --- a/jesse/indicators/mama.py +++ b/jesse/indicators/mama.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles MAMA = namedtuple('MAMA', ['mama', 'fama']) diff --git a/jesse/indicators/marketfi.py b/jesse/indicators/marketfi.py index dc830e4d4..b12b7c2a0 100644 --- a/jesse/indicators/marketfi.py +++ b/jesse/indicators/marketfi.py @@ -3,8 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import same_length -from jesse.helpers import slice_candles +from jesse.helpers import same_length, slice_candles def marketfi(candles: np.ndarray, sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/mass.py b/jesse/indicators/mass.py index 80d785a1b..cfd457476 100644 --- a/jesse/indicators/mass.py +++ b/jesse/indicators/mass.py @@ -3,7 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import slice_candles, same_length +from jesse.helpers import same_length, slice_candles def mass(candles: np.ndarray, period: int = 5, sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/mcginley_dynamic.py b/jesse/indicators/mcginley_dynamic.py index 3871d6450..7f3c5ab99 100644 --- a/jesse/indicators/mcginley_dynamic.py +++ b/jesse/indicators/mcginley_dynamic.py @@ -1,10 +1,7 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/mean_ad.py b/jesse/indicators/mean_ad.py index a8cf7a64f..4e79e87df 100644 --- a/jesse/indicators/mean_ad.py +++ b/jesse/indicators/mean_ad.py @@ -2,7 +2,8 @@ import numpy as np from numpy.lib.stride_tricks import sliding_window_view -from jesse.helpers import get_candle_source, slice_candles, same_length + +from jesse.helpers import get_candle_source, same_length, slice_candles def mean_ad(candles: np.ndarray, period: int = 5, source_type: str = "hl2", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/median_ad.py b/jesse/indicators/median_ad.py index f9524abd0..3c75577b1 100644 --- a/jesse/indicators/median_ad.py +++ b/jesse/indicators/median_ad.py @@ -1,10 +1,10 @@ from typing import Union import numpy as np -from scipy import stats from numpy.lib.stride_tricks import sliding_window_view +from scipy import stats -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def median_ad(candles: np.ndarray, period: int = 5, source_type: str = "hl2", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/midpoint.py b/jesse/indicators/midpoint.py index b91e16876..a12ff33f7 100644 --- a/jesse/indicators/midpoint.py +++ b/jesse/indicators/midpoint.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def midpoint(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/mom.py b/jesse/indicators/mom.py index 2b4db1f27..f2c18ffb6 100644 --- a/jesse/indicators/mom.py +++ b/jesse/indicators/mom.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def mom(candles: np.ndarray, period: int = 10, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/mwdx.py b/jesse/indicators/mwdx.py index ffa7664f5..e4c7ad064 100644 --- a/jesse/indicators/mwdx.py +++ b/jesse/indicators/mwdx.py @@ -1,11 +1,7 @@ from typing import Union import numpy as np - -try: - from numba import njit -except ImportError: - njit = lambda a: a +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/nma.py b/jesse/indicators/nma.py index 9b418dc27..8a5153dd0 100644 --- a/jesse/indicators/nma.py +++ b/jesse/indicators/nma.py @@ -1,10 +1,7 @@ from typing import Union -import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a: a +import numpy as np +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/nvi.py b/jesse/indicators/nvi.py index f96526df5..7a6c4ec63 100644 --- a/jesse/indicators/nvi.py +++ b/jesse/indicators/nvi.py @@ -3,8 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import get_candle_source, same_length -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, same_length, slice_candles def nvi(candles: np.ndarray, source_type: str = "close", sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/pfe.py b/jesse/indicators/pfe.py index 9868b68cc..e0ed24411 100644 --- a/jesse/indicators/pfe.py +++ b/jesse/indicators/pfe.py @@ -3,7 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def pfe(candles: np.ndarray, period: int = 10, smoothing: int = 5, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/pma.py b/jesse/indicators/pma.py index e7a4e10c1..6a93a04a4 100644 --- a/jesse/indicators/pma.py +++ b/jesse/indicators/pma.py @@ -1,11 +1,7 @@ -import numpy as np - from collections import namedtuple -try: - from numba import njit -except ImportError: - njit = lambda a : a +import numpy as np +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/ppo.py b/jesse/indicators/ppo.py index 5f6f3dd73..723213a75 100644 --- a/jesse/indicators/ppo.py +++ b/jesse/indicators/ppo.py @@ -1,10 +1,9 @@ from typing import Union import numpy as np -from jesse.indicators.ma import ma -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles +from jesse.indicators.ma import ma def ppo(candles: np.ndarray, fast_period: int = 12, slow_period: int = 26, matype: int = 0, source_type: str = "close", diff --git a/jesse/indicators/pvi.py b/jesse/indicators/pvi.py index 3dcddda1a..ea8e3c7a5 100644 --- a/jesse/indicators/pvi.py +++ b/jesse/indicators/pvi.py @@ -3,8 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import get_candle_source, same_length -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, same_length, slice_candles def pvi(candles: np.ndarray, source_type: str = "close", sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/pwma.py b/jesse/indicators/pwma.py index c991992a4..f23be2db7 100644 --- a/jesse/indicators/pwma.py +++ b/jesse/indicators/pwma.py @@ -1,11 +1,11 @@ -from typing import Union from functools import reduce from operator import mul +from typing import Union import numpy as np from numpy.lib.stride_tricks import sliding_window_view -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def pwma(candles: np.ndarray, period: int = 5, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/qstick.py b/jesse/indicators/qstick.py index bd7443fce..21dca95c9 100644 --- a/jesse/indicators/qstick.py +++ b/jesse/indicators/qstick.py @@ -3,7 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import slice_candles, same_length +from jesse.helpers import same_length, slice_candles def qstick(candles: np.ndarray, period: int = 5, sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/reflex.py b/jesse/indicators/reflex.py index cf6eeee6c..29bc17c92 100644 --- a/jesse/indicators/reflex.py +++ b/jesse/indicators/reflex.py @@ -1,12 +1,10 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, slice_candles + from .supersmoother import supersmoother_fast diff --git a/jesse/indicators/rma.py b/jesse/indicators/rma.py index 5fe5c16e0..f4756bcee 100644 --- a/jesse/indicators/rma.py +++ b/jesse/indicators/rma.py @@ -1,10 +1,7 @@ -import numpy as np from typing import Union -try: - from numba import njit, guvectorize -except ImportError: - njit = lambda a: a +import numpy as np +from numba import guvectorize, njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/roc.py b/jesse/indicators/roc.py index 3c4efa992..f4e4e2dc5 100644 --- a/jesse/indicators/roc.py +++ b/jesse/indicators/roc.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def roc(candles: np.ndarray, period: int = 10, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/rocp.py b/jesse/indicators/rocp.py index dc3e45681..dd94e91d1 100644 --- a/jesse/indicators/rocp.py +++ b/jesse/indicators/rocp.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def rocp(candles: np.ndarray, period: int = 10, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/rocr.py b/jesse/indicators/rocr.py index d80377b14..ac6bb9f3a 100644 --- a/jesse/indicators/rocr.py +++ b/jesse/indicators/rocr.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def rocr(candles: np.ndarray, period: int = 10, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/rocr100.py b/jesse/indicators/rocr100.py index 80dddbcc8..0791bde1f 100644 --- a/jesse/indicators/rocr100.py +++ b/jesse/indicators/rocr100.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def rocr100(candles: np.ndarray, period: int = 10, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/roofing.py b/jesse/indicators/roofing.py index 4dc2b4d32..bcd539058 100644 --- a/jesse/indicators/roofing.py +++ b/jesse/indicators/roofing.py @@ -3,6 +3,7 @@ import numpy as np from jesse.helpers import get_candle_source, slice_candles + from .high_pass_2_pole import high_pass_2_pole_fast from .supersmoother import supersmoother_fast diff --git a/jesse/indicators/rsi.py b/jesse/indicators/rsi.py index 0603d007d..1f3166c19 100644 --- a/jesse/indicators/rsi.py +++ b/jesse/indicators/rsi.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def rsi(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/rsmk.py b/jesse/indicators/rsmk.py index 04b25f994..c607e2b55 100644 --- a/jesse/indicators/rsmk.py +++ b/jesse/indicators/rsmk.py @@ -2,9 +2,9 @@ import numpy as np import talib -from jesse.indicators.ma import ma from jesse.helpers import get_candle_source +from jesse.indicators.ma import ma RSMK = namedtuple('RSMK', ['indicator', 'signal']) diff --git a/jesse/indicators/rsx.py b/jesse/indicators/rsx.py index e90f39d73..8b6aa44ba 100644 --- a/jesse/indicators/rsx.py +++ b/jesse/indicators/rsx.py @@ -1,10 +1,7 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, slice_candles @@ -13,7 +10,7 @@ def rsx(candles: np.ndarray, period: int = 14, source_type: str = "close", seque float, np.ndarray]: """ Relative Strength Xtra (rsx) - + :param candles: np.ndarray :param period: int - default: 14 :param source_type: str - default: "close" diff --git a/jesse/indicators/rvi.py b/jesse/indicators/rvi.py index ea496fccc..e6fbc672d 100644 --- a/jesse/indicators/rvi.py +++ b/jesse/indicators/rvi.py @@ -2,13 +2,13 @@ import numpy as np import talib -from jesse.indicators.ma import ma -from jesse.helpers import get_candle_source, same_length -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, same_length, slice_candles +from jesse.indicators.ma import ma from jesse.indicators.mean_ad import mean_ad from jesse.indicators.median_ad import median_ad + def rvi(candles: np.ndarray, period: int = 10, ma_len: int = 14, matype: int = 1, devtype: int = 0, source_type: str = "close", sequential: bool = False) -> Union[float, np.ndarray]: """ diff --git a/jesse/indicators/safezonestop.py b/jesse/indicators/safezonestop.py index 3ea5a0c68..273370705 100644 --- a/jesse/indicators/safezonestop.py +++ b/jesse/indicators/safezonestop.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import np_shift -from jesse.helpers import slice_candles +from jesse.helpers import np_shift, slice_candles def safezonestop(candles: np.ndarray, period: int = 22, mult: float = 2.5, max_lookback: int = 3, diff --git a/jesse/indicators/sinwma.py b/jesse/indicators/sinwma.py index 20c37e321..1c41cbb4e 100644 --- a/jesse/indicators/sinwma.py +++ b/jesse/indicators/sinwma.py @@ -3,7 +3,7 @@ import numpy as np from numpy.lib.stride_tricks import sliding_window_view -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def sinwma(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/skew.py b/jesse/indicators/skew.py index 722d40b6c..246edf7fb 100644 --- a/jesse/indicators/skew.py +++ b/jesse/indicators/skew.py @@ -1,10 +1,10 @@ from typing import Union import numpy as np -from scipy import stats from numpy.lib.stride_tricks import sliding_window_view +from scipy import stats -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def skew(candles: np.ndarray, period: int = 5, source_type: str = "hl2", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/sma.py b/jesse/indicators/sma.py index 693f87c06..2f8d00adb 100644 --- a/jesse/indicators/sma.py +++ b/jesse/indicators/sma.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def sma(candles: np.ndarray, period: int = 5, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/sqwma.py b/jesse/indicators/sqwma.py index 76af36165..aea84d1ca 100644 --- a/jesse/indicators/sqwma.py +++ b/jesse/indicators/sqwma.py @@ -1,11 +1,7 @@ from typing import Union -import numpy as np - -try: - from numba import njit -except ImportError: - njit = lambda a : a +import numpy as np +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/srwma.py b/jesse/indicators/srwma.py index cadc598c2..985821bf6 100644 --- a/jesse/indicators/srwma.py +++ b/jesse/indicators/srwma.py @@ -1,11 +1,7 @@ from typing import Union -import numpy as np - -try: - from numba import njit -except ImportError: - njit = lambda a : a +import numpy as np +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/stc.py b/jesse/indicators/stc.py index 6fc5edea8..33f59de46 100644 --- a/jesse/indicators/stc.py +++ b/jesse/indicators/stc.py @@ -3,10 +3,10 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles from jesse.indicators.ma import ma + def stc(candles: np.ndarray, fast_period: int = 23, fast_matype: int = 1, slow_period: int = 50, slow_matype: int = 1, k_period: int = 10, d_period: int = 3, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/stddev.py b/jesse/indicators/stddev.py index 4fbf60784..2b1fa0138 100644 --- a/jesse/indicators/stddev.py +++ b/jesse/indicators/stddev.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def stddev(candles: np.ndarray, period: int = 5, nbdev: float = 1, source_type: str = "close", diff --git a/jesse/indicators/stochastic.py b/jesse/indicators/stochastic.py index 3a93cb854..bf5a13be3 100644 --- a/jesse/indicators/stochastic.py +++ b/jesse/indicators/stochastic.py @@ -2,9 +2,9 @@ import numpy as np import talib -from jesse.indicators.ma import ma from jesse.helpers import slice_candles +from jesse.indicators.ma import ma Stochastic = namedtuple('Stochastic', ['k', 'd']) diff --git a/jesse/indicators/supersmoother.py b/jesse/indicators/supersmoother.py index e2fd59504..49582c274 100644 --- a/jesse/indicators/supersmoother.py +++ b/jesse/indicators/supersmoother.py @@ -1,10 +1,7 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/supersmoother_3_pole.py b/jesse/indicators/supersmoother_3_pole.py index 20cd12c37..c2703e05e 100644 --- a/jesse/indicators/supersmoother_3_pole.py +++ b/jesse/indicators/supersmoother_3_pole.py @@ -1,6 +1,7 @@ from typing import Union import numpy as np + try: from numba import njit except ImportError: diff --git a/jesse/indicators/supertrend.py b/jesse/indicators/supertrend.py index cf7419109..4813ecbe4 100644 --- a/jesse/indicators/supertrend.py +++ b/jesse/indicators/supertrend.py @@ -2,10 +2,7 @@ import numpy as np import talib -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import slice_candles @@ -94,4 +91,4 @@ def supertrend_fast(candles, atr, factor, period): else: super_trend[i] = currUpperBand # switch to DOWNTREND changed[i] = True - return super_trend, changed \ No newline at end of file + return super_trend, changed diff --git a/jesse/indicators/swma.py b/jesse/indicators/swma.py index fb89a7f62..4aa97536e 100644 --- a/jesse/indicators/swma.py +++ b/jesse/indicators/swma.py @@ -1,9 +1,10 @@ -from typing import Union from math import floor +from typing import Union + import numpy as np from numpy.lib.stride_tricks import sliding_window_view -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def swma(candles: np.ndarray, period: int = 5, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/t3.py b/jesse/indicators/t3.py index bca14af56..883830879 100644 --- a/jesse/indicators/t3.py +++ b/jesse/indicators/t3.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def t3(candles: np.ndarray, period: int = 5, vfactor: float = 0, source_type: str = "close", diff --git a/jesse/indicators/tema.py b/jesse/indicators/tema.py index 662680d20..a3a9c5fe5 100644 --- a/jesse/indicators/tema.py +++ b/jesse/indicators/tema.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def tema(candles: np.ndarray, period: int = 9, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/trendflex.py b/jesse/indicators/trendflex.py index e7336f666..7659c4e00 100644 --- a/jesse/indicators/trendflex.py +++ b/jesse/indicators/trendflex.py @@ -1,12 +1,10 @@ from typing import Union import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, slice_candles + from .supersmoother import supersmoother_fast diff --git a/jesse/indicators/trima.py b/jesse/indicators/trima.py index 0dea09103..a8bc051db 100644 --- a/jesse/indicators/trima.py +++ b/jesse/indicators/trima.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def trima(candles: np.ndarray, period: int = 30, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/trix.py b/jesse/indicators/trix.py index 4fb3c1ecc..cbe6dc72a 100644 --- a/jesse/indicators/trix.py +++ b/jesse/indicators/trix.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def trix(candles: np.ndarray, period: int = 18, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/tsf.py b/jesse/indicators/tsf.py index a110b162e..01f26ab62 100644 --- a/jesse/indicators/tsf.py +++ b/jesse/indicators/tsf.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def tsf(candles: np.ndarray, period: int = 14, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/tsi.py b/jesse/indicators/tsi.py index 5eeaa5575..17d4575b7 100644 --- a/jesse/indicators/tsi.py +++ b/jesse/indicators/tsi.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def tsi(candles: np.ndarray, long_period: int = 25, short_period: int = 13, source_type: str = "close", diff --git a/jesse/indicators/ttm_trend.py b/jesse/indicators/ttm_trend.py index 51991d34b..8e8c1a663 100644 --- a/jesse/indicators/ttm_trend.py +++ b/jesse/indicators/ttm_trend.py @@ -3,7 +3,7 @@ import numpy as np from numpy.lib.stride_tricks import sliding_window_view -from jesse.helpers import get_candle_source, slice_candles, same_length +from jesse.helpers import get_candle_source, same_length, slice_candles def ttm_trend(candles: np.ndarray, period: int = 5, source_type: str = "hl2", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/ui.py b/jesse/indicators/ui.py index 1915c6b99..81487c0e5 100644 --- a/jesse/indicators/ui.py +++ b/jesse/indicators/ui.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def ui(candles: np.ndarray, period: int = 14, scalar: float = 100, source_type: str = "close", sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/var.py b/jesse/indicators/var.py index cb7ec3bf8..e32bb8b13 100644 --- a/jesse/indicators/var.py +++ b/jesse/indicators/var.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def var(candles: np.ndarray, period: int = 14, nbdev: float = 1, source_type: str = "close", diff --git a/jesse/indicators/vi.py b/jesse/indicators/vi.py index 6f31adcdf..c8a88310b 100644 --- a/jesse/indicators/vi.py +++ b/jesse/indicators/vi.py @@ -1,10 +1,7 @@ from collections import namedtuple import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import slice_candles diff --git a/jesse/indicators/vidya.py b/jesse/indicators/vidya.py index 21ae3a47f..2e3e20751 100644 --- a/jesse/indicators/vidya.py +++ b/jesse/indicators/vidya.py @@ -3,8 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import get_candle_source, same_length -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, same_length, slice_candles def vidya(candles: np.ndarray, short_period: int = 2, long_period: int = 5, alpha: float = 0.2, diff --git a/jesse/indicators/vlma.py b/jesse/indicators/vlma.py index 31ff6faf2..2be732482 100644 --- a/jesse/indicators/vlma.py +++ b/jesse/indicators/vlma.py @@ -1,18 +1,14 @@ from typing import Union -import talib + import numpy as np +import talib +from numba import njit +from jesse.helpers import get_candle_source, slice_candles from jesse.indicators.ma import ma from jesse.indicators.mean_ad import mean_ad from jesse.indicators.median_ad import median_ad -try: - from numba import njit -except ImportError: - njit = lambda a : a - -from jesse.helpers import get_candle_source, slice_candles - def vlma(candles: np.ndarray, min_period: int = 5, max_period: int = 50, matype: int = 0, devtype: int = 0, source_type: str = "close", sequential: bool = False) -> Union[ float, np.ndarray]: diff --git a/jesse/indicators/vosc.py b/jesse/indicators/vosc.py index a7a4b778c..1c8dacb2d 100644 --- a/jesse/indicators/vosc.py +++ b/jesse/indicators/vosc.py @@ -3,7 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import slice_candles, same_length +from jesse.helpers import same_length, slice_candles def vosc(candles: np.ndarray, short_period: int = 2, long_period: int = 5, sequential: bool = False) -> Union[ diff --git a/jesse/indicators/voss.py b/jesse/indicators/voss.py index 79574aae8..4a7602cc2 100644 --- a/jesse/indicators/voss.py +++ b/jesse/indicators/voss.py @@ -1,10 +1,7 @@ from collections import namedtuple import numpy as np -try: - from numba import njit -except ImportError: - njit = lambda a : a +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/vpwma.py b/jesse/indicators/vpwma.py index eb374c567..5256b33c1 100644 --- a/jesse/indicators/vpwma.py +++ b/jesse/indicators/vpwma.py @@ -1,11 +1,7 @@ from typing import Union -import numpy as np - -try: - from numba import njit -except ImportError: - njit = lambda a : a +import numpy as np +from numba import njit from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/vwap.py b/jesse/indicators/vwap.py index 0345686e4..8d1bd2686 100644 --- a/jesse/indicators/vwap.py +++ b/jesse/indicators/vwap.py @@ -1,11 +1,8 @@ from typing import Union import numpy as np -try: - from numba import njit - from numpy_groupies import aggregate_nb as aggregate -except ImportError: - from numpy_groupies import aggregate +from numba import njit +from numpy_groupies import aggregate_nb as aggregate from jesse.helpers import get_candle_source, slice_candles diff --git a/jesse/indicators/vwma.py b/jesse/indicators/vwma.py index f6bd3d37b..8b250d99f 100644 --- a/jesse/indicators/vwma.py +++ b/jesse/indicators/vwma.py @@ -3,8 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import get_candle_source, same_length -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, same_length, slice_candles def vwma(candles: np.ndarray, period: int = 20, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/wad.py b/jesse/indicators/wad.py index 6b531cd3e..a1a32cbde 100644 --- a/jesse/indicators/wad.py +++ b/jesse/indicators/wad.py @@ -3,7 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import slice_candles, same_length +from jesse.helpers import same_length, slice_candles def wad(candles: np.ndarray, sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/jesse/indicators/wilders.py b/jesse/indicators/wilders.py index 3349a9d40..d85c5eaa3 100644 --- a/jesse/indicators/wilders.py +++ b/jesse/indicators/wilders.py @@ -3,8 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import get_candle_source, same_length -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, same_length, slice_candles def wilders(candles: np.ndarray, period: int = 5, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/wma.py b/jesse/indicators/wma.py index 11a02260a..3d9fb0233 100644 --- a/jesse/indicators/wma.py +++ b/jesse/indicators/wma.py @@ -3,8 +3,7 @@ import numpy as np import talib -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, slice_candles def wma(candles: np.ndarray, period: int = 30, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/zlema.py b/jesse/indicators/zlema.py index 0134b155b..30936c0c5 100644 --- a/jesse/indicators/zlema.py +++ b/jesse/indicators/zlema.py @@ -3,8 +3,7 @@ import numpy as np import tulipy as ti -from jesse.helpers import get_candle_source, same_length -from jesse.helpers import slice_candles +from jesse.helpers import get_candle_source, same_length, slice_candles def zlema(candles: np.ndarray, period: int = 20, source_type: str = "close", sequential: bool = False) -> Union[ diff --git a/jesse/indicators/zscore.py b/jesse/indicators/zscore.py index b66ac1082..c6434b9d7 100644 --- a/jesse/indicators/zscore.py +++ b/jesse/indicators/zscore.py @@ -2,13 +2,12 @@ import numpy as np import talib + +from jesse.helpers import get_candle_source, slice_candles from jesse.indicators.ma import ma from jesse.indicators.mean_ad import mean_ad from jesse.indicators.median_ad import median_ad -from jesse.helpers import get_candle_source -from jesse.helpers import slice_candles - def zscore(candles: np.ndarray, period: int = 14, matype: int = 0, nbdev: float = 1, devtype: int = 0, source_type: str = "close", sequential: bool = False) -> Union[float, np.ndarray]: diff --git a/requirements.txt b/requirements.txt index aa34e70ec..b3e7b656b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,3 +29,4 @@ websockets>=10.0.0 python-dotenv==0.19.2 aiofiles==0.7.0 jesse-dydx-v3-python==1.0.4 +numba==0.59.0 From cb023196abdb1ebe631d5ebe0955ed504ff214bf Mon Sep 17 00:00:00 2001 From: Andy Date: Sat, 16 Mar 2024 16:43:28 +0100 Subject: [PATCH 3/6] "The job was not started because recent account payments have failed or your spending limit needs to be increased. Please check the 'Billing & plans' section in your settings." ^^thats why this was disabled? Gitub actions for osc and windows are not for free? :/ --- .github/workflows/python-package.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 6c9dd399f..0db340d4c 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -24,10 +24,10 @@ jobs: include: - os: ubuntu-latest path: ~/.cache/pip - - os: macos-latest-xlarge - path: ~/Library/Caches/pip - - os: windows-latest - path: ~\AppData\Local\pip\Cache + #- os: macos-latest-xlarge + # path: ~/Library/Caches/pip + #- os: windows-latest + # path: ~\AppData\Local\pip\Cache python-version: [3.8, 3.9, '3.10', 3.11] From 70b64669971be5727cd282452681923814ef2574 Mon Sep 17 00:00:00 2001 From: Andy Date: Sat, 16 Mar 2024 16:46:26 +0100 Subject: [PATCH 4/6] the latest numba aint supported on python 3.8 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b3e7b656b..2065bda13 100644 --- a/requirements.txt +++ b/requirements.txt @@ -29,4 +29,4 @@ websockets>=10.0.0 python-dotenv==0.19.2 aiofiles==0.7.0 jesse-dydx-v3-python==1.0.4 -numba==0.59.0 +numba==0.58.1 From 8e805c8dcdd4983c2ed493778bf6e07ee67b44db Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 18 Mar 2024 14:02:37 +0100 Subject: [PATCH 5/6] Give the user a slighly better hint to when the backtest can start - with an optional CSS class for the h3 that is displaying the raise error in the dashboard it could also handle the line breaks which currently only work in the console needed css in the dashboard: "white-space: pre-line;" --- jesse/services/required_candles.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/jesse/services/required_candles.py b/jesse/services/required_candles.py index 99697e1e2..d6c143879 100644 --- a/jesse/services/required_candles.py +++ b/jesse/services/required_candles.py @@ -1,3 +1,5 @@ +from datetime import datetime + import arrow import numpy as np @@ -87,6 +89,7 @@ def load_required_candles(exchange: str, symbol: str, start_date_str: str, finis )[0][0] first_backtestable_timestamp = first_existing_candle + (pre_finish_date - pre_start_date) + (60_000 * 1440) + first_backtestable_datetime = datetime.fromtimestamp(first_backtestable_timestamp/1000) # if first backtestable timestamp is in the future, that means we have some but not enough candles if first_backtestable_timestamp > jh.today_to_timestamp(): @@ -96,7 +99,9 @@ def load_required_candles(exchange: str, symbol: str, start_date_str: str, finis ) raise CandleNotFoundInDatabase( - f'Not enough candles for {exchange} {symbol} exists to run backtest from {start_date_str} => {finish_date_str}. \n' + f'Not enough candles for {exchange} {symbol} exists to run backtest from {start_date_str} => {finish_date_str} ' + f'(first possible date is {first_backtestable_datetime.date()}). \n' + f'Are you considering the warmup candles? For more info please read:\n https://jesse.trade/help/faq/i-imported-candles-but-keep-getting-not-enough-candles' ) From 81834e1672547631b0f470a3c36b6abe8a3bbac3 Mon Sep 17 00:00:00 2001 From: Andy Date: Sun, 7 Apr 2024 00:07:06 +0200 Subject: [PATCH 6/6] adding cache fot njit decorators - the result is a 3x speed improvement in with pytest --- jesse/indicators/bandpass.py | 2 +- jesse/indicators/cg.py | 2 +- jesse/indicators/correlation_cycle.py | 2 +- jesse/indicators/cwma.py | 2 +- jesse/indicators/damiani_volatmeter.py | 2 +- jesse/indicators/edcf.py | 2 +- jesse/indicators/efi.py | 2 +- jesse/indicators/emd.py | 4 ++-- jesse/indicators/epma.py | 2 +- jesse/indicators/frama.py | 2 +- jesse/indicators/gauss.py | 2 +- jesse/indicators/heikin_ashi_candles.py | 2 +- jesse/indicators/high_pass.py | 2 +- jesse/indicators/high_pass_2_pole.py | 2 +- jesse/indicators/hurst_exponent.py | 2 +- jesse/indicators/hwma.py | 2 +- jesse/indicators/itrend.py | 2 +- jesse/indicators/jma.py | 2 +- jesse/indicators/lrsi.py | 2 +- jesse/indicators/maaq.py | 2 +- jesse/indicators/mcginley_dynamic.py | 2 +- jesse/indicators/mwdx.py | 2 +- jesse/indicators/nma.py | 2 +- jesse/indicators/pma.py | 2 +- jesse/indicators/reflex.py | 2 +- jesse/indicators/rma.py | 2 +- jesse/indicators/rsx.py | 2 +- jesse/indicators/sqwma.py | 2 +- jesse/indicators/srwma.py | 2 +- jesse/indicators/supersmoother.py | 2 +- jesse/indicators/supersmoother_3_pole.py | 2 +- jesse/indicators/supertrend.py | 2 +- jesse/indicators/trendflex.py | 2 +- jesse/indicators/vi.py | 2 +- jesse/indicators/vlma.py | 2 +- jesse/indicators/voss.py | 2 +- jesse/indicators/vpwma.py | 2 +- 37 files changed, 38 insertions(+), 38 deletions(-) diff --git a/jesse/indicators/bandpass.py b/jesse/indicators/bandpass.py index 62e20260e..24967cf82 100644 --- a/jesse/indicators/bandpass.py +++ b/jesse/indicators/bandpass.py @@ -46,7 +46,7 @@ def bandpass(candles: np.ndarray, period: int = 20, bandwidth: float = 0.3, sou return BandPass(bp[-1], bp_normalized[-1], signal[-1], trigger[-1]) -@njit +@njit(cache=True) def bp_fast(source, hp, alpha, beta): # Function is compiled to machine code when called the first time bp = np.copy(hp) diff --git a/jesse/indicators/cg.py b/jesse/indicators/cg.py index 2025456de..2c9b6d3b4 100644 --- a/jesse/indicators/cg.py +++ b/jesse/indicators/cg.py @@ -26,7 +26,7 @@ def cg(candles: np.ndarray, period: int = 10, source_type: str = "close", sequen return same_length(candles, res) if sequential else res[-1] -@njit +@njit(cache=True) def go_fast(source, period): # Function is compiled to machine code when called the first time res = np.full_like(source, fill_value=np.nan) for i in range(source.size): diff --git a/jesse/indicators/correlation_cycle.py b/jesse/indicators/correlation_cycle.py index 3ec165e44..cd5d39622 100644 --- a/jesse/indicators/correlation_cycle.py +++ b/jesse/indicators/correlation_cycle.py @@ -39,7 +39,7 @@ def correlation_cycle(candles: np.ndarray, period: int = 20, threshold: int = 9, return CC(realPart[-1], imagPart[-1], angle[-1], state[-1]) -@njit +@njit(cache=True) def go_fast(source, period): # Function is compiled to machine code when called the first time # Correlation Cycle Function PIx2 = 4.0 * np.arcsin(1.0) diff --git a/jesse/indicators/cwma.py b/jesse/indicators/cwma.py index 4cec25768..8117ca18e 100644 --- a/jesse/indicators/cwma.py +++ b/jesse/indicators/cwma.py @@ -31,7 +31,7 @@ def cwma(candles: np.ndarray, period: int = 14, source_type: str = "close", sequ return res if sequential else res[-1] -@njit +@njit(cache=True) def vpwma_fast(source, period): newseries = np.copy(source) for j in range(period + 1, source.shape[0]): diff --git a/jesse/indicators/damiani_volatmeter.py b/jesse/indicators/damiani_volatmeter.py index a1c99340c..eea44cca5 100644 --- a/jesse/indicators/damiani_volatmeter.py +++ b/jesse/indicators/damiani_volatmeter.py @@ -42,7 +42,7 @@ def damiani_volatmeter(candles: np.ndarray, vis_atr: int = 13, vis_std: int = 20 return DamianiVolatmeter(vol[-1], t[-1]) -@njit +@njit(cache=True) def damiani_volatmeter_fast(source, sed_std, atrvis, atrsed, vis_std, threshold): # Function is compiled to machine code when called the first time lag_s = 0.5 diff --git a/jesse/indicators/edcf.py b/jesse/indicators/edcf.py index b9883dc1b..5f92ccb05 100644 --- a/jesse/indicators/edcf.py +++ b/jesse/indicators/edcf.py @@ -31,7 +31,7 @@ def edcf(candles: np.ndarray, period: int = 15, source_type: str = "hl2", sequen return res if sequential else res[-1] -@njit +@njit(cache=True) def edcf_fast(source, period): newseries = np.full_like(source, np.nan) diff --git a/jesse/indicators/efi.py b/jesse/indicators/efi.py index 1d12ff9cb..544908241 100644 --- a/jesse/indicators/efi.py +++ b/jesse/indicators/efi.py @@ -31,7 +31,7 @@ def efi(candles: np.ndarray, period: int = 13, source_type: str = "close", seque return res_with_nan if sequential else res_with_nan[-1] -@njit +@njit(cache=True) def efi_fast(source, volume): dif = np.zeros(source.size - 1) for i in range(1, source.size): diff --git a/jesse/indicators/emd.py b/jesse/indicators/emd.py index 89efc133a..a9e739753 100644 --- a/jesse/indicators/emd.py +++ b/jesse/indicators/emd.py @@ -39,7 +39,7 @@ def emd(candles: np.ndarray, period: int = 20, delta=0.5, fraction=0.1, sequenti return EMD(avg_peak[-1], mean[-1], avg_valley[-1]) -@njit +@njit(cache=True) def bp_fast(price, period, delta): # bandpass filter beta = np.cos(2 * np.pi / period) @@ -55,7 +55,7 @@ def bp_fast(price, period, delta): return bp -@njit +@njit(cache=True) def peak_valley_fast(bp, price): peak = np.copy(bp) valley = np.copy(bp) diff --git a/jesse/indicators/epma.py b/jesse/indicators/epma.py index 1fd7b7a75..605c54db8 100644 --- a/jesse/indicators/epma.py +++ b/jesse/indicators/epma.py @@ -32,7 +32,7 @@ def epma(candles: np.ndarray, period: int = 11, offset: int = 4, source_type: st return res if sequential else res[-1] -@njit +@njit(cache=True) def epma_fast(source, period, offset): newseries = np.copy(source) for j in range(period + offset + 1 , source.shape[0]): diff --git a/jesse/indicators/frama.py b/jesse/indicators/frama.py index a300cef02..92b05005d 100644 --- a/jesse/indicators/frama.py +++ b/jesse/indicators/frama.py @@ -36,7 +36,7 @@ def frama(candles: np.ndarray, window: int = 10, FC: int = 1, SC: int = 300, seq return res[-1] -@njit +@njit(cache=True) def frame_fast(candles, n, SC, FC): w = np.log(2.0 / (SC + 1)) diff --git a/jesse/indicators/gauss.py b/jesse/indicators/gauss.py index 0a64aae15..820b97b2b 100644 --- a/jesse/indicators/gauss.py +++ b/jesse/indicators/gauss.py @@ -36,7 +36,7 @@ def gauss(candles: np.ndarray, period: int = 14, poles: int = 4, source_type: st return res if sequential else res[-1] -@njit +@njit(cache=True) def gauss_fast(source, period, poles): N = source.size source = source[~np.isnan(source)] diff --git a/jesse/indicators/heikin_ashi_candles.py b/jesse/indicators/heikin_ashi_candles.py index 4b2e533a0..a66955ff9 100755 --- a/jesse/indicators/heikin_ashi_candles.py +++ b/jesse/indicators/heikin_ashi_candles.py @@ -24,7 +24,7 @@ def heikin_ashi_candles(candles: np.ndarray, sequential: bool = False) -> HA: else: return HA(open[-1], close[-1], high[-1], low[-1]) -@njit +@njit(cache=True) def ha_fast(source): # index consts to facilitate reading the code diff --git a/jesse/indicators/high_pass.py b/jesse/indicators/high_pass.py index e4e3f4122..55c1f6feb 100644 --- a/jesse/indicators/high_pass.py +++ b/jesse/indicators/high_pass.py @@ -33,7 +33,7 @@ def high_pass(candles: np.ndarray, period: int = 48, source_type: str = "close", return None if np.isnan(hpf[-1]) else hpf[-1] -@njit +@njit(cache=True) def high_pass_fast(source, period): # Function is compiled to machine code when called the first time k = 1 alpha = 1 + (np.sin(2 * np.pi * k / period) - 1) / np.cos(2 * np.pi * k / period) diff --git a/jesse/indicators/high_pass_2_pole.py b/jesse/indicators/high_pass_2_pole.py index f00eae1b4..a9d3c16bd 100644 --- a/jesse/indicators/high_pass_2_pole.py +++ b/jesse/indicators/high_pass_2_pole.py @@ -34,7 +34,7 @@ def high_pass_2_pole(candles: np.ndarray, period: int = 48, source_type: str = " return None if np.isnan(hpf[-1]) else hpf[-1] -@njit +@njit(cache=True) def high_pass_2_pole_fast(source, period, K=0.707): # Function is compiled to machine code when called the first time alpha = 1 + (np.sin(2 * np.pi * K / period) - 1) / np.cos(2 * np.pi * K / period) newseries = np.copy(source) diff --git a/jesse/indicators/hurst_exponent.py b/jesse/indicators/hurst_exponent.py index b30feeb12..41400bb5d 100644 --- a/jesse/indicators/hurst_exponent.py +++ b/jesse/indicators/hurst_exponent.py @@ -37,7 +37,7 @@ def hurst_exponent(candles: np.ndarray, min_chunksize: int = 8, max_chunksize: i return None if np.isnan(h) else h -@njit +@njit(cache=True) def hurst_rs(x, min_chunksize, max_chunksize, num_chunksize): """Estimate the Hurst exponent using R/S method. Estimates the Hurst (H) exponent using the R/S method from the time series. diff --git a/jesse/indicators/hwma.py b/jesse/indicators/hwma.py index 26acf70f5..e25366926 100644 --- a/jesse/indicators/hwma.py +++ b/jesse/indicators/hwma.py @@ -37,7 +37,7 @@ def hwma(candles: np.ndarray, na: float = 0.2, nb: float = 0.1, nc: float = 0.1, return res if sequential else res[-1] -@njit +@njit(cache=True) def hwma_fast(source, na, nb, nc): last_a = last_v = 0 last_f = source[0] diff --git a/jesse/indicators/itrend.py b/jesse/indicators/itrend.py index 01c8f6c9f..85c3a1279 100644 --- a/jesse/indicators/itrend.py +++ b/jesse/indicators/itrend.py @@ -31,7 +31,7 @@ def itrend(candles: np.ndarray, alpha: float = 0.07, source_type: str = "hl2", s return ITREND(signal[-1], it[-1], trigger[-1]) -@njit +@njit(cache=True) def itrend_fast(source, alpha): it = np.copy(source) for i in range(2, 7): diff --git a/jesse/indicators/jma.py b/jesse/indicators/jma.py index c997e4925..5eec83901 100644 --- a/jesse/indicators/jma.py +++ b/jesse/indicators/jma.py @@ -28,7 +28,7 @@ def jma(candles: np.ndarray, period:int=7, phase:float=50, power:int=2, source_t return res if sequential else res[-1] -@njit +@njit(cache=True) def jma_helper(src, phaseRatio, beta, alpha): jma_val = np.copy(src) diff --git a/jesse/indicators/lrsi.py b/jesse/indicators/lrsi.py index 08c0f05dd..a013ed0ff 100644 --- a/jesse/indicators/lrsi.py +++ b/jesse/indicators/lrsi.py @@ -26,7 +26,7 @@ def lrsi(candles: np.ndarray, alpha: float = 0.2, sequential: bool = False) -> U return None if np.isnan(rsi[-1]) else rsi[-1] -@njit +@njit(cache=True) def lrsi_fast(alpha, candles): price = (candles[:, 3] + candles[:, 4]) / 2 l0 = np.copy(price) diff --git a/jesse/indicators/maaq.py b/jesse/indicators/maaq.py index 96cec8d28..fff64da5c 100644 --- a/jesse/indicators/maaq.py +++ b/jesse/indicators/maaq.py @@ -48,7 +48,7 @@ def maaq(candles: np.ndarray, period: int = 11, fast_period: int = 2, slow_perio return res if sequential else res[-1] -@njit +@njit(cache=True) def maaq_fast(source, temp, period): newseries = np.copy(source) for i in range(period, source.shape[0]): diff --git a/jesse/indicators/mcginley_dynamic.py b/jesse/indicators/mcginley_dynamic.py index 7f3c5ab99..2eeccb239 100644 --- a/jesse/indicators/mcginley_dynamic.py +++ b/jesse/indicators/mcginley_dynamic.py @@ -33,7 +33,7 @@ def mcginley_dynamic(candles: np.ndarray, period: int = 10, k: float = 0.6, sour return mg if sequential else mg[-1] -@njit +@njit(cache=True) def md_fast(source, k, period): mg = np.full_like(source, np.nan) for i in range(source.size): diff --git a/jesse/indicators/mwdx.py b/jesse/indicators/mwdx.py index e4c7ad064..5e4de2ff5 100644 --- a/jesse/indicators/mwdx.py +++ b/jesse/indicators/mwdx.py @@ -34,7 +34,7 @@ def mwdx(candles: np.ndarray, factor: float = 0.2, source_type: str = "close", s return res if sequential else res[-1] -@njit +@njit(cache=True) def mwdx_fast(source, fac): newseries = np.copy(source) for i in range(1, source.shape[0]): diff --git a/jesse/indicators/nma.py b/jesse/indicators/nma.py index 8a5153dd0..7c47e156b 100644 --- a/jesse/indicators/nma.py +++ b/jesse/indicators/nma.py @@ -29,7 +29,7 @@ def nma(candles: np.ndarray, period: int = 40, source_type: str = "close", seque return res if sequential else res[-1] -@njit +@njit(cache=True) def nma_fast(source, period): # Ensure source values are positive before taking log source = np.clip(source, a_min=1e-10, a_max=None) diff --git a/jesse/indicators/pma.py b/jesse/indicators/pma.py index 6a93a04a4..5d7c097b8 100644 --- a/jesse/indicators/pma.py +++ b/jesse/indicators/pma.py @@ -33,7 +33,7 @@ def pma(candles: np.ndarray, source_type: str = "hl2", sequential: bool = False) return PMA(predict[-1], trigger[-1]) -@njit +@njit(cache=True) def pma_fast(source): predict = np.full_like(source, np.nan) trigger = np.full_like(source, np.nan) diff --git a/jesse/indicators/reflex.py b/jesse/indicators/reflex.py index 29bc17c92..4a4a39aca 100644 --- a/jesse/indicators/reflex.py +++ b/jesse/indicators/reflex.py @@ -37,7 +37,7 @@ def reflex(candles: np.ndarray, period: int = 20, source_type: str = "close", se return None if np.isnan(rf[-1]) else rf[-1] -@njit +@njit(cache=True) def reflex_fast(ssf, period): rf = np.full_like(ssf, 0) ms = np.full_like(ssf, 0) diff --git a/jesse/indicators/rma.py b/jesse/indicators/rma.py index f4756bcee..2494edb15 100644 --- a/jesse/indicators/rma.py +++ b/jesse/indicators/rma.py @@ -34,7 +34,7 @@ def rma(candles: np.ndarray, length: int = 14, source_type="close", sequential=F return res if sequential else res[-1] -@njit +@njit(cache=True) def rma_fast(source, _length): alpha = 1 / _length newseries = np.copy(source) diff --git a/jesse/indicators/rsx.py b/jesse/indicators/rsx.py index 8b6aa44ba..f95bc8deb 100644 --- a/jesse/indicators/rsx.py +++ b/jesse/indicators/rsx.py @@ -26,7 +26,7 @@ def rsx(candles: np.ndarray, period: int = 14, source_type: str = "close", seque return res if sequential else res[-1] -@njit +@njit(cache=True) def rsx_fast(source, period): # variables f0 = 0 diff --git a/jesse/indicators/sqwma.py b/jesse/indicators/sqwma.py index aea84d1ca..af8b78c25 100644 --- a/jesse/indicators/sqwma.py +++ b/jesse/indicators/sqwma.py @@ -31,7 +31,7 @@ def sqwma(candles: np.ndarray, period: int = 14, source_type: str = "close", seq return res if sequential else res[-1] -@njit +@njit(cache=True) def sqwma_fast(source, period): newseries = np.copy(source) for j in range(period + 1, source.shape[0]): diff --git a/jesse/indicators/srwma.py b/jesse/indicators/srwma.py index 985821bf6..e42b69b9f 100644 --- a/jesse/indicators/srwma.py +++ b/jesse/indicators/srwma.py @@ -31,7 +31,7 @@ def srwma(candles: np.ndarray, period: int = 14, source_type: str = "close", seq return res if sequential else res[-1] -@njit +@njit(cache=True) def srwma_fast(source, period): newseries = np.copy(source) for j in range(period + 1, source.shape[0]): diff --git a/jesse/indicators/supersmoother.py b/jesse/indicators/supersmoother.py index 49582c274..ca1227aac 100644 --- a/jesse/indicators/supersmoother.py +++ b/jesse/indicators/supersmoother.py @@ -33,7 +33,7 @@ def supersmoother(candles: np.ndarray, period: int = 14, source_type: str = "clo return res if sequential else res[-1] -@njit +@njit(cache=True) def supersmoother_fast(source, period): a = np.exp(-1.414 * np.pi / period) b = 2 * a * np.cos(1.414 * np.pi / period) diff --git a/jesse/indicators/supersmoother_3_pole.py b/jesse/indicators/supersmoother_3_pole.py index c2703e05e..bde8d988c 100644 --- a/jesse/indicators/supersmoother_3_pole.py +++ b/jesse/indicators/supersmoother_3_pole.py @@ -37,7 +37,7 @@ def supersmoother_3_pole(candles: np.ndarray, period: int = 14, source_type: str return res if sequential else res[-1] -@njit +@njit(cache=True) def supersmoother_fast(source, period): a = np.exp(-np.pi / period) b = 2 * a * np.cos(1.738 * np.pi / period) diff --git a/jesse/indicators/supertrend.py b/jesse/indicators/supertrend.py index 4813ecbe4..faa32237b 100644 --- a/jesse/indicators/supertrend.py +++ b/jesse/indicators/supertrend.py @@ -32,7 +32,7 @@ def supertrend(candles: np.ndarray, period: int = 10, factor: float = 3, sequent return SuperTrend(super_trend[-1], changed[-1]) -@njit +@njit(cache=True) def supertrend_fast(candles, atr, factor, period): # Calculation of SuperTrend upper_basic = (candles[:, 3] + candles[:, 4]) / 2 + (factor * atr) diff --git a/jesse/indicators/trendflex.py b/jesse/indicators/trendflex.py index 7659c4e00..0daaf2160 100644 --- a/jesse/indicators/trendflex.py +++ b/jesse/indicators/trendflex.py @@ -38,7 +38,7 @@ def trendflex(candles: np.ndarray, period: int = 20, source_type: str = "close", return None if np.isnan(tf[-1]) else tf[-1] -@njit +@njit(cache=True) def trendflex_fast(ssf, period): tf = np.full_like(ssf, 0) ms = np.full_like(ssf, 0) diff --git a/jesse/indicators/vi.py b/jesse/indicators/vi.py index c8a88310b..2f956e655 100644 --- a/jesse/indicators/vi.py +++ b/jesse/indicators/vi.py @@ -28,7 +28,7 @@ def vi(candles: np.ndarray, period: int = 14, sequential: bool = False) -> VI: return VI(vpn_with_nan[-1], vmn_with_nan[-1]) -@njit +@njit(cache=True) def vi_fast(candles, period): candles_close = candles[:, 2] candles_high = candles[:, 3] diff --git a/jesse/indicators/vlma.py b/jesse/indicators/vlma.py index 2be732482..5dc5e84e0 100644 --- a/jesse/indicators/vlma.py +++ b/jesse/indicators/vlma.py @@ -52,7 +52,7 @@ def vlma(candles: np.ndarray, min_period: int = 5, max_period: int = 50, matype: return res if sequential else res[-1] -@njit +@njit(cache=True) def vlma_fast(source, a, b, c, d, min_period, max_period): newseries = np.copy(source) period = np.zeros_like(source) diff --git a/jesse/indicators/voss.py b/jesse/indicators/voss.py index 4a7602cc2..8e1e26f0d 100644 --- a/jesse/indicators/voss.py +++ b/jesse/indicators/voss.py @@ -34,7 +34,7 @@ def voss(candles: np.ndarray, period: int = 20, predict: int = 3, bandwith: floa return VossFilter(voss_val[-1], filt[-1]) -@njit +@njit(cache=True) def voss_fast(source, period, predict, bandwith): voss = np.full_like(source, 0) filt = np.full_like(source, 0) diff --git a/jesse/indicators/vpwma.py b/jesse/indicators/vpwma.py index 5256b33c1..1a11af041 100644 --- a/jesse/indicators/vpwma.py +++ b/jesse/indicators/vpwma.py @@ -32,7 +32,7 @@ def vpwma(candles: np.ndarray, period: int = 14, power: float = 0.382, source_ty return res if sequential else res[-1] -@njit +@njit(cache=True) def vpwma_fast(source, period, power): newseries = np.copy(source) for j in range(period + 1, source.shape[0]):