--- id: finlab version: "2.0.17" license: GPL-3.0-or-later license_treatment: copyleft maintenance: active --- # finlab — Analyzing stock has never been easier. License: copyleft · Maintenance: active · Downloads: 77.4K/mo ## What it is and what it does Finlab is a backtesting framework designed for Taiwan stock market analysis. It provides one-line access to historical price and fundamental data for 2000 stocks, integrates seamlessly with pandas for strategy definition, and executes multi-stock backtests with detailed performance reports. Strategies are written using familiar pandas syntax—boolean conditions on rolling windows, resampling logic, and position signals—making it accessible to traders without deep programming expertise. The package combines data retrieval, strategy expression, and backtesting into a unified workflow. It handles multi-frequency data alignment automatically and uses Cython-optimized computation to run backtests on large stock universes in seconds. It also supports machine-learning strategy development via qlib integration. The 10 runtime dependencies (requests, numpy, pandas, pyarrow, lz4, tqdm, jinja2, ipython, scipy, cryptography) provide data fetching, numerical computation, and reporting capabilities. Use it for: - Test a mean-reversion strategy on 2000 Taiwan stocks over a decade of historical data in minutes. - Develop and iterate on technical-indicator-based trading rules using pandas rolling-window operations. - Generate detailed backtest reports with performance metrics to compare strategy variants. - Prototype machine-learning trading strategies using qlib within the finlab framework. - Analyze historical stock performance and identify patterns across Taiwan's equity market. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Backtest trading strategies on Taiwan stock market data by writing simple pandas-based logic, with historical data for 2000 stocks and detailed performance analysis. Yes, with conditions. Install if you are backtesting Taiwan stock strategies and accept GPL-3.0-or-later licensing. The package is actively maintained, supports modern Python versions, and has no known vulnerabilities. Medium install friction from 10 dependencies is typical for data-science workflows. Not suitable if you require proprietary or closed-source derivative work. ## Install pip install finlab uv add finlab poetry add finlab ## Installing finlab Before you install: Medium install friction due to 10 runtime dependencies including numpy, pandas, scipy, and cryptography. Package is actively maintained with recent release history and supports modern Python versions (3.9–3.14) across multiple platforms via precompiled wheels. License in practice: Licensed under GPL-3.0-or-later (copyleft). Any derivative work or distribution must also be open-source under a compatible GPL license; proprietary use or closed-source modifications are not permitted. Quickstart: from finlab import data, backtest close = data.get('price:收盤價') position = close >= close.rolling(300).max() report = backtest.sim(position, resample='M') report.display() Requires Python 3.9 or later; data retrieval depends on finlab's remote database access. Verify before relying: - Whether the 2000 stocks dataset covers all Taiwan-listed companies or a specific subset. - Exact historical data depth and date range available beyond 'past ten years' mentioned in description. - Performance characteristics and typical runtime for backtesting 2000 stocks as claimed. - Whether qlib machine-learning integration is built-in or requires separate installation. ## Package facts - License: GPL-3.0-or-later (copyleft) - Python support: supports_current - Install friction: medium - Maintenance: active - Downloads: 77.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags stock backtesting framework, trading strategy testing, historical stock data taiwan, quantitative trading library, pandas-based strategy backtest, stock market simulation, automated trading analysis, backtesting, quantitative-trading, taiwan-stocks [View on SkillFed](https://skillfed.io/packages/finlab) · [View on PyPI](https://pypi.org/project/finlab/)