Forums

Schedule data each minutes

Hi guys I 'm a quantitative crypto investor.. or better I wuould be ;)

I need a way to run my fucntion to get data each minutes: I use the task: always-on tasks. MY FUNCTION:

import sched import time from datetime import datetime

def task(name):

dt = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime())
print("Execute Task:", name, dt)

while True :

 scheduler = sched.scheduler(time.time, time.sleep)

 scheduler.enterabs(time.time()+60, 1, task, ("Open Browser",))

 # Run all scheduled events
 scheduler.run()

The problem is that each 20 / 30 minutes the time increase of one second so for sure I will lost one data. What can I do ?

I need somthing that start exactly at the .00 of each minutes exist ? Thanks a lot for your help !

Execute Task: Call 16-04-2023 17:01:34.876852 *********** Execute Task: Call 16-04-2023 17:02:34.897124 ********** Execute Task: Call 16-04-2023 17:03:34.957592 ********* Execute Task: Call 16-04-2023 17:04:35.013143 ************

This is the pruve of the error.

That https://pypi.org/project/schedule/ might work better for you.