pyfolio
pyfolio copied to clipboard
How to use with minute frequency data?
Hello. Is it possible to use pyfolio with minute frequency data?
When I try, I get the error
AttributeError: 'DataFrame' object has no attribute 'amount'
from pyfolio.utils.extract_rets_pos_txn_from_zipline
.
Hi @emin63, there are some quirks of using pyfolio with minutely data — I would resample to daily before passing to pyfolio.
That error seems unrelated, though. What are the columns of your transactions
DataFrame?
Hi, I am also interested in this due to 24/7 trading assets (i.e forex/cryptocurrencies).
Could you please point us into the right direction on how to do this resampling to make the data compatible with pyfolio @gusgordon? I think it is worth of consider including this feature in pyfolio IHMO.
I am new to zipline. Actually I am using enigma which is based in zipline and supports minute frequencies. If I am not mistaken zipline does not.
Thanks.
@vonpupp I agree that it could be a useful feature to have a conversion function.
For your purposes, pyfolio assumes returns and positions are end-of-day. So, for example, when we pass returns into pyfolio for US equities, those are basically the daily returns at 4:00 each day. You could cumulate your minutely returns each day by doing something like:
returns_daily = returns_minutely.add(1).groupby(pd.TimeGrouper('24H')).prod().add(-1)
For the positions, you would just grab the positions at a certain time each day, probably midnight. You can throw out the other minutes' data for positions.
Hope that helps!
Hi, I am also interested in this due to 24/7 trading assets (i.e forex/cryptocurrencies).
Could you please point us into the right direction on how to do this resampling to make the data compatible with pyfolio @gusgordon? I think it is worth of consider including this feature in pyfolio IHMO.
I am new to zipline. Actually I am using enigma which is based in zipline and supports minute frequencies. If I am not mistaken zipline does not.
Thanks.
Did you get pyfolio to work with forex for crypo?