From 444727c22ecfef8ca621e121ccb7d0bed1553aa6 Mon Sep 17 00:00:00 2001 From: Beesquit Date: Sun, 18 May 2025 23:36:44 +0300 Subject: [PATCH] Documentation WIP 2 (added demo param) --- README.md | 2 +- src/bybit.py | 1 - src/logger.py | 9 ++++++--- src/options.py | 2 ++ src/whitelist.py | 2 ++ 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0656334..b1d1878 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ # Side Strategy Bybit Bot This is a simple semi-automatic trading bot working with Bybit API and written in Python. The strategy is based on the side moving of the token which crosses user input levels. On the level cross long and short orders are opened. -### For the install and setup guide look at the `setup.md` \ No newline at end of file +### For the install and setup guide look at the `setup.md` diff --git a/src/bybit.py b/src/bybit.py index 2a67ba9..6a667fb 100644 --- a/src/bybit.py +++ b/src/bybit.py @@ -1,4 +1,3 @@ -import time import traceback import asyncio diff --git a/src/logger.py b/src/logger.py index 725be71..31d633f 100644 --- a/src/logger.py +++ b/src/logger.py @@ -1,6 +1,8 @@ import logging import sys +import options + generalLogPath = "./generalLog.log" tradingLogPath = "./tradingLog.log" @@ -29,6 +31,7 @@ generalLogger = setupLogger('general', logging.INFO, generalLogPath, generalForm tradingFormatter = logging.Formatter('%(asctime)s - %(message)s') tradingLogger = setupLogger('trade', logging.NOTSET, tradingLogPath, tradingFormatter) -# Общий лог ну совсем -logging.basicConfig(level=logging.DEBUG) -superGeneralLogger = logging.getLogger('superGeneral') +# Максимально подробный общий лог +if options.showExtraDebugLogs: + logging.basicConfig(level=logging.DEBUG) + superGeneralLogger = logging.getLogger('superGeneral') diff --git a/src/options.py b/src/options.py index 572fc98..3439c17 100644 --- a/src/options.py +++ b/src/options.py @@ -5,8 +5,10 @@ demoTrading = config('DEMOTRADING', default='False').lower() != 'false' # Use d # Please do not combine testnet and demo trading leverage = int(config('LEVERAGE', default='1')) # Leverage + # notification = 1 # Telegram notifications (not currently supported) +showExtraDebugLogs = config('SHOWEXTRADEBUGLOGS', default='False').lower() != 'false' loopSleepTime = int(config('LOOPSLEEPTIME', default='1')) # Time passing between checks for stopping strategy paramsLines = ['highEnd', diff --git a/src/whitelist.py b/src/whitelist.py index 17c2ec9..f7afc2c 100644 --- a/src/whitelist.py +++ b/src/whitelist.py @@ -1,9 +1,11 @@ from decouple import config import re + def checkWhiteList(id): # Checks if id exists in the whitelist. Returnes 1 if exists and 0 if not return id in chatIDs + chatIDsstring = config('WHITELIST', default='') chatIDs = [int(x) for x in re.split(r',\s*', chatIDsstring)]