Introduction to Zipline and PyFolio
Backtesting is a computational method of assessing how well a trading strategy would have done if it had been applied to historical data. Ideally, this historical data should come from a period of time where there were similar market conditions, such as it having similar volatility to the present and the future.
Backtesting should include all relevant factors, such as slippage and trading costs.
Zipline is one of the most advanced open source Python libraries for algorithmic trading backtesting engines. Its source code can be found at https://github.com/quantopian/zipline. Zipline is a backtesting library ideal for daily trading (you can also backtest weekly, monthly, and so on). It is less suitable for backtesting high-frequency trading strategies.
PyFolio is an open source Python performance and risk analysis library consisting of financial portfolios that's closely integrated with Zipline. You can find its documentation at https...