I am creating an investing bot. Every hour it runs a function that makes predictions every hour. In order to test the bot, I give it a variable called balance = 1000. I want to only pass it the first time I run it, because the following times the function is being called, the balance variable is changed (in order to see how much money the bot is making throughout the test, because every run is an hour).
The scheduling function I am using is the following:
schedule.every().hour.at(":01").do(main)
while True:
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
schedule.run_pending()
print(" I'm running : " + current_time)
time.sleep(60)
If I declare the variable balance
inside the function main
, the balance will return to 1000 every time the function is run. How should I proceed?