diff --git a/config.json.sample b/config.json.sample index 3917be3e..e404d961 100644 --- a/config.json.sample +++ b/config.json.sample @@ -34,7 +34,6 @@ "trailingbuypcnt": 0.5, "telegramtradesonly": 0, "granularity": "1hour", - "enableml": 0, "use_sell_fee": 1 } }, @@ -73,7 +72,6 @@ "trailingbuypcnt": 0.5, "telegramtradesonly": 0, "granularity": "3600", - "enableml": 0 } }, "coinbasepro": { @@ -111,7 +109,6 @@ "trailingbuypcnt": 0.5, "telegramtradesonly": 0, "granularity": "3600", - "enableml": 0 } }, "telegram": { diff --git a/controllers/PyCryptoBot.py b/controllers/PyCryptoBot.py index 0d6f8e0f..1a9ec4f1 100644 --- a/controllers/PyCryptoBot.py +++ b/controllers/PyCryptoBot.py @@ -910,17 +910,6 @@ def _notify(notification: str = "", level: str = "normal") -> None: self.console_log.print(self.table_console) self.table_console = Table(title=None, box=None, show_header=False, show_footer=False) # clear table - if self.enableml: - # Seasonal Autoregressive Integrated Moving Average (ARIMA) model (ML prediction for 3 intervals from now) - if not self.is_sim: - try: - prediction = _technical_analysis.arima_model_prediction(int(self.granularity.to_integer / 60) * 3) # 3 intervals from now - _notify( - f"Seasonal ARIMA model predicts the closing self.price will be {str(round(prediction[1], 2))} at {prediction[0]} (delta: {round(prediction[1] - self.price, 2)})" - ) - except Exception: - pass - if self.state.last_action == "BUY": # display support, resistance and fibonacci levels if not self.is_sim: @@ -2304,15 +2293,6 @@ def config_option_row_enum( default_value=False, arg_name="manualtradesonly", ) - config_option_row_bool( - "AI/ML Predictions", - "enableml", - "Enable AI / Machine Learning Predictions", - break_below=False, - store_invert=False, - default_value=False, - arg_name="predictions", - ) config_option_row_str( "Start Method", "startmethod", diff --git a/examples/create-graphs.py b/examples/create-graphs.py index 646fba8c..1453abd2 100644 --- a/examples/create-graphs.py +++ b/examples/create-graphs.py @@ -17,5 +17,4 @@ # tradinggraphs.render_fibonacci_retracement(True) # tradinggraphs.render_support_resistance(True) # tradinggraphs.render_candle_sticks(30, True) -# tradinggraphs.render_arima_model_prediction(1, True) tradinggraphs.render_bollinger_bands() diff --git a/models/BotConfig.py b/models/BotConfig.py index 9312a990..74e241fa 100644 --- a/models/BotConfig.py +++ b/models/BotConfig.py @@ -121,7 +121,6 @@ def __init__(self, *args, **kwargs): self.disabletelegram = False self.disablelog = False self.disabletracker = True - self.enableml = False self.websocket = False self.exitaftersell = False self.ignorepreviousbuy = True @@ -424,7 +423,6 @@ def _parse_arguments(self): parser.add_argument("--insufficientfundslogging", type=int, help="Enable insufficient funds logging") parser.add_argument("--logbuysellinjson", type=int, help="Log buy and sell orders in a JSON file") parser.add_argument("--manualtradesonly", type=int, help="Manual Trading Only (HODL)") - parser.add_argument("--predictions", type=int, help="Enable AI / Machine Learning Predictions") parser.add_argument("--startmethod", type=str, help="Bot start method ('scanner', 'standard', 'telegram')") parser.add_argument("--recvwindow", type=int, help="Binance exchange API recvwindow, integer between 5000 and 60000") parser.add_argument("--lastaction", type=str, help="Manually set the last action performed by the bot (BUY, SELL)") diff --git a/models/config/default_parser.py b/models/config/default_parser.py index 2fcb98a2..78255179 100644 --- a/models/config/default_parser.py +++ b/models/config/default_parser.py @@ -244,7 +244,6 @@ def config_option_date( config_option_bool(option_name="insufficientfundslogging", option_default=False, store_name="enableinsufficientfundslogging", store_invert=False) config_option_bool(option_name="logbuysellinjson", option_default=False, store_name="logbuysellinjson", store_invert=False) config_option_bool(option_name="manualtradesonly", option_default=False, store_name="manual_trades_only", store_invert=False) - config_option_bool(option_name="predictions", option_default=False, store_name="enableml", store_invert=False) config_option_str(option_name="startmethod", option_default="standard", store_name="startmethod", valid_options=["scanner", "standard", "telegram"]) config_option_int(option_name="recvwindow", option_default=5000, store_name="recv_window", value_min=5000, value_max=60000) config_option_str(option_name="lastaction", option_default=None, store_name="last_action", valid_options=["BUY", "SELL"]) diff --git a/pages/config.py b/pages/config.py index 11f05da8..1509c43f 100644 --- a/pages/config.py +++ b/pages/config.py @@ -480,10 +480,6 @@ "label": "Disable Bot Logs", "value": "disablelog", }, - { - "label": "Enable Machine Learning Messages", - "value": "enableml", - }, ], value=[1], id="switches-extras", diff --git a/views/TradingGraphs.py b/views/TradingGraphs.py index 02c17bc2..cbfeddc9 100644 --- a/views/TradingGraphs.py +++ b/views/TradingGraphs.py @@ -302,36 +302,6 @@ def format_date(x, pos=None): # pylint: disable=unused-argument if saveOnly is False: plt.show() - def render_seasonal_arima_model(self, saveFile="", saveOnly=False): - """Render the seasonal ARIMA model - - Parameters - ---------- - saveFile : str, optional - Save the figure - saveOnly : bool - Save the figure without displaying it - """ - - fittedValues = self.technical_analysis.seasonal_arima_model_fitted_values() - - plt.plot(self.df["close"], label="original") - plt.plot(fittedValues, color="red", label="fitted") - plt.title("RSS: %.4f" % sum((fittedValues - self.df["close"]) ** 2)) - plt.legend() - plt.ylabel("Price") - plt.xticks(rotation=90) - plt.tight_layout() - - try: - if saveFile != "": - plt.savefig(saveFile) - except OSError: - raise SystemExit(f"Unable to save: {saveFile}") - - if saveOnly is False: - plt.show() - def render_sma_and_macd(self, saveFile="", saveOnly=False): """Render the self.price, SMA20, SMA50, and SMA200 @@ -369,72 +339,6 @@ def render_sma_and_macd(self, saveFile="", saveOnly=False): if saveOnly is False: plt.show() - def render_arima_model_prediction(self, days=30, saveOnly=False): - """Render the seasonal ARIMA model prediction - - Parameters - ---------- - days : int - Number of days to predict - saveOnly : bool - Save the figure without displaying it - """ - - # get dataframe from technical analysis object - df = self.technical_analysis.get_df() - - if not isinstance(days, int): - raise TypeError("Prediction days is not numeric.") - - if days < 1 or days > len(df): - raise ValueError("Predication days is out of range") - - # extract market and granularity from trading dataframe - market = df.iloc[0].market - granularity = df.iloc[0].granularity - - results_ARIMA = self.technical_analysis.seasonal_arima_model() - - df = pd.DataFrame(self.df["close"]) - start_date = df.last_valid_index() - end_date = start_date + timedelta(days=days) - pred = results_ARIMA.predict(start=str(start_date), end=str(end_date), dynamic=True) - - fig, axes = plt.subplots(ncols=1, figsize=(12, 6)) # pylint: disable=unused-variable - fig.autofmt_xdate() - ax1 = plt.subplot(111) - ax1.set_title("Seasonal ARIMA Model Prediction") - - date = pd.to_datetime(pred.index).to_pydatetime() - - pred_length = len(pred) - # the evenly spaced plot indices - # indices = np.arange(pred_length) # TODO: why is this here? - - def format_date(x, pos=None): # pylint: disable=unused-argument - thisind = np.clip(int(x + 0.5), 0, pred_length - 1) - return date[thisind].strftime("%Y-%m-%d %H:%M:%S") - - fig, ax = plt.subplots(ncols=1, figsize=(12, 6)) # pylint: disable=unused-variable - fig.autofmt_xdate() - - ax = plt.subplot(111) - ax.set_title("Seasonal ARIMA Model Prediction") - ax.plot(pred, label="prediction", color="black") - ax.xaxis.set_major_formatter(ticker.FuncFormatter(format_date)) - - plt.xticks(rotation=90) - plt.tight_layout() - - try: - RichText.notify(f"creating: graphs/SAM_{market}_{str(granularity)}.png", self.app, "info") - plt.savefig(f"graphs/SAM_{market}_{str(granularity)}.png", dpi=300) - except OSError: - raise SystemExit(f"Unable to save: graphs/SAM_{market}_{str(granularity)}.png") - - if saveOnly is False: - plt.show() - def render_candle_stick_astral_pattern(self, period=30, saveOnly=False): # get dataframe from technical analysis object df = self.technical_analysis.get_df() diff --git a/websvc/app/pages/pages.py b/websvc/app/pages/pages.py index 8980e0a8..44279d35 100644 --- a/websvc/app/pages/pages.py +++ b/websvc/app/pages/pages.py @@ -450,32 +450,6 @@ def technical_analysis(exchange: str, market: str, g1, g2, g3) -> str: adx14_6h_class = "table-danger" adx14_6h_desc = "Weak Trend Up" - def arima_predictions(even_rows: bool = True): - results_ARIMA = ta.seasonal_arima_model() - start_date = df_1h.last_valid_index() - end_date = start_date + datetime.timedelta(days=3) - arima_pred = results_ARIMA.predict( - start=str(start_date), end=str(end_date), dynamic=True - ) - - if even_rows: - arima_pred_rows = arima_pred.iloc[::2] - else: - arima_pred_rows = arima_pred.iloc[1::2] - - html = "" - for index, pred in arima_pred_rows.items(): - html += f""" -
-