cryptofeed
cryptofeed copied to clipboard
CustomAggregate doesn't reset the data dict
Currently, the CustomAggregate class doesn't reset the data dict for every window, because self.init doesn't return data to overwrite the last self.data
Below is the code that may work
demo_custom_agg.py
def init(data):
data = {}
return data
In aggregate.CustomAggregate
async def __call__(self, **kwargs):
now = time.time()
if now - self.last_update > self.window:
self.last_update = now
await self.handler(data=self.data)
self.data = self.init(self.data)
self.agg(self.data, **kwargs)
i fixed the example - thanks for raising this issue!