I have been scraping a data for every 30 seconds and storing it in this model.
class Frequency(models.Model):
"""Store the frequency scraped"""
timestamp = models.DateTimeField()
frequency = models.DecimalField(max_digits=5, decimal_places=2)
Now i have been given a task that for every 15 minutes of a day i have to average out the results and group into something like 08:15-08:30, 08:30-08:45 .... 23:45-24:00.
What i thought is to use two loops. The outer one will loop in the hours in a day and the inner one will loop in (00, 15, 30, 45) and then alter todays datetime.now() and filter it.
Is there any better way or this is fine??