finlab
БесплатноБез исполняемых скриптовНе проверенBacktest and research stock strategies with the FinLab Python package on real market data: Taiwan stocks (台股) first, plus US, KR, JP, HK equities and…
от koreal6803★ 428 звёзд на GitHubОб этом скилле
FinLab Quantitative Trading Package
Prerequisites
Before running any FinLab code, verify these in order:
uv is installed (Python package manager):
uv --versionIf uv is not installed, tell the user to install it.
After installing, ensure
uvis on PATH:source $HOME/.local/bin/env 2>/dev/null # Add uv to current shellFinLab is installed via uv (requires >= 2.2.15):
uv python install 3.12 # Ensure Python is available (skip if already installed) uv pip install --system "finlab>=2.2.15" 2>/dev/null || uv pip install "finlab>=2.2.15"Or use
uv runfor zero-setup execution (recommended for one-off scripts):uv run --with "finlab" python3 script.pyuv run --withauto-creates a temporary environment with dependencies — no venv management needed.Prefer zero-install? Run notebooks directly in FinLab Studio — a hosted Jupyter environment with
finlabpreinstalled and your account already logged in.Logged in to FinLab (finlab >= 2.0; no legacy API token required):
Desktop (has a browser): log in once; credentials are cached locally:
python -m finlab loginimport finlab finlab.login() # reuses cached credentials, or starts browser login if noneHeadless / cron / Docker: on a machine with a browser, log in and run:
python -m finlab token --envSet all three exported variables —
FINLAB_REFRESH_TOKEN,FINLAB_SESSION_ID, andFINLAB_API_KEY— in the headless environment. FinLab uses them automatically. Treat the output as credentials: use your platform's secret storage and do not paste it into chat or commit it.Google Colab: run
finlab.login()in a cell and follow the login link.Migrating from legacy tokens:
FINLAB_API_TOKENandfinlab.login('<api_token>')are deprecated. Runpython -m finlab migrate, set up browser login or the three environment variables above, then remove the old token from your configuration.Legacy-token status: No removal version or date is publicly confirmed in the official authentication guide; the
2026/08/01date in client warning text is not a removal announcement. Dropping the client-side fallback and rejecting legacy tokens server-side are separate changes, and a cacheddata.get()call does not test server authentication — use the supported login flow above.
Language
Respond in the user's language. If user writes in Chinese, respond in Chinese. If in English, respond in English.
Market Support
FinLab supports tw (default), us, kr, jp, hk, uk, us_fund (US ETFs/funds), rotc (Taiwan emerging) and tw_cb (Taiwan convertible bonds). Pick the market once per session with data.set_market(<code>); an unprefixed dataset name resolves to the active market's table (price:close → us_price:close under us). A name the active market lacks silently falls back to the TW table: Chinese keys (price:收盤價, monthly_revenue:當月營收) exist only for TW and rotc, so under us, data.get('price:收盤價') returns Taiwan prices. Outside TW, use English keys (price:close) or prefixed names (us_price:adj_close). data.set_market('rotc') (v2.0.9) enables 興櫃 (TW emerging) — use it when you need pre-listing price action or revenue factors that don't exist in the main TSE/OTC catalog. tw_cb is not a set_market code (it raises ValueError): read cb_price:* and pass sim(position, market=TWCBMarket()) (from finlab.markets.tw_cb import TWCBMarket).
The rest of this file plus dataframe-reference.md, backtesting-reference.md, best-practices.md, factor-analysis-reference.md, and machine-learning-reference.md are market-agnostic — the APIs behave the same across markets.
For US-market work — whether single-name equities (data.set_market('us')) or ETFs/funds (data.set_market('us_fund')) — read us-market.md first. Queries that should trigger it include: US equity, S&P 500, NASDAQ 100, 美股, SPY / QQQ, sector SPDRs, leveraged / inverse ETFs, ETF rotation, us_price:*, us_fund_price:*, data.us_universe(...), or us_income_statement:* / us_cash_flow:* / us_balance_sheet:*. It documents:
- Which US data tables are safe for backtesting versus current-snapshot-only (analyst consensus, ratios, DCF are live-only — do not use them historically)
- Quarterly fundamentals aligned on
key_date— no.shift()workaround needed; the rawfiling_datecolumn is not the publication date ReportAPI names on US (creturn/daily_creturn/get_stats(); noget_equity())- US backtest defaults for both markets:
USMarket(`fee_r
Установить finlab в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл finlab?
Backtest and research stock strategies with the FinLab Python package on real market data: Taiwan stocks (台股) first, plus US, KR, JP, HK equities and ETFs/funds. Use whenever the user wants to backtest a strategy, screen stocks, or pull Taiwan stock data such as adjusted prices, monthly revenue, financial statements or institutional flows, even if they never name FinLab: 台股回測, 股票回測, 回測, 選股, 選股策略, 量化交易, 程式交易, 月營收, 三大法人, 財報, 美股回測, backtesting, trading strategies, stock data, stock selection, FinLabDataFrame, factor analysis, quant trading, US equity, S&P 500 / NASDAQ 100, SPY / QQQ, sector or leveraged ETFs, ETF rotation, 美股, or stock market analysis. Includes data access, strategy development, backtesting workflows, best practices, and US-market specifics (data availability map, filing-date-aligned quarterly fundamentals, US universe construction, USMarket vs. USFundMarket defaults, and ETF backtesting).
Как установить скилл finlab?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл finlab запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic