- Solve real problems with our hands-on interface
- Progress from basic puts and calls to advanced strategies

Posted March 10, 2023 at 8:55 am
A must-have tool for any individual programmer or development team is version control software. In this post, we introduce you to Git/Github to modify an open source project such as the Pyfolio library.
Topics covered:
One of the basic principles of software engineering is not to reinvent the wheel. Well developed pieces of software can be used over and over again in multiple projects.
Python and its ecosystem of open source libraries allow us to build software using the work of countless development teams and individual programmers.
Every Python project uses libraries in one way or another. These are nothing more than pieces of software that package classes and functions with specific functionalities such as:
These libraries are generic and flexible enough to adapt to any software we are building and save us a lot of time by not having to implement from scratch the functionality that these libraries offer.
In our trading environment, a recurring need for all projects is a performance analysis of our strategies. It would not make sense to code our statistics over and over again, so having a performance analysis library is a necessity.
We can either build our own library that calculates:
and a myriad of performance parameters. Or we can use an existing library and improve it if possible, with our own performance indicators.
In this post, we are going to modify an open-source and free software library pyfolio to adapt it to our needs and maybe our changes will be useful for the community. We will release our modification so that other developers can benefit from it. In the process, we will also learn how to use the Git/GitHub tools to control changes and software versions.
Pyfolio is distributed under Apache 2.0 license, which allows us to modify the code, distribute it and even commercialize it. However, it is worth reading the license agreement, at least one time in your life.
Here we will not go into the many licenses under which open and/or free source is distributed nor into the philosophy.
Pyfolio is a performance and risk analysis python library for financial portfolios developed by Quantopian Inc.
Note: This company has stopped its operations although their libraries are still alive on the Internet.
Pyfolio is a comprehensive library that generates performance reports that cover the basic needs of any analyst quite well.
Outstanding features of Pyfolio:
All these features make the Pyfolio library something to consider. The library is flexible enough to effectively cover a performance analysis of a strategy or portfolio.
Git is a distributed version and changes control software developed by Linus Torvalds and currently owned by Microsoft. It is a tool that allows controlling changes and versions in the software over time, with ease to recover the code in any of its previous states.
It allows distributed development, where different teams of programmers can make changes and generate their own versions or contribute their work to the main version.
Basically, Git is a code repository associated with each individual project that we update through commits.
Outstanding features of Git:
This functionality alone is enough to merit the attention of any individual developer and even more so for development teams working on the same project.
The GitHub tool is nothing more than a Git server in the cloud that allows us to publish our Git repositories on the Internet so that any other developer can use the code or contribute with her own development.
It also has a very interesting tool such as the ticket manager to manage bugs or improvements in the software and other tools to help in collaborative development.
Stay tuned for part II to learn about getting the pyfolio source code.
Originally posted on QuantInsti Blog.
Information posted on IBKR Campus that is provided by third-parties does NOT constitute a recommendation that you should contract for the services of that third party. Third-party participants who contribute to IBKR Campus are independent of Interactive Brokers and Interactive Brokers does not make any representations or warranties concerning the services offered, their past or future performance, or the accuracy of the information provided by the third party. Past performance is no guarantee of future results.
This material is from QuantInsti and is being posted with its permission. The views expressed in this material are solely those of the author and/or QuantInsti and Interactive Brokers is not endorsing or recommending any investment or trading discussed in the material. This material is not and should not be construed as an offer to buy or sell any security. It should not be construed as research or investment advice or a recommendation to buy, sell or hold any security or commodity. This material does not and is not intended to take into account the particular financial conditions, investment objectives or requirements of individual customers. Before acting on this material, you should consider whether it is suitable for your particular circumstances and, as necessary, seek professional advice.
Join The Conversation
For specific platform feedback and suggestions, please submit it directly to our team using these instructions.
If you have an account-specific question or concern, please reach out to Client Services.
We encourage you to look through our FAQs before posting. Your question may already be covered!