Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

My TALIB/FINTA wrapper (2nd gift) #400

pliciwebstephane started this conversation in Show and tell
Discussion options

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

You must be logged in to vote

Replies: 1 comment

Comment options

Is Finta better than TA-Lib and Pandas-TA? It has less indicators but would the speed be the tradeoff?

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /