joosthoeks / jhTAlib

Technical Analysis Library Time-Series
https://joosthoeks.github.io/jhTAlib/
GNU General Public License v3.0
152 stars 44 forks source link

Add column names as default arguments for all methods #12

Closed KIC closed 4 years ago

KIC commented 5 years ago

Is your feature request related to a problem? Please describe. Often I need to apply indicators on other columns then the usual. Since all columns a re hard coded I simply can not which is a pity. Here is an example

def AVGPRICE(df):
    """
    Average Price
    """
    avgprice_list = []
    i = 0
    while i < len(df['Close']):
        avgprice = (df['Open'][i] + df['High'][i] + df['Low'][i] + df['Close'][i]) / 4
        avgprice_list.append(avgprice)
        i += 1
    return avgprice_list

Describe the solution you'd like Simply adding the column names as parameters with defaults would not change the current behavior but I would have the ability to use different columns:

def AVGPRICE(df, open='open', high='high', low='low', close='close'):

Describe alternatives you've considered Currently I am forced to use plain talib functions which depend on the C library but I would prefer yours.

joosthoeks commented 5 years ago

Done