# finlab

Provides guidelines for quant trading and backtesting with the FinLab library. Useful when building stock and ETF strategies for US and Asian markets.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 1900 installs · ★ 417
- Author: koreal6803
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/koreal6803/finlab-ai/tree/HEAD/skills/finlab/SKILL.md
- Updated: 2026-10-24
- HTML: https://affpapa.org/en/nevibecode/skills/finlab

## What it does

The skill guides coding assistants in using the FinLab package (version 2.0.0 or newer). It defines patterns for data retrieval and backtest execution using the `sim` module. Supported instruments include equities and ETFs across US and Asian exchanges.

Prerequisites include Python 3.10+ and the `uv` package manager. Authentication on desktop uses `python -m finlab login`. For headless servers and Docker, users configure three variables: `FINLAB_REFRESH_TOKEN`, `FINLAB_SESSION_ID`, and `FINLAB_API_KEY`. The legacy token is deprecated.

Market scope is switched using `data.set_market()`. If a requested dataset does not exist in the active foreign market, FinLab silently falls back to Taiwan tables. This behavior can quietly corrupt backtest calculations if left unchecked. Free accounts get a 500 MB daily quota that resets at 8:00 AM UTC+8.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add koreal6803/finlab-ai --skill finlab -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/finlab/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/finlab/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add koreal6803/finlab-ai --skill finlab -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/finlab/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add koreal6803/finlab-ai --skill finlab -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/finlab/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install koreal6803/finlab-ai finlab
```

2. **Manually: put the files in place**
- File: `.github/skills/finlab/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add koreal6803/finlab-ai --skill finlab -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/koreal6803/finlab-ai --path skills/finlab
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/finlab/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add koreal6803/finlab-ai --skill finlab -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/koreal6803/finlab-ai/tree/HEAD/skills/finlab/SKILL.md

## When to use it
- run backtests on equities or ETFs using the sim runner
- fetch historical market data for US or Asian tickers
- configure headless environment tokens for Docker or cron
- inspect remaining daily data quota through the CLI

## Example prompts
- Write a backtest script for US ETFs using USFundMarket.
- How do I set up FinLab credentials for a headless Docker container?
- Show how to switch data market to us and query closing prices.

## Similar
- [quant-analyst](https://affpapa.org/en/nevibecode/agents/quant-analyst.md) — subagent · 1366 installs
- [backtest-expert](https://affpapa.org/en/nevibecode/skills/backtest-expert.md) — skill · 4200 installs
- [stockbee-20pct-study](https://affpapa.org/en/nevibecode/skills/stockbee-20pct-study.md) — skill · 2600 installs
- [longbridge-intel](https://affpapa.org/en/nevibecode/skills/longbridge-intel.md) — skill · 3200 installs
- [backtesting-frameworks](https://affpapa.org/en/nevibecode/skills/backtesting-frameworks.md) — skill · 16710 installs
- [llmquant-equities](https://affpapa.org/en/nevibecode/skills/llmquant-equities.md) — skill · 514 installs

From the same set: [koreal6803/finlab-ai](https://affpapa.org/en/nevibecode/by/koreal6803/finlab-ai.md) — 2 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
