Skip to content

Commit a1e92f3

Browse files
authored
Merge pull request #174 from freqtrade/remove_pyti
Remove pyti
2 parents 75696f3 + 77f69ef commit a1e92f3

File tree

7 files changed

+8
-42
lines changed

7 files changed

+8
-42
lines changed

requirements.txt

-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
11
TA-Lib==0.4.19
2-
pyti==0.2.2
32
pandas==1.2.3
4-
ccxt>=1.18.500
53
arrow==1.0.3
6-
# keras
74
# matplotlib
8-
# tensorflow - install if no gpu
9-
# tensorflow-gpu - install if gpu

setup.py

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
tests_require=['pytest', 'pytest-cov', 'pytest-mock'],
3030
install_requires=[
3131
'TA-Lib',
32-
'pyti',
3332
'pandas',
3433
'arrow',
3534
],

technical/consensus/consensus.py

+4-10
Original file line numberDiff line numberDiff line change
@@ -450,12 +450,11 @@ def evaluate_cci(self, period=20, prefix="cci", impact_buy=1, impact_sell=1, sel
450450
:param prefix:
451451
:return:
452452
"""
453-
from technical.indicators import cci
454453

455454
self._weights(impact_buy, impact_sell)
456455
dataframe = self.dataframe
457456
name = '{}_{}'.format(prefix, period)
458-
dataframe[name] = cci(dataframe, period)
457+
dataframe[name] = ta.CCI(dataframe, timeperiod=period)
459458

460459
dataframe.loc[
461460
(
@@ -539,12 +538,10 @@ def evaluate_cmo(self, period=20, prefix="cmo", impact_buy=1, impact_sell=1):
539538
:param prefix:
540539
:return:
541540
"""
542-
from technical.indicators import cmo
543-
544541
self._weights(impact_buy, impact_sell)
545542
dataframe = self.dataframe
546543
name = '{}_{}'.format(prefix, period)
547-
dataframe[name] = cmo(dataframe, period)
544+
dataframe[name] = ta.CMO(dataframe, timeperiod=period)
548545

549546
dataframe.loc[
550547
(
@@ -608,12 +605,10 @@ def evaluate_ultimate_oscilator(self, prefix="uo", impact_buy=1, impact_sell=1):
608605
:param prefix:
609606
:return:
610607
"""
611-
from technical.indicators import ultimate_oscilator
612-
613608
self._weights(impact_buy, impact_sell)
614609
dataframe = self.dataframe
615610
name = '{}'.format(prefix)
616-
dataframe[name] = ultimate_oscilator(dataframe)
611+
dataframe[name] = ta.ULTOSC(dataframe)
617612

618613
dataframe.loc[
619614
(
@@ -666,12 +661,11 @@ def evaluate_momentum(self, period=20, prefix="momentum", impact_buy=1, impact_s
666661
:param prefix:
667662
:return:
668663
"""
669-
from technical.indicators import momentum
670664

671665
self._weights(impact_buy, impact_sell)
672666
dataframe = self.dataframe
673667
name = '{}_{}'.format(prefix, period)
674-
dataframe[name] = momentum(dataframe, 'close', period)
668+
dataframe[name] = ta.MOM(dataframe, timeperiod=period)
675669

676670
dataframe.loc[
677671
(

technical/indicators/indicators.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,6 @@ def vfi(dataframe, length=130, coef=0.2, vcoef=2.5, signalLength=5, smoothVFI=Fa
617617

618618
import talib as ta
619619
from numpy import where
620-
from pyti.simple_moving_average import simple_moving_average as sma
621620

622621
length = length
623622
coef = coef
@@ -631,7 +630,7 @@ def vfi(dataframe, length=130, coef=0.2, vcoef=2.5, signalLength=5, smoothVFI=Fa
631630
df['vinter'] = df['inter'].rolling(30).std(ddof=0)
632631
df['cutoff'] = (coef * df['vinter'] * df['close'])
633632
# Vave is to be calculated on volume of the past bar
634-
df['vave'] = sma(df['volume'].shift(+1), length)
633+
df['vave'] = ta.SMA(df['volume'].shift(+1), timeperiod=length)
635634
df['vmax'] = df['vave'] * vcoef
636635
df['vc'] = where((df['volume'] < df['vmax']), df['volume'], df['vmax'])
637636
df['mf'] = df['hlc'] - df['hlc'].shift(+1)
@@ -649,7 +648,7 @@ def vcp(x):
649648
# vfi has a smooth option passed over def call, sma if set
650649
df['vfi'] = (df['vcp'].rolling(length).sum()) / df['vave']
651650
if smoothVFI is True:
652-
df['vfi'] = sma(df['vfi'], 3)
651+
df['vfi'] = ta.SMA(df['vfi'], timeperiod=3)
653652
df['vfima'] = ta.EMA(df['vfi'], signalLength)
654653
df['vfi_hist'] = df['vfi'] - df['vfima']
655654

technical/indicators/momentum.py

-16
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,8 @@
1818
# BOP Balance Of Power
1919

2020
# CCI Commodity Channel Index
21-
def cci(dataframe, period) -> ndarray:
22-
from pyti.commodity_channel_index import commodity_channel_index
23-
24-
return commodity_channel_index(dataframe['close'], dataframe['high'], dataframe['low'], period)
25-
2621

2722
# CMO Chande Momentum Oscillator
28-
def cmo(dataframe, period, field='close') -> ndarray:
29-
from pyti.chande_momentum_oscillator import chande_momentum_oscillator
30-
return chande_momentum_oscillator(dataframe[field], period)
31-
3223

3324
# DX Directional Movement Index
3425
# MACD Moving Average Convergence/Divergence
@@ -39,10 +30,6 @@ def cmo(dataframe, period, field='close') -> ndarray:
3930
# MINUS_DM Minus Directional Movement
4031

4132
# MOM Momentum
42-
def momentum(dataframe, field='close', period=9):
43-
from pyti.momentum import momentum as m
44-
return m(dataframe[field], period)
45-
4633

4734
# PLUS_DI Plus Directional Indicator
4835
# PLUS_DM Plus Directional Movement
@@ -58,9 +45,6 @@ def momentum(dataframe, field='close', period=9):
5845
# TRIX 1-day Rate-Of-Change (ROC) of a Triple Smooth EMA
5946

6047
# ULTOSC Ultimate Oscillator
61-
def ultimate_oscilator(dataframe):
62-
from pyti.ultimate_oscillator import ultimate_oscillator as uo
63-
uo(dataframe['close'], dataframe['low'])
6448

6549

6650
# WILLR Williams' %R

technical/indicators/overlap_studies.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def tema(dataframe, period, field='close'):
6868

6969
# Other Overlap Studies Functions
7070
def hull_moving_average(dataframe, period, field='close') -> ndarray:
71-
from pyti.hull_moving_average import hull_moving_average as hma
71+
# TODO: Remove this helper method, it's a 1:1 call to qtpylib's HMA.
72+
from technical.qtpylib import hma
7273
return hma(dataframe[field], period)
7374

7475

technical/indicators/volume_indicators.py

-6
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@
1212

1313
# AD Chaikin A/D Line
1414

15-
def accumulation_distribution(dataframe) -> ndarray:
16-
from pyti.accumulation_distribution import accumulation_distribution as acd
17-
18-
return acd(dataframe['close'], dataframe['high'], dataframe['low'], dataframe['volume'])
19-
20-
2115
# ADOSC Chaikin A/D Oscillator
2216
# OBV On Balance Volume
2317

0 commit comments

Comments
 (0)