vectorbt icon indicating copy to clipboard operation
vectorbt copied to clipboard

Portfolio.stats consumes large amount of memory.

Open shaft3796 opened this issue 2 years ago • 1 comments

With my current data and code setup, a portfolio.stats call to one of my portfolio takes more than 1GB, however the return value of the stats call takes only 0.02GB.

I guess it's because there is some caching by the stats method under the hood. If it's the issue, is there a way to disable such caching, I don't see why I would need it. I have to run the stats call on multiple portfolios so even with large amount of memory, I'm quickly limited.

Thanks you btw, great tool 👍

shaft3796 avatar Apr 25 '24 06:04 shaft3796

I found workaround consisting of running the .stats call in a separate process, getting the result using a queue and killing the process. I can now get the result of .stats call without the +1GB memory still allocated. But let's be honest, this is not the cleanest code I have wrote 😅

shaft3796 avatar Apr 25 '24 06:04 shaft3796