Send a Discord message when backtest automation fails
This commit is contained in:
parent
e1f761419c
commit
7b80f5e138
@ -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__':
|
||||
|
Loading…
Reference in New Issue
Block a user