FinLab Getting Started: Build Your First Backtest in 3 Minutes
The fastest path is to choose an execution environment, download closing price data, write the first stock-selection condition, then run backtest.sim(). If you want AI-assisted strategy writing, start directly from studio.finlab.tw.
| Use case | Recommended entry | Next step |
|---|---|---|
| No installation, test a strategy immediately | studio.finlab.tw |
Describe the strategy in natural language |
| First time using FinLab | Google Colab | Run the examples on this page |
| Existing Python environment | Local pip install finlab |
Download data and backtest |
| Complex dependency environment | Docker | Open JupyterLab |
Related guides: Data Download, Backtesting, and FAQ.
Installation
We recommend starting with the AI workflow used on the FinLab homepage. Install the Python package only when you want to write Python or notebooks yourself. Supports Windows, macOS, Linux, and Colab; Docker also available.
Install Codex or Claude Desktop first, then give this prompt to AI:
Run npx skills add https://github.com/koreal6803/finlab-ai --skill finlab, then backtest: "a multi-factor stock selection strategy"
Once installed, you can ask AI in natural language to query Taiwan / US data, write strategies, run backtests, and interpret performance.
Requirement
Requires Node.js 18+. After installing Codex or Claude Desktop, re-run the command above.
Visit studio.finlab.tw to write strategies through AI conversation — no installation required.
Compatibility note
If you encounter dependency issues, try the Docker version instead.
Download Data
Use the following code to download data. You can browse available datasets.
Write a Strategy
Use simple Pandas syntax to write strategy logic. For example, a 300-day high breakout strategy: