I need to write a Python code in order to repeat a trading algorithm exactly every fith minute of the hour. All the solutions that I tried as for example Sleep() will sum machine time, and this is not what I want.
I need to preserve state between calls, ... I want the algorithm to run exactly every 5 minutes (for example 14:00; 14:05; 14:10; 14:15......). The algorithm (retriving the data and cruncing the numbers) itself takes approximatly 12 seconds to be executed. If the computer is suspended I will skip the iteration.