-
-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Telegram update every 5 (or X minutes) - that the bot is still alive #125
base: develop
Are you sure you want to change the base?
Changes from all commits
c4c26b2
37026a9
5e36dcd
f84a989
2663934
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,38 @@ | ||
--- | ||
TRADE_OPTIONS: | ||
# QUANTITY and PAIRING determine how much of your wallet value will be used to buy the new token. | ||
# 'QUANTITY: 15' and 'PAIRING: USDT' means you will spend 15 USDT to buy XXX_USDT where XXX is the new token. | ||
KUCOIN_ANNOUNCEMENTS: False | ||
QUANTITY: 15 | ||
PAIRING: USDT | ||
# Test mode. No real money will be used. | ||
TEST: True | ||
# Stop Loss in % of your buy value. | ||
SL: -3 | ||
# Take Profit in % of your buy value. | ||
TP: 2 | ||
# DO NOT DISABLE TSL!!!! YOUR BOT WILL NOT SELL | ||
ENABLE_TSL: True | ||
# Trailing Stop Loss | ||
TSL: -4 | ||
# Trailing Take Profit | ||
TTP: 2 | ||
LOGGING: | ||
# Logging levels used in this program are ERROR, INFO, and DEBUG | ||
LOG_LEVEL: INFO | ||
LOG_FILE: bot.log | ||
LOG_TO_CONSOLE: True | ||
TELEGRAM: | ||
# set to True to enable telegram notifications | ||
ENABLED: False | ||
# Disable / Enable specific notifications | ||
NOTIFICATIONS: | ||
STARTUP: True # welcome message | ||
COIN_ANNOUNCEMENT: True # detected new announcement | ||
COIN_NOT_SUPPORTED: True # coin is not on gate.io | ||
BUY_START: True # when entering position | ||
BUY_ORDER_CREATED: True # when buy order is created | ||
BUY_FILLED: True # when the buy order got filled | ||
SELL_START: True # when starting to sell | ||
SELL_FILLED: True # when sold | ||
TRADE_OPTIONS: | ||
# QUANTITY and PAIRING determine how much of your wallet value will be used to buy the new token. | ||
# 'QUANTITY: 15' and 'PAIRING: USDT' means you will spend 15 USDT to buy XXX_USDT where XXX is the new token. | ||
KUCOIN_ANNOUNCEMENTS: False | ||
QUANTITY: 15 | ||
PAIRING: USDT | ||
# Test mode. No real money will be used. | ||
TEST: True | ||
# Stop Loss in % of your buy value. | ||
SL: -3 | ||
# Take Profit in % of your buy value. | ||
TP: 2 | ||
# DO NOT DISABLE TSL!!!! YOUR BOT WILL NOT SELL | ||
ENABLE_TSL: True | ||
# Trailing Stop Loss | ||
TSL: -4 | ||
# Trailing Take Profit | ||
TTP: 2 | ||
LOGGING: | ||
# Logging levels used in this program are ERROR, INFO, and DEBUG | ||
LOG_LEVEL: INFO | ||
LOG_FILE: bot.log | ||
LOG_TO_CONSOLE: True | ||
TELEGRAM: | ||
# set to True to enable telegram notifications | ||
ENABLED: False | ||
# Disable / Enable specific notifications | ||
NOTIFICATIONS: | ||
START_WORKING: True # welcome message | ||
STOPPED_WORKING: True # Stopped Working Message | ||
COIN_ANNOUNCEMENT: True # detected new announcement | ||
COIN_NOT_SUPPORTED: True # coin is not on gate.io | ||
BUY_START: True # when entering position | ||
BUY_ORDER_CREATED: True # when buy order is created | ||
BUY_FILLED: True # when the buy order got filled | ||
SELL_START: True # when starting to sell | ||
SELL_FILLED: True # when sold |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
client = load_gateio_creds('auth/auth.yml') | ||
spot_api = SpotApi(ApiClient(client)) | ||
|
||
|
||
global supported_currencies | ||
|
||
previously_found_coins = set() | ||
|
@@ -101,7 +102,7 @@ def get_last_coin(): | |
uppers = None | ||
|
||
# returns nothing if it's an old coin or it's not an actual coin listing | ||
if 'Will List' not in latest_announcement or found_coin[0] == globals.latest_listing or \ | ||
if 'Binance Will List' not in latest_announcement or found_coin[0] == globals.latest_listing or \ | ||
found_coin[0] in previously_found_coins: | ||
|
||
# if the latest Binance announcement is not a new coin listing, or the listing has already been returned, check kucoin | ||
|
@@ -140,13 +141,17 @@ def search_and_update(): | |
""" | ||
Pretty much our main func | ||
""" | ||
counter = 0 | ||
botPostAllMinutes = 5 | ||
while not globals.stop_threads: | ||
sleep_time = 3 | ||
|
||
for x in range(sleep_time): | ||
time.sleep(1) | ||
if globals.stop_threads: | ||
break | ||
try: | ||
counter+= 3 | ||
latest_coin = get_last_coin() | ||
if latest_coin: | ||
store_new_listing(latest_coin) | ||
|
@@ -155,7 +160,11 @@ def search_and_update(): | |
if os.path.isfile('test_new_listing.json.used'): | ||
os.remove('test_new_listing.json.used') | ||
os.rename('test_new_listing.json', 'test_new_listing.json.used') | ||
logger.info(f"Checking for coin announcements every {str(sleep_time)} seconds (in a separate thread)") | ||
logger.info(f"Checking for coin announcements every {str(sleep_time)} seconds (in a separate thread) - bot is running for {str(counter / 3600)} hours - {str(counter/60)} minutes and {str(counter)} seconds") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does the total runtime matter? Why is it printed here? |
||
if ((counter / 60) % botPostAllMinutes) == 0: | ||
logger.info(f"Bot is still running for {str(counter/60)} minutes - will give live sign in {str(botPostAllMinutes)} Minutes again.", extra={"TELEGRAM": "START_WORKING"}) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this should generally be done outside of the listings scraper functionality. |
||
|
||
|
||
except Exception as e: | ||
logger.info(e) | ||
else: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This value should be configurable via the config,yml and not be hardcoded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also have some value to disable it e.g. 0 or -1.