Hi ML4trading community,
I would like to analyze the trades from a trade journal with pyfolio strategy performance report. I won’t be able to implement the underlying trade strategy in zipline or backtrader. Is it possible to import those trades into pyfolio for such analysis?
Your enlightenment is highly appreciated.
Thanks
Andrew
Yes, but obviously you need to translate your trade journal into something that pyfolio understands, take a look a the pyfolio function extract_rets_pos_txn_from_zipline
API — pyfolio 0.9.3+28.g3dcf744 documentation
If your trade journal is fairly standard and something that other users would potentially be interested in, you could try to implement your own extraction function and make a pull request or just let me know if I could help.
Cheers,
MBounouar
Dear MBounouar,
Thank you for your information.
The trade journal I had is quite simple:
stock, buy date, buy price, buy quantity, sold date, sold price, sold quantity
As I am more a user rather than experienced python developer, I might just see if I can simulate those trades in a zipline backtest and then use pyfolio for analysis.
Thanks
Andrew
Hi,
Actually I should have started by pointing this: pyfolio-loadingdata, ], and where to find the data (https://github.com/stefan-jansen/pyfolio-reloaded/tree/main/pyfolio/tests/test_data). Just follow the format in the csv and you are good to go
Hi MBounouar,
That’s great! I’ll start with these.
Thanks again!
Andrew