From 0d895d980606dafde267baf134d90869e3c5b20e Mon Sep 17 00:00:00 2001 From: ahmetax Date: Sun, 20 Nov 2022 19:33:39 +0300 Subject: [PATCH 1/3] addition of siiv indicator --- README.md | 45 ++++++++++++++++++++++++++ app/.gitignore | 2 ++ app/analysis.py | 1 + app/analyzers/indicators/__init__.py | 1 + app/analyzers/indicators/siiv.py | 47 ++++++++++++++++++++++++++++ app/defaults.yml | 23 ++++++++++++++ 6 files changed, 119 insertions(+) create mode 100644 app/analyzers/indicators/siiv.py diff --git a/README.md b/README.md index be368b93..b6e4127d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Development branch to testing new features. This develop version has a lot of im - New indicator StochRSI Cross - New indicator Sqzmon - Squeeze Momentum Indicator - New option to customize ichimoku strategies and added chikou span +- New indicator siiv (Signed Increase In Volume) It is a slightly revised version of iiv. It shows the direction of price chage also. ## Installing And Running @@ -371,6 +372,50 @@ indicators: Of course, this indicator can be used in other candle periods, 15m, 1h.. etc. +#### Signed Increase In Volume indicator - siiv + +There is a new indicator called "siiv". It is a slightly revise "iiv" indicator. The hot value is 10 by default, and cold value is -10. This value is a measure about how strong is the increase in volume in the direction of the price change. + +The main idea is to try to identify a possible pump or dump. + +``` +indicators: + siiv: + - enabled: false + alert_enabled: true + alert_frequency: always + signal: + - siiv + hot: 10 + cold: -10 + hot_label: ' Increase in Volume Uptrend' + cold_label: ' Increase in Volume Downtrend' + candle_period: 5m + chart: true + - enabled: true + alert_enabled: true + alert_frequency: always + signal: + - siiv + hot: 10 + cold: -10 + hot_label: ' Increase in Volume Uptrend' + cold_label: ' Increase in Volume Downtrend' + candle_period: 15m + chart: true +``` + +If you don't want to receive such notifications just disable the iiv indicator in your config file. + +``` +indicators: + siiv: + - enabled: false + candle_period: 15m +``` + +Of course, this indicator can be used in other candle periods, 5m, 1h.. etc. + #### Moving Average Ribbon First, read the following link to know about what it is: diff --git a/app/.gitignore b/app/.gitignore index 0d59ea18..2a527961 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -2,3 +2,5 @@ config.json __pycache__ *.pyc venv +config.yml + diff --git a/app/analysis.py b/app/analysis.py index 2a7bc799..710ca08b 100644 --- a/app/analysis.py +++ b/app/analysis.py @@ -41,6 +41,7 @@ def indicator_dispatcher(self): 'stoch_rsi': stoch_rsi.StochasticRSI().analyze, 'obv': obv.OBV().analyze, 'iiv': iiv.IIV().analyze, + 'siiv': siiv.SIIV().analyze, 'ma_ribbon': ma_ribbon.MARibbon().analyze, 'ma_crossover': ma_crossover.MACrossover().analyze, 'bollinger': bollinger.Bollinger().analyze, diff --git a/app/analyzers/indicators/__init__.py b/app/analyzers/indicators/__init__.py index 6a3fe7c5..a815e96f 100644 --- a/app/analyzers/indicators/__init__.py +++ b/app/analyzers/indicators/__init__.py @@ -11,6 +11,7 @@ 'mfi', 'obv', 'iiv', + 'siiv', 'ma_ribbon', 'ma_crossover', 'bollinger', diff --git a/app/analyzers/indicators/siiv.py b/app/analyzers/indicators/siiv.py new file mode 100644 index 00000000..fbdc46b5 --- /dev/null +++ b/app/analyzers/indicators/siiv.py @@ -0,0 +1,47 @@ +""" Custom Indicator Increase In Volume +""" + +import numpy as np +from scipy import stats + +from analyzers.utils import IndicatorUtils + +""" +name: ahmet aksoy +date: 2022-11-20 +siiv: Signed Increase In Volume +""" +class SIIV(IndicatorUtils): + def analyze(self, historical_data, signal=['siiv'], hot_thresh=10, cold_thresh=-10): + """Performs an analysis about the increase in volumen on the historical data + + Args: + historical_data (list): A matrix of historical OHCLV data. + signal (list, optional): Defaults to siiv. The indicator line to check hot against. + hot_thresh (float, optional): Defaults to 10. + cold_thresh: Unused + + + Returns: + pandas.DataFrame: A dataframe containing the indicator and hot/cold values. + """ + + dataframe = self.convert_to_dataframe(historical_data) + + z = np.abs(stats.zscore(dataframe['volume'])) + filtered = dataframe.volume[(z < 3)] + + previous_mean = filtered.mean() + price_change = dataframe.close[-1] - dataframe.close[-2] + + if price_change>=0: + dataframe[signal[0]] = dataframe['volume'] / previous_mean + else: + dataframe[signal[0]] = -dataframe['volume'] / previous_mean + + dataframe['is_hot'] = False + dataframe['is_cold'] = False + dataframe['is_hot'] = dataframe[signal[0]] >= hot_thresh + dataframe['is_cold'] = dataframe[signal[0]] <= cold_thresh + + return dataframe diff --git a/app/defaults.yml b/app/defaults.yml index 2eaa1cad..54541408 100644 --- a/app/defaults.yml +++ b/app/defaults.yml @@ -141,6 +141,29 @@ indicators: hot: 5 cold: 0 candle_period: 5m + siiv: # working + - enabled: false + alert_enabled: true + alert_frequency: always + signal: + - siiv + hot: 10 + cold: -10 + hot_label: ' Increase in Volume Uptrend' + cold_label: ' Increase in Volume Downtrend' + candle_period: 5m + chart: true + - enabled: true + alert_enabled: true + alert_frequency: always + signal: + - siiv + hot: 10 + cold: -10 + hot_label: ' Increase in Volume Uptrend' + cold_label: ' Increase in Volume Downtrend' + candle_period: 15m + chart: true informants: lrsi: - enabled: true From 146ff4e23a59c54b7c736917753182ba693167e4 Mon Sep 17 00:00:00 2001 From: ahmetax Date: Sun, 20 Nov 2022 20:23:55 +0300 Subject: [PATCH 2/3] sample-config.yml example file --- app/sample-config.yml | 301 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 301 insertions(+) create mode 100644 app/sample-config.yml diff --git a/app/sample-config.yml b/app/sample-config.yml new file mode 100644 index 00000000..7a6ac5a5 --- /dev/null +++ b/app/sample-config.yml @@ -0,0 +1,301 @@ +# crypto-signal - Daily MACD Crossover Signal + +# Copy this file to config.yml to get started and then add your own configuration. +# Full documentation here: https://github.com/CryptoSignal/crypto-signal/blob/master/docs/config.md + +settings: + log_mode: standard + log_level: INFO + # output_mode: cli #deprecated + output_mode: cli # csj , json + update_interval: 900 + enable_charts: true + alert_enabled: true + market_pairs: null +exchanges: + binance: + required: + enabled: true + all_pairs: + - USDT +indicators: + momentum: + - enabled: false + alert_enabled: true + alert_frequency: once + signal: + - momentum + hot: 0 + cold: 0 + candle_period: 1d + period_count: 10 + mfi: + - enabled: false + alert_enabled: true + alert_frequency: once + signal: + - mfi + hot: 0 + cold: 0 + candle_period: 1d + period_count: 10 + obv: + - enabled: false + alert_enabled: true + alert_frequency: once + signal: + - obv + hot: 0 + cold: 0 + candle_period: 1d + rsi: + - enabled: true + alert_enabled: true + alert_frequency: once + signal: + - rsi + hot: 20 + cold: 80 + hot_label: '(BUY) Uptrend' + cold_label: '(SELL) Downtrend' + candle_period: 1d + period_count: 14 + stoch_rsi: + - enabled: false + alert_enabled: true + alert_frequency: once + signal: + - stoch_rsi + hot: 20 + cold: 80 + hot_label: '(BUY) Uptrend' + cold_label: '(SELL) Downtrend' + candle_period: 1d + period_count: 14 + macd: + - enabled: false + alert_enabled: true + alert_frequency: once + signal: + - macd + hot: 0 + cold: 0 + hot_label: '(BUY) Uptrend' + cold_label: '(SELL) Downtrend' + candle_period: 1d + - enabled: false + alert_enabled: true + alert_frequency: once + signal: + - macdsignal + hot: 0 + cold: 0 + hot_label: '(BUY) Uptrend' + cold_label: '(SELL) Downtrend' + candle_period: 2h + mute_cold: false + ichimoku: + - enabled: false + alert_enabled: true + alert_frequency: once + signal: + - leading_span_a + - leading_span_b + - tenkansen + - kijunsen + hot: true + cold: true + hot_label: '(BUY) Uptrend' + cold_label: '(SELL) Downtrend' + candle_period: 1d + adx: + - enabled: false + alert_enabled: true + alert_frequency: always + signal: + - adx + - pdi + - ndi + hot: 50 + cold: 25 + hot_label: 'Strong trend' + cold_label: 'Weak trend' + candle_period: 1d + period_count: 14 + mute_cold: true + iiv: + - enabled: false + alert_enabled: true + alert_frequency: always + signal: + - iiv + hot: 10 + cold: 0 + hot_label: ' Increase in Volume' + candle_period: 5m + chart: true + - enabled: false + alert_enabled: true + alert_frequency: always + signal: + - iiv + hot: 10 + cold: 0 + hot_label: ' Increase in Volume' + candle_period: 15m + chart: true + siiv: + - enabled: false + alert_enabled: true + alert_frequency: always + signal: + - siiv + hot: 10 + cold: -10 + hot_label: ' Increase in Volume Uptrend' + cold_label: ' Increase in Volume Downtrend' + candle_period: 5m + chart: true + - enabled: true + alert_enabled: true + alert_frequency: always + signal: + - siiv + hot: 10 + cold: -10 + hot_label: ' Increase in Volume Uptrend' + cold_label: ' Increase in Volume Downtrend' + candle_period: 15m + chart: true + ma_ribbon: + - enabled: false + alert_enabled: true + alert_frequency: always + signal: + - pval + - corr + hot: 10 + cold: -10 + hot_label: '(BUY) Uptrend' + cold_label: '(SELL) Downtrend' + candle_period: 15m + # indicator_label: 'Ribbon' + pval_th: 20 + ma_series: 5, 15, 25, 35, 45 + ma_crossover: # working not useful + - enabled: false + candle_period: 1d + alert_enabled: true + alert_frequency: once + exponential: true + ma_fast: 50 + ma_slow: 100 + signal: + - open + - close + hot_label: '(BUY) Uptrend' + cold_label: '(SELL) Downtrend' + indicator_label: 'EMA 50/100 Cross' + - enabled: true + candle_period: 1d + alert_enabled: true + alert_frequency: once + exponential: false + ma_fast: 2 + ma_slow: 200 + signal: + - open + - close + hot_label: '(BUY) Uptrend' + cold_label: '(SELL) Downtrend' + indicator_label: 'EMA 2/200 Cross' + macd_cross: + - enabled: false + candle_period: 4h + alert_enabled: true + alert_frequency: always + signal: + - macd + - signal + hot_label: '(BUY) Uptrend' + cold_label: '(SELL) Downtrend' + # indicator_label: 'MACD Crossover 4h' + mute_cold: false + stochrsi_cross: + - enabled: false + candle_period: 4h + alert_enabled: true + alert_frequency: always + smooth_k: 10 + smooth_d: 3 + signal: + - stoch_rsi + - smooth_k + - smooth_d + hot_label: '(BUY) Uptrend' + cold_label: '(SELL) Downtrend' + indicator_label: 'StochRSI Cross 4h' + mute_cold: false + sqzmom: + - enabled: false + alert_enabled: true + alert_frequency: once + candle_period: 1d + signal: + - close +informants: + vwap: + - enabled: false + signal: + - vwap + candle_period: 1d + period_count: 15 + sma: + - enabled: false + signal: + - sma + candle_period: 1d + period_count: 15 + ema: + - enabled: true + signal: + - ema + candle_period: 1d + period_count: 15 + bollinger_bands: + - enabled: false + signal: + - upperband + - middleband + - lowerband + candle_period: 1d + ohlcv: + - enabled: false + signal: + - close + candle_period: 1d + period_count: 15 + +notifiers: + telegram: + required: + token: 2062509778:AAEKJsoxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + chat_id: 172xxxxxxxxxxxx + optional: + parse_mode: html + template: "{{market}} {{hot_cold_label}} {{creation_date}} {{values}} [{{exchange}}-{{indicator}}-{{indicator_number}}-{{analysis.config.candle_period}}] {{prices}}{{ '\n' -}}" + discord: + required: + # no support for charts + webhook: https://discordapp.com/api/webhooks/1037606799710363678/boA6YeA6-PoRaMyuo35z8ZYGe0JJykD5jm-XsjQ3I6YjUWYIlyaPLVb5BB-RuoiebTcv + username: ahmetax + optional: + avatar: null + template: "{{market}}-{{hot_cold_label}}-{{exchange}}-{{creation_date}} [{{indicator}}-{{indicator_number}}-{{analysis.config.candle_period}}] {{values}} {{prices}}{{ '\n' -}}" + stdout: + required: + enable: true + optional: + parse_mode: html + template: "\u001b[31m ** {{market}}-{{hot_cold_label}}-{{exchange}}-{{creation_date}} {{values}} [{{indicator}}-{{indicator_number}}-{{analysis.config.candle_period}}] {{prices}} ** \u001b[0m" + chart: true From af0858ee899e8918e6e98bdf6de58ce832b55ea8 Mon Sep 17 00:00:00 2001 From: ahmetax Date: Fri, 25 Nov 2022 07:40:54 +0300 Subject: [PATCH 3/3] Revisions in README.md --- README.md | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b6e4127d..9e231cc7 100644 --- a/README.md +++ b/README.md @@ -24,19 +24,37 @@ Because this is a development branch you need to build your custom Docker image. Be sure you have git installed in your system. -1. Clone this repo `git clone https://github.com/CryptoSignal/crypto-signal.git` +1. Clone this repo `git clone https://github.com/ahmetax/Crypto-Signal.git` -1. Enter to cripto-signal folder `cd crypto-signal` +2. Enter to cripto-signal folder `cd Crypto-Signal` -1. Switch to develop branch `git checkout develop` +3. Switch to develop branch `git checkout newsiiv` -1. Create a config.yml file and put it into "app" folder. +4. Create a config.yml file and put it into "app" folder. -1. Build your own Docker image, for example, `docker build -t dev/crypto-signals:latest .` +5. Build your own Docker image, for example, `docker build -t dev/crypto-signals:latest .` -1. For testing and debugging run docker with "-t" option `docker run --rm -ti -v $PWD/app:/app dev/crypto-signals:latest` +6. For testing and debugging run docker with "-t" option `docker run --rm -ti -v $PWD/app:/app dev/crypto-signals:latest` -1. For production run in daemon mode using "-d" option `docker run --rm -di -v $PWD/app:/app dev/crypto-signals:latest` +7. For production run in daemon mode using "-d" option `docker run --rm -di -v $PWD/app:/app dev/crypto-signals:latest` + +8. If you want to run the script without docker, do the following intesd of items 5, 6, and 7: + +9. python3 -m venv env + +10. source env/bin/activate + +11. pip install --upgrade pip + +12. cd app + +13. pip install -r requirements-step-1.txt + +14. pip install -r requirements-step-2.txt + +15. In order to run: python app.py + +(Note: Give enough permissions to the chart directory and the files in it. ) ### Configuring config.yml @@ -374,7 +392,7 @@ Of course, this indicator can be used in other candle periods, 15m, 1h.. etc. #### Signed Increase In Volume indicator - siiv -There is a new indicator called "siiv". It is a slightly revise "iiv" indicator. The hot value is 10 by default, and cold value is -10. This value is a measure about how strong is the increase in volume in the direction of the price change. +There is a new indicator called "siiv". It is a slightly revised version of "iiv" indicator. The hot value is 10 by default, and cold value is -10. The strength is calculated as IIV, then the direction of changes in price is added as the sign. The main idea is to try to identify a possible pump or dump. @@ -405,7 +423,7 @@ indicators: chart: true ``` -If you don't want to receive such notifications just disable the iiv indicator in your config file. +If you don't want to receive such notifications just disable the siiv indicator in your config file. ``` indicators: @@ -436,7 +454,7 @@ indicators: hot: 10 cold: -10 hot_label: 'Uptrend is coming' - cold_label: 'Downtred is coming' + cold_label: 'Downtrend is coming' candle_period: 15m pval_th: 20 ma_series: 5, 15, 25, 35, 45 @@ -466,7 +484,7 @@ indicators: - open - close hot_label: 'Uptrend is coming' - cold_label: 'Downtred is coming' + cold_label: 'Downtrend is coming' indicator_label: 'EMA 50/100 Cross' ``` @@ -541,7 +559,7 @@ indicators: - macd - signal hot_label: 'Uptrend is coming' - cold_label: 'Downtred is coming' + cold_label: 'Downtrend is coming' indicator_label: 'MACD Cross 4h' mute_cold: false ``` @@ -563,7 +581,7 @@ indicators: - smooth_k - smooth_d hot_label: 'Uptrend is coming' - cold_label: 'Downtred is coming' + cold_label: 'Downtrend is coming' indicator_label: 'StochRSI Cross 4h' mute_cold: false ``` @@ -649,7 +667,7 @@ indicators: hot: true cold: true hot_label: 'Uptrend is coming' - cold_label: 'Downtred is coming' + cold_label: 'Downtrend is coming' candle_period: 4h indicator_label: 'Ichimoku' ``` @@ -690,7 +708,7 @@ indicators: hot: true cold: true hot_label: 'Uptrend is coming' - cold_label: 'Downtred is coming' + cold_label: 'Downtrend is coming' candle_period: 4h indicator_label: 'Ichimoku' ```