def main():
# Checks if this is the first time running the script
# Allows the user to choose the Twitter Handles to follow
# Sets the TWITTER_HANDLES which is an empty list, to the new updated list
if INITIAL_START:
handles = initial_start()
else:
handles = TWITTER_HANDLES
# Sets up share_output job
twit = Twitter()
schedule.every().day.at("18:17").do(twit.share_output)
schedule.every(15).minutes.do(company.current_day)
while True:
for handle in handles:
twitter = Twitter(handle)
new_tweet = twitter.get_latest_tweet()
# Checks if a new tweet has been posted
# If it has, checks for companies within the tweet
if new_tweet:
matches = company.check_for_companies(new_tweet, handle)
# If there is a company mentioned
if matches:
# Gets the initial company info
company.get_initial_company_info()
# Outputs the matches via twitter/email
twitter.initial_tweet(matches)
email(handle, matches)
# Checks mentions for sign ups/removals
twitter.check_mentions()
# Gets current share price for each company being monitored
# Checks if there are any schedules to be run
company.get_current_shares()
schedule.run_pending()
now = datetime.now()
print(f'Running: {now.hour}:{now.minute} - {now.day}/{now.month}/{now.year}')
sleep(10)
评论列表
文章目录