From 1e0b00bf040ef7671c776d7f77352d08acc4022a Mon Sep 17 00:00:00 2001 From: kourosh Date: Sun, 3 Oct 2021 12:51:57 +0330 Subject: [PATCH] bugs fix --- Analysis/diamond.py | 6 ++--- Analysis/emerald.py | 18 ++++++------- Analysis/ruby.py | 7 ++--- Analysis/stream.py | 55 +++++++++++++++++++++++++------------- Inc/functions.py | 1 - Interfaces/strategy.py | 25 ----------------- Interfaces/stream.py | 8 +++--- Libraries/tools.py | 12 ++++----- Telegram/Admin/tele.py | 9 +++++-- Telegram/Client/candle.py | 36 ++++++++++++------------- Telegram/Client/message.py | 36 +++++++++---------------- Telegram/Client/tele.py | 7 ++--- main.py | 6 +++-- 13 files changed, 103 insertions(+), 123 deletions(-) diff --git a/Analysis/diamond.py b/Analysis/diamond.py index c951cac..59511e6 100644 --- a/Analysis/diamond.py +++ b/Analysis/diamond.py @@ -41,7 +41,7 @@ } -def signal(data: pd.DataFrame, gain: float, cost: float, coin_id: int, timeframe_id: int, setting: dict): +def signal(data: pd.DataFrame, gain: float, cost: float, coin_id: int, timeframe_id: int, setting: dict, bot_ins): diamond_tools = Tools(analysis_id=3, timeframe_id=timeframe_id, coin_id=coin_id) if coin_id in valid_coins_and_times['coins'] \ @@ -128,7 +128,7 @@ def signal(data: pd.DataFrame, gain: float, cost: float, coin_id: int, timeframe else: result = True, "high" # add signal to database - diamond_tools.signal_process(close=close, gain=gain, result=result, cost=cost) + diamond_tools.signal_process(close=close, gain=gain, result=result, cost=cost, bot_ins=bot_ins) sell_counter = 0 if old_position == "buy" and old_price < close: @@ -151,4 +151,4 @@ def signal(data: pd.DataFrame, gain: float, cost: float, coin_id: int, timeframe result = False, "medium" else: result = False, "high" - diamond_tools.signal_process(close=close, gain=gain, result=result, cost=cost) + diamond_tools.signal_process(close=close, gain=gain, result=result, cost=cost, bot_ins=bot_ins) diff --git a/Analysis/emerald.py b/Analysis/emerald.py index a402acf..9c64a7f 100644 --- a/Analysis/emerald.py +++ b/Analysis/emerald.py @@ -17,7 +17,7 @@ import pandas as pd import pandas_ta as ta import numpy as np -from Inc import functions +from Inc.functions import get_recommendations, set_recommendation from Telegram.Client.message import broadcast_messages @@ -34,7 +34,7 @@ def get_future_spans(): return ichimoku, get_future_spans() -def signal(data: pd.DataFrame, gain: float, cost: float, coin_id: int, timeframe_id: int, setting: dict): +def signal(data: pd.DataFrame, gain: float, cost: float, coin_id: int, timeframe_id: int, setting: dict, bot_ins): tenkan = setting['indicators_setting']['ichimoku']['tenkan'] kijun = setting['indicators_setting']['ichimoku']['kijun'] senkou = setting['indicators_setting']['ichimoku']['senkou'] @@ -48,7 +48,7 @@ def signal(data: pd.DataFrame, gain: float, cost: float, coin_id: int, timeframe last_ichimoku = np.array(ichimoku.tail(1))[0].astype(float) close = float(last_ichimoku[5]) try: - query = functions.get_recommendations(analysis_id=1, timeframe_id=timeframe_id, coin_id=coin_id) + query = get_recommendations(analysis_id=1, timeframe_id=timeframe_id, coin_id=coin_id) old_position = query[0][2] old_risk = query[0][7] # when no rows in database @@ -92,11 +92,11 @@ def check(): target_price = close * gain + close if result[0] else -close * gain + close position = 'buy' if result[0] else 'sell' if old_position != position or old_risk != result[1]: - functions.set_recommendation(analysis_id=1, coin_id=coin_id, timeframe_id=timeframe_id, position=position, + set_recommendation(analysis_id=1, coin_id=coin_id, timeframe_id=timeframe_id, position=position, target_price=target_price, current_price=close, cost_price=cost, risk=result[1]) broadcast_messages(coin_id=coin_id, analysis_id=1, timeframe_id=timeframe_id, position=position, - target_price=target_price, current_price=close, risk=result[1]) - # for transaction in future - # users = functions.get_user_recommendation(connection, coin_id=coin_id, analysis_id=1, timeframe_id=timeframe_id) - # for user in users: - # functions.pay_transaction(db_connection=connection ,cost_price=cost ,username=user ,detail="") + target_price=target_price, current_price=close, risk=result[1], bot_ins=bot_ins) +# for transaction in future +# users = functions.get_user_recommendation(connection, coin_id=coin_id, analysis_id=1, timeframe_id=timeframe_id) +# for user in users: +# functions.pay_transaction(db_connection=connection ,cost_price=cost ,username=user ,detail="") diff --git a/Analysis/ruby.py b/Analysis/ruby.py index e32dafb..7c66881 100644 --- a/Analysis/ruby.py +++ b/Analysis/ruby.py @@ -5,9 +5,6 @@ from Telegram.Client.message import broadcast_messages -# from Telegram import message - - def cross_over(x, y): return True if x[0] < y < x[1] else False @@ -52,7 +49,7 @@ def signal(data: pd.DataFrame, gain: float, cost: float, coin_id: int, timeframe functions.set_recommendation(analysis_id=2, coin_id=coin_id, timeframe_id=timeframe_id, position=position, target_price=target_price, current_price=close, cost_price=cost, risk=result[1]) broadcast_messages(coin_id=coin_id, analysis_id=2, timeframe_id=timeframe_id, position=position, - target_price=target_price, current_price=close, risk=result[1]) + target_price=target_price, current_price=close, risk=result[1], bot_ins=None) elif float(last_macd[1, 1]) < np.array(macd_df.tail(delay)["histogram"])[0] and \ old_price < close and old_position == "buy": result = False, "medium" @@ -61,5 +58,5 @@ def signal(data: pd.DataFrame, gain: float, cost: float, coin_id: int, timeframe functions.set_recommendation(analysis_id=2, coin_id=coin_id, timeframe_id=timeframe_id, position=position, target_price=target_price, current_price=close, cost_price=cost, risk=result[1]) broadcast_messages(coin_id=coin_id, analysis_id=2, timeframe_id=timeframe_id, position=position, - target_price=target_price, current_price=close, risk=result[1]) + target_price=target_price, current_price=close, risk=result[1], bot_ins=None) diff --git a/Analysis/stream.py b/Analysis/stream.py index 5a49a7b..efa6f51 100644 --- a/Analysis/stream.py +++ b/Analysis/stream.py @@ -18,9 +18,17 @@ """ import asyncio import threading -from Analysis import emerald, diamond +import telebot +from Analysis.emerald import signal as emerald +from Analysis.diamond import signal as diamond from Interfaces.stream import Stream, append +# master bot already run on vps dont use this @algowatchbot -> address +API_KEY = '1987308624:AAEow3hvRGt4w6ZFmz3bYaQz1J8p-OzRer0' +# @testkourosh2bot -> address // use this bot for test your code +# API_KEY = '1978536410:AAE_RMk3-4r_cLnt_nRcEnZHaSp-vIk9oVo' +_bot_ins = telebot.TeleBot(API_KEY) + class StreamIStrategies(Stream): def __init__(self, symbol: str, cost: float = 1, gain: float = 0.003): @@ -37,11 +45,11 @@ async def stream_30min_candle(self): setting_emerald = self.get_setting_analysis(analysis_id=1, timeframe_id=1) self.data_30min = append(data=self.data_30min.tail(100), symbol=self.symbol, timeframe="30min", candle=c_30m_data) - emerald.signal(data=self.data_30min, gain=self.gain, cost=self.cost, coin_id=self.coin_id, - timeframe_id=1, setting=setting_emerald) + emerald(data=self.data_30min, gain=self.gain, cost=self.cost, coin_id=self.coin_id, + timeframe_id=1, setting=setting_emerald, bot_ins=_bot_ins) setting_diamond = self.get_setting_analysis(analysis_id=3, timeframe_id=1) - diamond.signal(data=self.data_30min, gain=self.gain, cost=self.cost, coin_id=self.coin_id, - timeframe_id=1, setting=setting_diamond) + diamond(data=self.data_30min, gain=self.gain, cost=self.cost, coin_id=self.coin_id, + timeframe_id=1, setting=setting_diamond, bot_ins=_bot_ins) await asyncio.sleep(1790) async def stream_1hour_candle(self): @@ -53,8 +61,8 @@ async def stream_1hour_candle(self): setting_emerald = self.get_setting_analysis(analysis_id=1, timeframe_id=2) self.data_1hour = append(data=self.data_1hour.tail(100), symbol=self.symbol, timeframe="1hour", candle=c_1h_data) - emerald.signal(data=self.data_1hour, gain=self.gain, cost=self.cost, coin_id=self.coin_id, - timeframe_id=2, setting=setting_emerald) + emerald(data=self.data_1hour, gain=self.gain, cost=self.cost, coin_id=self.coin_id, + timeframe_id=2, setting=setting_emerald, bot_ins=_bot_ins) await asyncio.sleep(3590) async def stream_4hour_candle(self): @@ -66,11 +74,11 @@ async def stream_4hour_candle(self): setting_emerald = self.get_setting_analysis(analysis_id=1, timeframe_id=3) self.data_4hour = append(data=self.data_4hour.tail(100), symbol=self.symbol, timeframe="4hour", candle=c_4h_data) - emerald.signal(data=self.data_4hour, gain=self.gain, cost=self.cost, coin_id=self.coin_id, - timeframe_id=3, setting=setting_emerald) + emerald(data=self.data_4hour, gain=self.gain, cost=self.cost, coin_id=self.coin_id, + timeframe_id=3, setting=setting_emerald, bot_ins=_bot_ins) setting_diamond = self.get_setting_analysis(analysis_id=3, timeframe_id=3) - diamond.signal(data=self.data_30min, gain=self.gain, cost=self.cost, coin_id=self.coin_id, - timeframe_id=3, setting=setting_diamond) + diamond(data=self.data_30min, gain=self.gain, cost=self.cost, coin_id=self.coin_id, + timeframe_id=3, setting=setting_diamond, bot_ins=_bot_ins) await asyncio.sleep(14390) async def stream_1day_candle(self): @@ -82,8 +90,8 @@ async def stream_1day_candle(self): setting_emerald = self.get_setting_analysis(analysis_id=1, timeframe_id=4) self.data_1day = append(data=self.data_1day.tail(100), symbol=self.symbol, timeframe="1day", candle=c_1d_data) - emerald.signal(data=self.data_1day, gain=self.gain, cost=self.cost, coin_id=self.coin_id, - timeframe_id=4, setting=setting_emerald) + emerald(data=self.data_1day, gain=self.gain, cost=self.cost, coin_id=self.coin_id, + timeframe_id=4, setting=setting_emerald, bot_ins=_bot_ins) await asyncio.sleep(86390) def set_cost(self, cost: float): @@ -93,9 +101,18 @@ def set_gain(self, gain: float): self.gain = gain -def run_ichimoku_threads(*symbols: str): - for symbol in symbols: - ichimoku_symbol = StreamIStrategies(symbol=symbol) - btcusdt_thread = threading.Thread(target=ichimoku_symbol.run) - btcusdt_thread.daemon = True - btcusdt_thread.start() +class StrategiesThreads: + def __init__(self, *symbols: str): + self.symbols = symbols + self.threads = [] + for symbol in symbols: + self.threads.append(threading.Thread(target=StreamIStrategies(symbol=symbol).run)) + + def start_threads(self): + for thread in self.threads: + thread.daemon = True + thread.start() + + def join_threads(self): + for thread in self.threads: + thread.join() diff --git a/Inc/functions.py b/Inc/functions.py index ddc1093..077b9d6 100644 --- a/Inc/functions.py +++ b/Inc/functions.py @@ -444,7 +444,6 @@ def set_recommendation(analysis_id: int, coin_id: int, timeframe_id: int, positi cursor = connection.cursor() cursor.execute(sql, val) connection.commit() - print('tamam') except Error as err: return "Something went wrong: {}".format(err) diff --git a/Interfaces/strategy.py b/Interfaces/strategy.py index e72152c..e69de29 100644 --- a/Interfaces/strategy.py +++ b/Interfaces/strategy.py @@ -1,25 +0,0 @@ -import pandas as pd -import pandas_ta as ta -import numpy as np -from Inc import db, functions -from Telegram.Client.message import broadcast_messages - - -class Strategy: - def __init__(self): - print("sa") - - def signal(self, *args): - raise Exception("NotImplementedException") - - def cross_over(self, x, y): - return True if x[0] < y < x[1] else False - - def cross_under(self, x, y): - return True if x[0] > y > x[1] else False - - def broadcast_and_insert_database(self): - functions.set_recommendation(analysis_id=1, coin_id=coin_id, timeframe_id=timeframe_id, position=position, - target_price=target_price, current_price=close, cost_price=cost, risk=result[1]) - broadcast_messages(coin_id=coin_id, analysis_id=1, timeframe_id=timeframe_id, position=position, - target_price=target_price, current_price=close, risk=result[1]) diff --git a/Interfaces/stream.py b/Interfaces/stream.py index 44a00fb..eb93feb 100644 --- a/Interfaces/stream.py +++ b/Interfaces/stream.py @@ -1,6 +1,6 @@ import asyncio from binance import AsyncClient, BinanceSocketManager -from Inc import functions +from Inc.functions import get_coin_id, get_analysis_setting import pandas as pd @@ -47,7 +47,7 @@ def append(data: pd.DataFrame, symbol: str, timeframe: str, candle): class Stream: def __init__(self, symbol: str): self.symbol = symbol - self.coin_id = functions.get_coin_id(symbol) + self.coin_id = get_coin_id(symbol) self.client = None self.socket = None self.data_30min = pd.read_csv(f'Static/{self.symbol}-30min.csv') @@ -85,8 +85,8 @@ async def stream(self): self.stream_1day_candle()) def get_setting_analysis(self, analysis_id: int, timeframe_id: int): - settings = functions.get_analysis_setting(coin_id=self.coin_id, timeframe_id=timeframe_id, - analysis_id=analysis_id) + settings = get_analysis_setting(coin_id=self.coin_id, timeframe_id=timeframe_id, + analysis_id=analysis_id) return settings def run(self): diff --git a/Libraries/tools.py b/Libraries/tools.py index 03a1f79..856ae6d 100644 --- a/Libraries/tools.py +++ b/Libraries/tools.py @@ -1,6 +1,6 @@ import pandas as pd import pandas_ta as ta -from Inc import functions +from Inc.functions import get_recommendations, set_recommendation from Telegram.Client.message import broadcast_messages @@ -36,7 +36,7 @@ def __init__(self, analysis_id: int, timeframe_id: int, coin_id: int): self.coin_id = coin_id def get_last_data(self, start_position: bool = None): - query = functions.get_recommendations(analysis_id=self.analysis_id, timeframe_id=self.timeframe_id, + query = get_recommendations(analysis_id=self.analysis_id, timeframe_id=self.timeframe_id, coin_id=self.coin_id) try: old_position = query[0][2] @@ -49,11 +49,11 @@ def get_last_data(self, start_position: bool = None): return old_position, old_price - def signal_process(self, close: float, gain: float, result: tuple, cost: float): + def signal_process(self, close: float, gain: float, result: tuple, cost: float, bot_ins): position = 'buy' if result[0] else 'sell' tp = target_price(close=close, gain=gain, result=result) - functions.set_recommendation(analysis_id=self.analysis_id, coin_id=self.coin_id, timeframe_id=self.timeframe_id, + set_recommendation(analysis_id=self.analysis_id, coin_id=self.coin_id, timeframe_id=self.timeframe_id, position=position, target_price=tp, current_price=close, cost_price=cost, risk=result[1]) - broadcast_messages(analysis_id=self.analysis_id, coin_id=self.coin_id, current_price=close, - target_price=tp, risk=result[1], position=position, timeframe_id=self.timeframe_id) + broadcast_messages(coin_id=self.coin_id, analysis_id=self.analysis_id, timeframe_id=self.timeframe_id, + position=position, target_price=tp, current_price=close, risk=result[1], bot_ins=bot_ins) diff --git a/Telegram/Admin/tele.py b/Telegram/Admin/tele.py index fa137c9..6fdea35 100644 --- a/Telegram/Admin/tele.py +++ b/Telegram/Admin/tele.py @@ -16,6 +16,11 @@ API_KEY = '1987746421:AAFjiQ22yuRXhzYOrRkVmeuuHM96sD4aqpA' # test bot fro admin # API_KEY = '1991184876:AAGfWUbxXEbnbWHeKrlh2knooi8lF1PSWKI' +# algowatch original API +API_KEY_MESSAGE = '1987308624:AAEow3hvRGt4w6ZFmz3bYaQz1J8p-OzRer0' +# test API +# API_KEY_MESSAGE = '1978536410:AAE_RMk3-4r_cLnt_nRcEnZHaSp-vIk9oVo' +_bot_ins = telebot.TeleBot(API_KEY_MESSAGE) class AdminBot(Telegram): @@ -53,7 +58,7 @@ def query_handler(call): msg = user.temp if str(call.data).split('_')[2] == "yes": chat_ids = np.array(functions.get_chat_ids()) - admin_broadcast(msg, chat_ids) + admin_broadcast(message=msg, chat_ids=chat_ids, bot_ins=_bot_ins) self.bot.reply_to(call.message, "Done!\nyour message send to all") else: self.bot.reply_to(call.message, "Deleted, try again /broadcast") @@ -98,7 +103,7 @@ def process_message_to_user_step2(message): user = self.user_dict[message.chat.id] try: chat_id = functions.get_user_chat_id(user.temp) - admin_send_message(message=message.text, chat_id=chat_id) + admin_send_message(message=message.text, chat_id=chat_id, bot_ins=_bot_ins) except Exception as e: self.bot.reply_to(message, e) diff --git a/Telegram/Client/candle.py b/Telegram/Client/candle.py index c84bb47..e38614b 100644 --- a/Telegram/Client/candle.py +++ b/Telegram/Client/candle.py @@ -7,34 +7,34 @@ import pandas as pd from Libraries.definitions import * -client = Client() +_client = Client() def get_interval_client(timeframe: str): return { - '1min': client.KLINE_INTERVAL_1MINUTE, - '3min': client.KLINE_INTERVAL_3MINUTE, - '5min': client.KLINE_INTERVAL_5MINUTE, - '15min': client.KLINE_INTERVAL_15MINUTE, - '30min': client.KLINE_INTERVAL_30MINUTE, - '1hour': client.KLINE_INTERVAL_1HOUR, - '2hour': client.KLINE_INTERVAL_2HOUR, - '4hour': client.KLINE_INTERVAL_4HOUR, - '6hour': client.KLINE_INTERVAL_6HOUR, - '8hour': client.KLINE_INTERVAL_8HOUR, - '12hour': client.KLINE_INTERVAL_12HOUR, - '1day': client.KLINE_INTERVAL_1DAY, - '3day': client.KLINE_INTERVAL_3DAY, - 'weekly': client.KLINE_INTERVAL_1WEEK, - 'monthly': client.KLINE_INTERVAL_1MONTH, + '1min': _client.KLINE_INTERVAL_1MINUTE, + '3min': _client.KLINE_INTERVAL_3MINUTE, + '5min': _client.KLINE_INTERVAL_5MINUTE, + '15min': _client.KLINE_INTERVAL_15MINUTE, + '30min': _client.KLINE_INTERVAL_30MINUTE, + '1hour': _client.KLINE_INTERVAL_1HOUR, + '2hour': _client.KLINE_INTERVAL_2HOUR, + '4hour': _client.KLINE_INTERVAL_4HOUR, + '6hour': _client.KLINE_INTERVAL_6HOUR, + '8hour': _client.KLINE_INTERVAL_8HOUR, + '12hour': _client.KLINE_INTERVAL_12HOUR, + '1day': _client.KLINE_INTERVAL_1DAY, + '3day': _client.KLINE_INTERVAL_3DAY, + 'weekly': _client.KLINE_INTERVAL_1WEEK, + 'monthly': _client.KLINE_INTERVAL_1MONTH, - }.get(timeframe, client.KLINE_INTERVAL_1MINUTE) + }.get(timeframe, _client.KLINE_INTERVAL_1MINUTE) def get_candle_details(symbol: str, timeframe: str): symbol = symbol.upper() timeframe = get_interval_client(timeframe) - data = pd.DataFrame(client.get_klines(symbol=symbol, interval=timeframe, limit=1)).values + data = pd.DataFrame(_client.get_klines(symbol=symbol, interval=timeframe, limit=1)).values return data diff --git a/Telegram/Client/message.py b/Telegram/Client/message.py index 22c9bf2..91244be 100644 --- a/Telegram/Client/message.py +++ b/Telegram/Client/message.py @@ -2,26 +2,16 @@ Mr.Kataei 8/15/2021 """ -import telebot -from Inc import functions +from Inc.functions import get_user_recommendation, get_coin_name, get_analysis, get_timeframe, get_user_chat_id from Libraries.definitions import * -# from decouple import config - -# API_KEY = config('API_KEY') -# master bot already run on vps dont use this @algowatchbot -> address -API_KEY = '1987308624:AAEow3hvRGt4w6ZFmz3bYaQz1J8p-OzRer0' -# @testkourosh2bot -> address // use this bot for test your code -#API_KEY = '1978536410:AAE_RMk3-4r_cLnt_nRcEnZHaSp-vIk9oVo' - def broadcast_messages(coin_id: int, analysis_id: int, timeframe_id: int, position: str, target_price: float, - current_price: float, risk: str): - users = functions.get_user_recommendation(coin_id=coin_id, analysis_id=analysis_id, timeframe_id=timeframe_id) - coin = functions.get_coin_name(coin_id) - analysis = functions.get_analysis(analysis_id) - timeframe = functions.get_timeframe(timeframe_id) - bot = telebot.TeleBot(API_KEY) + current_price: float, risk: str, bot_ins): + users = get_user_recommendation(coin_id=coin_id, analysis_id=analysis_id, timeframe_id=timeframe_id) + coin = get_coin_name(coin_id) + analysis = get_analysis(analysis_id) + timeframe = get_timeframe(timeframe_id) for user in users: message = f'šŸ‘‹šŸ¼ {trans("C_hello")} {user[0]}!\nšŸ’„{trans("M_new_signal")}*{analysis[0][0]}*!!!\n' \ f'*{coin}* {trans("C_now")} {trans("M_in")} *{position}* {trans("M_position")}\n' \ @@ -30,22 +20,20 @@ def broadcast_messages(coin_id: int, analysis_id: int, timeframe_id: int, positi f'{trans("M_risk")}: *{risk}*\n' \ f'{trans("C_timeframe")}: {timeframe[0][0]}' try: - bot.send_message(chat_id=int(functions.get_user_chat_id(user[0])), text=message, - parse_mode='Markdown') + bot_ins.send_message(chat_id=int(get_user_chat_id(user[0])), text=message, + parse_mode='Markdown') except Exception as e: print(e) -def admin_broadcast(message: str, chat_ids): - bot = telebot.TeleBot(API_KEY) +def admin_broadcast(message: str, chat_ids, bot_ins): for chat_id in chat_ids: try: - bot.send_message(chat_id=int(chat_id[0]), text=message) + bot_ins.send_message(chat_id=int(chat_id[0]), text=message) except Exception as e: print(e) continue -def admin_send_message(message: str, chat_id): - bot = telebot.TeleBot(API_KEY) - bot.send_message(chat_id=int(chat_id), text=message) +def admin_send_message(message: str, chat_id, bot_ins): + bot_ins.send_message(chat_id=int(chat_id), text=message) diff --git a/Telegram/Client/tele.py b/Telegram/Client/tele.py index 686e6eb..be282c1 100644 --- a/Telegram/Client/tele.py +++ b/Telegram/Client/tele.py @@ -11,12 +11,11 @@ avoid memory leak , """ import telebot -from telebot import apihelper +import numpy as np from time import sleep +from telebot import apihelper from Auth import register, reset_password from Inc import functions -import numpy as np -from binance.client import Client from Telegram.Client import candle from Account.clients import User, Register from Libraries.definitions import * @@ -28,8 +27,6 @@ # @testkourosh2bot -> address // use this bot for test your code # API_KEY = '1978536410:AAE_RMk3-4r_cLnt_nRcEnZHaSp-vIk9oVo' -client = Client() - class ClientBot(Telegram): def __init__(self): diff --git a/main.py b/main.py index 06a714a..8b426ce 100644 --- a/main.py +++ b/main.py @@ -1,10 +1,12 @@ -from Analysis.stream import run_ichimoku_threads +from Analysis.stream import StrategiesThreads from Libraries.data_collector import generate_data from time import sleep + generate_data('BTCUSDT', 'ETHUSDT', 'ADAUSDT', 'DOGEUSDT', 'BCHUSDT', 'ETCUSDT') +thread = StrategiesThreads('BTCUSDT', 'ETHUSDT', 'ADAUSDT', 'DOGEUSDT', 'BCHUSDT', 'ETCUSDT') if __name__ == '__main__': - run_ichimoku_threads('BTCUSDT', 'ETHUSDT', 'ADAUSDT', 'DOGEUSDT', 'BCHUSDT', 'ETCUSDT') + thread.start_threads() while True: print("Running...") sleep(2000000)