Send a Discord message when backtest automation fails

This commit is contained in:
moshferatu 2024-01-18 10:58:51 -08:00
parent e1f761419c
commit 7b80f5e138

View File

@ -3,10 +3,15 @@ import time
import traceback
from datetime import datetime, timedelta
from discord_messaging import send_message
from dotenv import load_dotenv
from os import getenv
from download_spx_quotes import download_quotes
from run_backtest import run_backtest
load_dotenv()
def backtest_automation():
try:
download_quotes()
@ -16,8 +21,7 @@ def backtest_automation():
start_date = end_date - timedelta(days = 1)
run_backtest(start_date, end_date)
except:
# TODO: Send Discord notification.
print('Error occurred during backtest automation.')
send_message('Backtest automation failed!', getenv('USER_ID'))
traceback.print_exc()
if __name__ == '__main__':