• Allows quick data cleaning and preprocessing
• Provides DataFrame structure for time-series data
• Enables complex data operations with simple syntax
Use it for:
Manipulating and transforming financial market data.
NumPy
• Advanced statistical functions for analysis
• Efficient vectorized operations for large datasets
• Powerful random number generators for simulations
Use it for:
Fast and versatile scientific computing.
SciPy
• Advanced stats and hypothesis testing
• Linear algebra for portfolio optimization
• Efficient numerical routines and model calibration
Use it for:
Optimization and calibration.
Matplotlib
• Integrates with pandas
• Plot financial time series data
• Generate histogram, scatter plots
Use it for:
Fast plotting of market data and summary statistics.
Statsmodels
• Hypothesis testing to test trading strategy efficacy
• Regression analysis for factor analysis and hedging
• Time series analysis with ARIMA and VAR models for forecasting
Use it for:
Regression and statistical analysis.
vectorbt
• High performance to run millions of simulations
• Flexible using NumPy and pandas under the hood
• Easy to use once to get up and running fast
Use it for:
Prototyping trading strategies and optimizing parameters.
Zipline Reloaded
• Create custom data pipelines
• Backtest strategies with realistic data
• Access a vast array of trading algorithms
Use it for:
A realistic market simulation for backtesting.
PyFolio Reloaded
• Detailed portfolio risk analysis
• Integrates with Zipline for backtesting
• Supports custom tear sheets for personalized analytics
• Access financial market data from one place
• Fast Terminal environment for investment research
• SDK for programmatic access to all OpenBB functions
Use it for:
Research and data acquisition.
RiskFolio-Lib
• Optimize asset allocation with 20+ risk measures
• Perform scenario, stress testing, and backtesting
• Tools for risk budgeting and risk contribution
Use it for:
Advanced portfolio optimization and risk management.
This is a long, in-depth thread.
The best way to come back to it?
Click the link here, hop to the top tweet, and retweet it!
My master's degree completely failed to teach me how to test trading strategies.
So I spent 40 hours looking for Python backtesting libraries.
Then I started using the best ones.
But unlike my quant finance degree, these won't cost you $90,000.
Here they are for free.
Zipline
From Quantopian (acquired by Robinhood) the first to democratize quant trading, comes Zipline. It's a robust, fully-featured backtesting library which features slippage models, robust data handing and rich metrics.