Skip to content

Commit

Permalink
- fix send empty alert
Browse files Browse the repository at this point in the history
  • Loading branch information
wahyubiman committed Jul 3, 2022
1 parent 978a066 commit 1c18247
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions app/notification/tele.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ async def send_notif(signals):
await bot.start(bot_token=os.getenv('TELE_BOT_TOKEN'))
entity = await bot.get_entity(TG_CHANNEL_NAME)
msg += msg_header
msg += f"""MSB High Break :
if signals[0] != 0:
msg += f"""MSB High Break :
"""
for signal in signals[0]:
msg += "-> {} \n".format(signal)
msg += f"""MSB Low Break :
for signal in signals[0]:
msg += "-> {} \n".format(signal)
if signals[0] != 0:
msg += f"""MSB Low Break :
"""
for signal in signals[1]:
msg += "-> {} \n".format(signal)
for signal in signals[1]:
msg += "-> {} \n".format(signal)
msg += f"""
>>> {str(pd.to_datetime(time.time(), unit='s').tz_localize('UTC').tz_convert('Asia/Jakarta').strftime('%m/%d/%Y %H:%M:%S'))}"""
await bot.send_message(entity, msg)
Expand Down
2 changes: 1 addition & 1 deletion app/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def scanner_1h():
'binance', market_type='future').data('1h', '/USDT')
calc = IndicatorAlert().calculate(ohlcvs)
LOG.info('Done scanning')
if len(calc) != 0:
if len(calc[0]) != 0 | len(calc[1]) != 0:
# send telegram notification if has signal
asyncio.run(send_notif(calc))

Expand Down

0 comments on commit 1c18247

Please sign in to comment.