{"id":23727,"library":"finlab","title":"FinLab","description":"FinLab is a Python library for Taiwanese stock analysis and backtesting. Current version: 2.0.3. The library provides tools for downloading stock data, technical analysis, and strategy backtesting. It has an active release cadence with breaking changes from v1 to v2.","status":"active","version":"2.0.3","language":"python","source_language":"en","source_url":"https://github.com/finlab/finlab","tags":["taiwan","stock","finance","backtesting"],"install":[{"cmd":"pip install finlab","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"In v2, DataCenter is directly under finlab, not finlab.data.","wrong":"from finlab.data import DataCenter","symbol":"DataCenter","correct":"from finlab import DataCenter"},{"note":"Top-level import changed in v2; previous submodule path no longer works.","wrong":"from finlab.crawl import Crawl","symbol":"Crawl","correct":"from finlab import Crawl"},{"note":"login is a function from finlab, not a method. Import it directly.","wrong":"import finlab; finlab.login()","symbol":"login","correct":"from finlab import login"}],"quickstart":{"code":"import os\nfrom finlab import DataCenter, login\nlogin(os.environ.get('FINLAB_TOKEN', ''))\ndc = DataCenter()\ndf = dc.get('收盤價', symbol='2330')\nprint(df.head())","lang":"python","description":"Authenticate with your token and fetch closing prices for TSMC (2330)."},"warnings":[{"fix":"Migrate to v2 imports: 'from finlab import ...' instead of 'from finlab.data import ...'.","message":"Version 2.0 completely changed the API. Old code using 'finlab.data' or 'finlab.backtest' will fail. No backward compatibility.","severity":"breaking","affected_versions":">=1.0,<2.0.0"},{"fix":"Set FINLAB_TOKEN env var or call login('your_token').","message":"Automatic config file detection is deprecated. You must pass the token explicitly via login() or environment variable FINLAB_TOKEN.","severity":"deprecated","affected_versions":">=2.0.0"},{"fix":"Use Chinese column names like '收盤價', '成交量', etc.","message":"DataCenter.get() expects the column name in Chinese (e.g., '收盤價'), not English. Using English names will raise KeyError.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Use plain stock numbers like '2330'.","message":"The symbol parameter in DataCenter.get() expects a string without any prefix, e.g., '2330' not 'TW2330' or '2330.TW'.","severity":"gotcha","affected_versions":">=2.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Change imports to 'from finlab import DataCenter', etc.","cause":"Using v1 import paths with v2 library.","error":"ModuleNotFoundError: No module named 'finlab.data'"},{"fix":"Use '收盤價' instead of 'close'.","cause":"Using English column names instead of Chinese.","error":"KeyError: 'close'"},{"fix":"Call login('your_token') explicitly.","cause":"In v2, configuration file is no longer supported; need to pass token via login.","error":"FileNotFoundError: [Errno 2] No such file or directory: 'config'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}