title: Custom TruncFunc in Django ORM
body: <p>I have a Django model with the following structure:</p>
  <pre class="lang-py prettyprint-override"><code>class BBPerformance(models.Model):
      marketcap_change = models.FloatField(verbose_name=&quot;marketcap change&quot;, null=True, blank=True)
      bb_change = models.FloatField(verbose_name=&quot;bestbuy change&quot;, null=True, blank=True)
      created_at = models.DateTimeField(verbose_name=&quot;created at&quot;, auto_now_add=True)
      updated_at = models.DateTimeField(verbose_name=&quot;updated at&quot;, auto_now=True)
  </code></pre>
  <p>I would like to have an <code>Avg</code> aggregate function on objects for every 3 days.<br>
  for example I write a queryset that do this aggregation for each day or with something like <code>TruncDay</code> function.</p>
  <pre class="lang-py prettyprint-override"><code>queryset = BBPerformance.objects.annotate(day=TruncDay('created_at')).values('day').annotate(marketcap_avg=Avg('marketcap_change'),bb_avg=Avg('bb_change')
  </code></pre>
  <p>How can I have a queryset of the aggregated value with 3-days interval and the index of the second day of that interval?</p>