Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от koreal6803★ 428 звёзд на GitHub

Об этом скилле

FinLab Quantitative Trading Package

Prerequisites

Before running any FinLab code, verify these in order:

  1. uv is installed (Python package manager):

    uv --version
    

    If uv is not installed, tell the user to install it.

    After installing, ensure uv is on PATH:

    source $HOME/.local/bin/env 2>/dev/null  # Add uv to current shell
    
  2. FinLab 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 run for zero-setup execution (recommended for one-off scripts):

    uv run --with "finlab" python3 script.py
    

    uv run --with auto-creates a temporary environment with dependencies — no venv management needed.

    Prefer zero-install? Run notebooks directly in FinLab Studio — a hosted Jupyter environment with finlab preinstalled and your account already logged in.

  3. 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 login
    
    import finlab
    finlab.login()  # reuses cached credentials, or starts browser login if none
    

    Headless / cron / Docker: on a machine with a browser, log in and run:

    python -m finlab token --env
    

    Set all three exported variables — FINLAB_REFRESH_TOKEN, FINLAB_SESSION_ID, and FINLAB_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_TOKEN and finlab.login('<api_token>') are deprecated. Run python -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/01 date 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 cached data.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 raw filing_date column is not the publication date
  • Report API names on US (creturn / daily_creturn / get_stats(); no get_equity())
  • US backtest defaults for both markets: USMarket (`fee_r
Полный SKILL.md на GitHub

Установить finlab в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

backtesting-reference.mdbest-practices.mdcloud-reference.mddata-reproducibility.mddataframe-reference.mdfactor-analysis-reference.mdfactor-examples.mdmachine-learning-reference.mdus-market.md

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), без исполняемых скриптов.

Похожие скиллы

Сравнить finlab с