INNER CODE UNIT · Python
main
tejaslinge/Alpaca-ROC-Trading-Bot · main.py:231
def main():
if api.get_clock().is_open == True:
# sends mail when bot starts running
mail_content = 'The bot started running on {} at {} UTC'.format(dt.now().strftime('%Y-%m-%d'), dt.now().strftime('%H:%M:%S'))
mail_alert(mail_content, 0)
while True:
if api.get_account().pattern_day_trader == True:
mail_alert('Pattern day trading notification, bot is stopping now', 0)
break
tickers = TICKERS
try:
if api.get_clock().is_open == True:
# check if we have made the first ever trade yet, if yes, timeframe = 1 min, else trade at 10:00 am
if os.path.isfile('FirstTrade.csv'):