-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
My TALIB/FINTA wrapper (2nd gift) #400
pliciwebstephane
started this conversation in
Show and tell
-
Hello,
This is my talib / finta wrapper to access easily to MA, EMA, KAMA, etc.
import pandas
import talib
import sys
# pip install finta
from finta import TA
# Available MA
# listed on : https://github.com/peerchemist/finta#supported-indicators
# And : https://github.com/mrjbq7/ta-lib#overlap-studies
def build(function_name, n, values):
talib_available_func = talib.get_functions()
if function_name in talib_available_func:
close = pandas.Series(values.Close)
talib_ma = getattr(talib, function_name)
if (function_name == 'HT_TRENDLINE' ):
return talib_ma(close)
return talib_ma(close, timeperiod=n)
elif hasattr(TA, function_name):
finta_ma = getattr(TA, function_name)
# print(values)
test = pandas.DataFrame()
test['time'] = values.Time
test['open'] = values.Open
test['close'] = values.Close
test['high'] = values.High
test['low'] = values.Low
test['volume'] = values.Volume
return finta_ma(test, n)
print('MA "', function_name ,'" not finded in FINTA or TALIB')
sys.exit()
Tell me if this code help
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 2
Replies: 1 comment
-
Is Finta better than TA-Lib and Pandas-TA? It has less indicators but would the speed be the tradeoff?
Beta Was this translation helpful? Give feedback.
All reactions
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment