Using Git Branches to Modify and Publish a Trading Analysis Library
Summary
This tutorial presents a workflow for adapting Pyfolio, a Python library for portfolio performance and risk analysis. It outlines the library’s reporting features, including return and risk statistics, rolling measures, drawdowns, and tear sheets, then introduces Git concepts such as commits, branches, merges, history, and remote repositories.
The example clones Pyfolio, installs it for development, creates a separate branch, and changes an optional Zipline import to suppress a warning when that dependency is unavailable. It then describes committing and merging the change and publishing it to a fork or proposing it to the original repository. The walkthrough illustrates version control and contribution practices around a finance tool, rather than testing an investment strategy. Its code discussion is incomplete in places, and the specific dependency change assumes the user does not need Zipline’s futures multipliers; it should not be taken as a general recommendation to remove dependencies.
Key ideas
- Pyfolio can generate portfolio performance and risk reports, including return, volatility, Sharpe ratio, and drawdown measures.
- Git branches let developers work on changes separately before merging them into a main branch.
- Commits preserve identifiable project states that can be reviewed or restored.
- The example modifies an optional Zipline integration and explains the trade-off of omitting its futures multipliers.
- A fork and remote repository provide a way to publish changes for others to use or review.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.