A tool to predict when to buy or sell stocks
Project description
# cuansignal: Signal Indicator to Buy / Sell Stock
Bismillaahirrahmaanirrahiim. cuansignal is a library that contains several functions to predict and provide signals to buy and sell stocks. There are several indicators included in this library. In the initial version, there are four functions, namely Double Exponential Moving Average, Bollinger Band, Stochastics and Relative Strength Index. More functions will be added in the next edition. We welcome input and critics.
## Function ### Double Exponential Moving Average (dEMA) cuansignal.dEMA(df, base, short, long) df = data to be analyzed, with format [‘Open’, ‘High’, ‘Low’, ‘Close’, ‘Adj Close’, ‘Volume’] base = parameter on which the EMA calculation is based, for example ‘Close’, or ‘Adj Close’, or something else short = the first EMA period used in the model (which is shorter) long = the second EMA period used in the model (which is longer) The resulting output is a DataFrame
>>> import yfinance as yf >>> from cuansignal import signals as cs >>> data = yf.download('AAPL', start='2018-01-01', end='2020-08-01') >>> result = cs.dEMA(data, base='Close', short=10, long=100)
### Bollinger Band (bband) cuansignal.bband(df, base, period, std) df = data to be analyzed, with format [‘Open’, ‘High’, ‘Low’, ‘Close’, ‘Adj Close’, ‘Volume’] base = parameter that is the basis for calculating Simple MA, for example ‘Close’, or ‘Adj Close’, or others period = length of the period to be used in calculating the value of Simple MA and Standard Deviation std = standard deviation multiplier The resulting output is a DataFrame
>>> import yfinance as yf >>> from cuansignal import signals as cs >>> data = yf.download('AAPL', start='2018-01-01', end='2020-08-01') >>> result = cs.bband(data, base='Close', period=30, std=2)
### Relative Strength Index cuansignal.rsi(df, base, EMA, MA, RSI) df = data to be analyzed, with format [‘Open’, ‘High’, ‘Low’, ‘Close’, ‘Adj Close’, ‘Volume’] base = parameter on which the RSI calculation is based, for example ‘Close’, or ‘Adj Close’, or something else EMA = the length of the period to be used in calculating the EMA value for the Average Up and Down periods MA = the length of the MA period which is the cut-of buying signal RSI = RSI value which is the reference for buying signal The resulting output is a DataFrame
>>> import yfinance as yf >>> from cuansignal import signals as cs >>> data = yf.download('AAPL', start='2018-01-01', end='2020-08-01') >>> result = cs.rsi(data, base='Close', EMA=11, MA=200, RSI=30)
### Stochastics cuansignal.stoch(df, period, period2, high, low) df = data to be analyzed, with format [‘Open’, ‘High’, ‘Low’, ‘Close’, ‘Adj Close’, ‘Volume’] period = the length of the period to be used in calculating the value of %K period2 = the length of the period to be used in calculating the value of %D high = high limit value which becomes the cut-of buying/selling signal low = low limit value which becomes the cut-of buying/selling signal The resulting output is a DataFrame
>>> import yfinance as yf >>> from cuansignal import signals as cs >>> data = yf.download('AAPL', start='2018-01-01', end='2020-08-01')
Change Log
1.0.0 (18/08/2021)
Adding four indicators : 1. Dual Exponential Moving Average (dEMA) 2. Bollinger Band (bband) 3. Relative Strenght Index (rsi) 4. Stochastic (stoch)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.