Pandas help - calculate monthly, quarterly returns and other metrics

255 views
Skip to first unread message

Sarvi Shanmugham

unread,
Aug 11, 2013, 11:32:33 AM8/11/13
to zip...@googlegroups.com
Hi,
I am in the process of adding GUI support for zipline with pyqt and currently working on displaying a table and plots with trailing monthly, quarterterly, biannual returns. I am new to pandas. There must be simple way of doing this in pandas. How so I do this on daily basis, even THough results could be on 5 minute basis.

I suspect involves resample() on daily basis the returns column and then some how for every element after that find trailing 1 month for every day and sum the returns.

Trying to avoid righting unnecessarily long code :-))

Sarvi

Thomas Wiecki

unread,
Aug 11, 2013, 1:17:53 PM8/11/13
to Sarvi Shanmugham, zipline
Hi Sarvi,

Yes, Pandas has fairly powerful resampling support so I suppose that's the right place to start but I don't know how to do it from the top of my head.

However, the different periods are already computed by zipline and stored, as of late, in TradingAlgorithm.risk_report (after a call to .run()) so you might just want to look into that.

Thomas



Sarvi

--
You received this message because you are subscribed to the Google Groups "Zipline Python Opensource Backtester" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zipline+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.



Reply all
Reply to author
Forward
0 new messages