Back to skills
SkillHub ClubShip Full StackFull Stack

finviz-screener

Build and open FinViz screener URLs from natural language requests. Use when user wants to screen stocks, find stocks matching criteria, filter by fundamentals or technicals, or asks to open FinViz with specific conditions. Supports both Japanese and English input (e.g., "高配当で成長している小型株を探したい", "Find oversold large caps with high ROE").

Packaged view

This page reorganizes the original catalog entry around fit, installability, and workflow context first. The original raw source lives below.

Stars
327
Hot score
99
Updated
March 20, 2026
Overall rating
C3.4
Composite score
3.4
Best-practice grade
B73.6

Install command

npx @skill-hub/cli install tradermonty-claude-trading-skills-finviz-screener

Repository

tradermonty/claude-trading-skills

Skill path: skills/finviz-screener

Build and open FinViz screener URLs from natural language requests. Use when user wants to screen stocks, find stocks matching criteria, filter by fundamentals or technicals, or asks to open FinViz with specific conditions. Supports both Japanese and English input (e.g., "高配当で成長している小型株を探したい", "Find oversold large caps with high ROE").

Open repository

Best for

Primary workflow: Ship Full Stack.

Technical facets: Full Stack.

Target audience: everyone.

License: Unknown.

Original source

Catalog source: SkillHub Club.

Repository owner: tradermonty.

This is still a mirrored public skill entry. Review the repository before installing into production workflows.

What it helps with

  • Install finviz-screener into Claude Code, Codex CLI, Gemini CLI, or OpenCode workflows
  • Review https://github.com/tradermonty/claude-trading-skills before adding finviz-screener to shared team environments
  • Use finviz-screener for development workflows

Works across

Claude CodeCodex CLIGemini CLIOpenCode

Favorites: 0.

Sub-skills: 0.

Aggregator: No.

Original source / Raw SKILL.md

---
name: finviz-screener
description: Build and open FinViz screener URLs from natural language requests. Use when user wants to screen stocks, find stocks matching criteria, filter by fundamentals or technicals, or asks to open FinViz with specific conditions. Supports both Japanese and English input (e.g., "高配当で成長している小型株を探したい", "Find oversold large caps with high ROE").
---

# FinViz Screener

## Overview

Translate natural-language stock screening requests into FinViz screener filter codes, build the URL, and open it in Chrome. No API key required for public screener; FINVIZ Elite is auto-detected from `$FINVIZ_API_KEY` for enhanced functionality.

**Key Features:**
- Natural language → filter code mapping (Japanese + English)
- URL construction with view type and sort order selection
- Elite/Public auto-detection (environment variable or explicit flag)
- Chrome-first browser opening with OS-appropriate fallbacks
- Strict filter validation to prevent URL injection

---

## When to Use This Skill

**Explicit Triggers:**
- "高配当で成長している小型株を探したい"
- "Find oversold large caps near 52-week lows"
- "テクノロジーセクターの割安株をスクリーニングしたい"
- "Screen for stocks with insider buying"
- "FinVizでブレイクアウト候補を表示して"
- "Show me high-growth small caps on FinViz"
- "配当利回り5%以上でROE15%以上の銘柄を探して"

**Implicit Triggers:**
- User describes stock screening criteria using fundamental or technical terms
- User mentions FinViz screener or stock filtering
- User asks to find stocks matching specific financial characteristics

**When NOT to Use:**
- Deep fundamental analysis of a specific stock (use us-stock-analysis)
- Portfolio review with holdings (use portfolio-manager)
- Chart pattern analysis on images (use technical-analyst)
- Earnings-based screening (use earnings-trade-analyzer or pead-screener)

---

## Workflow

### Step 1: Load Filter Reference

Read the filter knowledge base:

```bash
cat references/finviz_screener_filters.md
```

### Step 2: Interpret User Request

Map the user's natural-language request to FinViz filter codes. Use the Common Concept Mapping table below for quick translation, and reference the full filter list for precise code selection.

**Note:** For range criteria (e.g., "dividend 3-8%", "P/E between 10 and 20"), use the `{from}to{to}` range syntax as a single filter token (e.g., `fa_div_3to8`, `fa_pe_10to20`) instead of combining separate `_o` and `_u` filters.

**Common Concept Mapping:**

| User Concept (EN) | User Concept (JP) | Filter Codes |
|---|---|---|
| High dividend | 高配当 | `fa_div_o3` or `fa_div_o5` |
| Small cap | 小型株 | `cap_small` |
| Mid cap | 中型株 | `cap_mid` |
| Large cap | 大型株 | `cap_large` |
| Mega cap | 超大型株 | `cap_mega` |
| Value / cheap | 割安 | `fa_pe_u20,fa_pb_u2` |
| Growth stock | 成長株 | `fa_epsqoq_o25,fa_salesqoq_o15` |
| Oversold | 売られすぎ | `ta_rsi_os30` |
| Overbought | 買われすぎ | `ta_rsi_ob70` |
| Near 52W high | 52週高値付近 | `ta_highlow52w_b0to5h` |
| Near 52W low | 52週安値付近 | `ta_highlow52w_a0to5l` |
| Breakout | ブレイクアウト | `ta_highlow52w_b0to5h,sh_relvol_o1.5` |
| Technology | テクノロジー | `sec_technology` |
| Healthcare | ヘルスケア | `sec_healthcare` |
| Energy | エネルギー | `sec_energy` |
| Financial | 金融 | `sec_financial` |
| Semiconductors | 半導体 | `ind_semiconductors` |
| Biotechnology | バイオテク | `ind_biotechnology` |
| US stocks | 米国株 | `geo_usa` |
| Profitable | 黒字 | `fa_pe_profitable` |
| High ROE | 高ROE | `fa_roe_o15` or `fa_roe_o20` |
| Low debt | 低負債 | `fa_debteq_u0.5` |
| Insider buying | インサイダー買い | `sh_insidertrans_verypos` |
| Short squeeze | ショートスクイーズ | `sh_short_o20,sh_relvol_o2` |
| Dividend growth | 増配 | `fa_divgrowth_3yo10` |
| Deep value | ディープバリュー | `fa_pb_u1,fa_pe_u10` |
| Momentum | モメンタム | `ta_perf_13wup,ta_sma50_pa,ta_sma200_pa` |
| Defensive | ディフェンシブ | `ta_beta_u0.5` or `sec_utilities,sec_consumerdefensive` |
| Liquid / high volume | 高出来高 | `sh_avgvol_o500` or `sh_avgvol_o1000` |
| Pullback from high | 高値からの押し目 | `ta_highlow52w_10to30-bhx` |
| Near 52W low reversal | 安値圏リバーサル | `ta_highlow52w_10to30-alx` |
| Fallen angel | 急落後反発 | `ta_highlow52w_b20to30h,ta_rsi_os40` |
| AI theme | AIテーマ | `--themes "artificialintelligence"` |
| Cybersecurity theme | サイバーセキュリティ | `--themes "cybersecurity"` |
| AI + Cybersecurity | AI&サイバーセキュリティ | `--themes "artificialintelligence,cybersecurity"` |
| AI Cloud sub-theme | AIクラウド | `--subthemes "aicloud"` |
| AI Compute sub-theme | AI半導体 | `--subthemes "aicompute"` |
| Yield 3-8% (trap excluded) | 配当3-8%(トラップ除外)| `fa_div_3to8` |
| Mid-range P/E | 適正PER帯 | `fa_pe_10to20` |
| EV undervalued | EV割安 | `fa_evebitda_u10` |
| Earnings next week | 来週決算 | `earningsdate_nextweek` |
| IPO recent | 直近IPO | `ipodate_thismonth` |
| Target price above | 目標株価以上 | `targetprice_a20` |
| Recent news | 最新ニュースあり | `news_date_today` |
| High institutional | 機関保有率高 | `sh_instown_o60` |
| Low float | 浮動株少 | `sh_float_u20` |
| Near all-time high | 史上最高値付近 | `ta_alltime_b0to5h` |
| High ATR | 高ボラティリティ | `ta_averagetruerange_o1.5` |

### Step 3: Present Filter Selection

Before executing, present the selected filters in a table for user confirmation:

```markdown
| Type | Value | Meaning |
|---|---|---|
| Theme | artificialintelligence | Artificial Intelligence |
| Sub-theme | aicloud | AI - Cloud & Infrastructure |
| Filter | cap_small | Small Cap ($300M–$2B) |
| Filter | fa_div_o3 | Dividend Yield > 3% |
| Filter | fa_pe_u20 | P/E < 20 |
| Filter | geo_usa | USA |

View: Overview (v=111)
Mode: Public / Elite (auto-detected)
```

Ask the user to confirm or adjust before proceeding.

### Step 4: Execute Script

Run the screener script to build the URL and open Chrome:

```bash
python3 scripts/open_finviz_screener.py \
  --filters "cap_small,fa_div_o3,fa_pe_u20,geo_usa" \
  --view overview

# Theme-only screening (no --filters required)
python3 scripts/open_finviz_screener.py \
  --themes "artificialintelligence,cybersecurity" \
  --url-only

# Theme + sub-theme + filters combined
python3 scripts/open_finviz_screener.py \
  --themes "artificialintelligence" \
  --subthemes "aicloud,aicompute" \
  --filters "cap_midover" \
  --url-only
```

**Script arguments:**
- `--filters` (optional): Comma-separated filter codes. **Note:** `theme_*` and `subtheme_*` tokens are not allowed here — use `--themes` / `--subthemes` instead.
- `--themes` (optional): Comma-separated theme slugs (e.g., `artificialintelligence,cybersecurity`). Accepts bare slugs or `theme_`-prefixed values.
- `--subthemes` (optional): Comma-separated sub-theme slugs (e.g., `aicloud,aicompute`). Accepts bare slugs or `subtheme_`-prefixed values.
- `--elite`: Force Elite mode (auto-detected from `$FINVIZ_API_KEY` if not set)
- `--view`: View type — overview, valuation, financial, technical, ownership, performance, custom
- `--order`: Sort order (e.g., `-marketcap`, `dividendyield`, `-change`)
- `--url-only`: Print URL without opening browser

At least one of `--filters`, `--themes`, or `--subthemes` must be provided.

### Step 5: Report Results

After opening the screener, report:
1. The constructed URL
2. Elite or Public mode used
3. Summary of applied filters
4. Suggested next steps (e.g., "Sort by dividend yield", "Switch to Financial view for detailed ratios")

---

## Usage Recipes

Real-world screening patterns distilled from repeated use. Each recipe includes a starter filter set, recommended view, and tips for iterative refinement.

### Recipe 1: High-Dividend Growth Stocks (Kanchi-Style)

**Goal:** High yield + dividend growth + earnings growth, excluding yield traps.

```
--filters "fa_div_3to8,fa_sales5years_pos,fa_eps5years_pos,fa_divgrowth_5ypos,fa_payoutratio_u60,geo_usa"
--view financial
```

| Filter Code | Purpose |
|---|---|
| `fa_div_3to8` | Yield 3-8% (caps high-yield traps) |
| `fa_sales5years_pos` | Positive 5Y revenue growth |
| `fa_eps5years_pos` | Positive 5Y EPS growth |
| `fa_divgrowth_5ypos` | Positive 5Y dividend growth |
| `fa_payoutratio_u60` | Payout ratio < 60% (sustainability) |
| `geo_usa` | US-listed stocks |

**Iterative refinement:** Start broad with `fa_div_o3` → review results → add `fa_div_3to8` to cap yield → add `fa_payoutratio_u60` to exclude traps → switch to `financial` view for payout and growth columns.

### Recipe 2: Minervini Trend Template + VCP

**Goal:** Stocks in a Stage 2 uptrend with volatility contraction (VCP setup).

```
--filters "ta_sma50_pa,ta_sma200_pa,ta_sma200_sb50,ta_highlow52w_0to25-bhx,ta_perf_26wup,sh_avgvol_o300,cap_midover"
--view technical
```

| Filter Code | Purpose |
|---|---|
| `ta_sma50_pa` | Price above 50-day SMA |
| `ta_sma200_pa` | Price above 200-day SMA |
| `ta_sma200_sb50` | 200 SMA below 50 SMA (uptrend) |
| `ta_highlow52w_0to25-bhx` | Within 25% of 52W high |
| `ta_perf_26wup` | Positive 26-week performance |
| `sh_avgvol_o300` | Avg volume > 300K |
| `cap_midover` | Mid cap and above |

**VCP tightening filters (add to narrow):** `ta_volatility_wo3,ta_highlow20d_b0to5h,sh_relvol_u1` — low weekly volatility, near 20-day high, below-average relative volume (contraction signal).

### Recipe 3: Unfairly Sold-Off Growth Stocks

**Goal:** Fundamentally strong companies with recent sharp declines — potential mean reversion candidates.

```
--filters "fa_sales5years_o5,fa_eps5years_o10,fa_roe_o15,fa_salesqoq_pos,fa_epsqoq_pos,ta_perf_13wdown,ta_highlow52w_10to30-bhx,cap_large,sh_avgvol_o200"
--view overview
```

| Filter Code | Purpose |
|---|---|
| `fa_sales5years_o5` | 5Y sales growth > 5% |
| `fa_eps5years_o10` | 5Y EPS growth > 10% |
| `fa_roe_o15` | ROE > 15% |
| `fa_salesqoq_pos` | Positive QoQ sales growth |
| `fa_epsqoq_pos` | Positive QoQ EPS growth |
| `ta_perf_13wdown` | Negative 13-week performance |
| `ta_highlow52w_10to30-bhx` | 10-30% below 52W high |
| `cap_large` | Large cap |
| `sh_avgvol_o200` | Avg volume > 200K |

**After review:** Switch to `valuation` view to check P/E and P/S for entry attractiveness.

### Recipe 4: Turnaround Stocks

**Goal:** Companies with previously declining earnings now showing recovery — bottom-fishing with fundamental confirmation.

```
--filters "fa_eps5years_neg,fa_epsqoq_pos,fa_salesqoq_pos,ta_highlow52w_b30h,ta_perf_13wup,cap_smallover,sh_avgvol_o200"
--view performance
```

| Filter Code | Purpose |
|---|---|
| `fa_eps5years_neg` | Negative 5Y EPS growth (prior decline) |
| `fa_epsqoq_pos` | Positive QoQ EPS growth (recovery) |
| `fa_salesqoq_pos` | Positive QoQ sales growth (recovery) |
| `ta_highlow52w_b30h` | Within 30% of 52W high (not at bottom) |
| `ta_perf_13wup` | Positive 13-week performance |
| `cap_smallover` | Small cap and above |
| `sh_avgvol_o200` | Avg volume > 200K |

### Recipe 5: Momentum Trade Candidates

**Goal:** Short-term momentum leaders near 52W highs with increasing volume.

```
--filters "ta_sma50_pa,ta_sma200_pa,ta_highlow52w_b0to3h,ta_perf_4wup,sh_relvol_o1.5,sh_avgvol_o1000,cap_midover"
--view technical
```

| Filter Code | Purpose |
|---|---|
| `ta_sma50_pa` | Price above 50-day SMA |
| `ta_sma200_pa` | Price above 200-day SMA |
| `ta_highlow52w_b0to3h` | Within 3% of 52W high |
| `ta_perf_4wup` | Positive 4-week performance |
| `sh_relvol_o1.5` | Relative volume > 1.5x |
| `sh_avgvol_o1000` | Avg volume > 1M |
| `cap_midover` | Mid cap and above |

### Recipe 6: Theme Screening (AI + Sub-theme Drill-Down)

**Goal:** Find mid-cap+ AI stocks focused on cloud infrastructure and compute acceleration.

```
--themes "artificialintelligence"
--subthemes "aicloud,aicompute"
--filters "cap_midover"
--view overview
```

| Type | Value | Purpose |
|---|---|---|
| Theme | `artificialintelligence` | AI theme universe |
| Sub-theme | `aicloud` | Cloud & Infrastructure vertical |
| Sub-theme | `aicompute` | Compute & Acceleration vertical |
| Filter | `cap_midover` | Mid cap and above |

**Multi-theme example:** `--themes "artificialintelligence,cybersecurity"` selects stocks tagged with either theme (OR logic via `|` grouping).

### Tips: Iterative Refinement Pattern

Screening works best as a dialogue, not a one-shot query:

1. **Start broad** — use 3-4 core filters to get an initial result set
2. **Review count** — if too many results (>100), add tightening filters; if too few (<5), relax constraints
3. **Switch views** — start with `overview` for a quick scan, then switch to `financial` or `valuation` for deeper inspection
4. **Layer in technicals** — after confirming fundamental quality, add `ta_` filters to time entries
5. **Save and iterate** — bookmark the URL, then adjust one filter at a time to understand its impact

---

## Resources

- `references/finviz_screener_filters.md` — Complete filter code reference with natural language keywords (includes industry code examples; full 142-code list is in the Industry Codes section)
- `scripts/open_finviz_screener.py` — URL builder and Chrome opener


---

## Referenced Files

> The following files are referenced in this skill and included for context.

### references/finviz_screener_filters.md

```markdown
# FinViz Screener Filter Reference


This reference maps FinViz screener filter codes to their meanings and natural-language keywords (English + Japanese). Claude uses this document to translate user intent into valid FinViz filter codes.


---


## URL Format


**Public (free):**

```

https://finviz.com/screener.ashx?v={view}&f={filters}&o={order}&s={signal}

```


**Elite (paid subscription):**

```

https://elite.finviz.com/screener.ashx?v={view}&f={filters}&o={order}&s={signal}

```


**Parameters:**

- `v` — View type code (see View Types below)

- `f` — Comma-separated filter codes (e.g., `cap_small,fa_div_o3,fa_pe_u20`)

- `o` — Sort order (optional; prefix `-` for descending, e.g., `-marketcap`)

**Range Filter Pattern `{from}to{to}`:**

Many filters support a range syntax: `{prefix}_{from}to{to}`. This creates a single filter that means "between {from} and {to}".

- Example: `fa_div_3to8` = Dividend Yield 3% to 8%
- Example: `fa_pe_10to20` = P/E 10 to 20
- Example: `ta_beta_0.5to1.5` = Beta 0.5 to 1.5

This range syntax is supported on the FinViz website but is **not registered in the finviz Python library**. Use range codes directly in the URL `f=` parameter. Range filters are more precise than combining two separate `_o` / `_u` filters, and they work as a single filter token.

- `t` — Ticker symbols (optional; comma-separated, e.g., `AAPL,MSFT`)

- `s` — Signal filter (optional; see Signal Filters below)


---


## Signal Filters (`s=` parameter)


Signals are passed via the `s=` URL parameter (not in the `f=` filter string).

Common signals:


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_topgainers` | Top Gainers | gainers, 値上がり上位 |
| `ta_toplosers` | Top Losers | losers, 値下がり上位 |
| `ta_newhigh` | New High | new high, 新高値 |
| `ta_newlow` | New Low | new low, 新安値 |
| `ta_mostvolatile` | Most Volatile | volatile, 高ボラ |
| `ta_mostactive` | Most Active | active, 活発 |
| `ta_unusualvolume` | Unusual Volume | unusual volume, 異常出来高 |
| `ta_overbought` | Overbought | overbought, 買われすぎ |
| `ta_oversold` | Oversold | oversold, 売られすぎ |
| `ta_downgrades` | Downgrades | downgrade, 格下げ |
| `ta_upgrades` | Upgrades | upgrade, 格上げ |
| `ta_earnbefore` | Earnings Before | earnings before market |
| `ta_earnafter` | Earnings After | earnings after market |
| `n_majornews` | Major News | major news, 重大ニュース |
| `ta_p_wedgeup` | Wedge Up |  |
| `ta_p_wedgedown` | Wedge Down |  |
| `ta_p_tri_ascending` | Triangle Ascending |  |
| `ta_p_tri_descending` | Triangle Descending |  |
| `ta_p_channelup` | Channel Up |  |
| `ta_p_channeldown` | Channel Down |  |
| `ta_p_channel` | Channel |  |
| `ta_p_doubletop` | Double Top |  |
| `ta_p_doublebottom` | Double Bottom |  |
| `ta_p_headandshoulders` | Head and Shoulders |  |
| `ta_p_headandshouldersinv` | Head and Shoulders Inverse |  |

---


## View Types


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `111` | Overview — ticker, company, sector, industry, country, market cap, P/E, price, change, volume | overview, 概要, 一覧 |
| `121` | Valuation — market cap, P/E, Forward P/E, PEG, P/S, P/B, P/Cash, P/FCF, EPS, dividend yield | valuation, バリュエーション, 割安度 |
| `131` | Ownership — market cap, outstanding shares, float, insider/institutional ownership, short float | ownership, 所有, 株主構成 |
| `141` | Performance — performance periods (day to 10Y), volatility, RSI, SMA | performance, パフォーマンス, 騰落率 |
| `152` | Custom — user-defined columns | custom, カスタム |
| `161` | Financial — market cap, dividend yield, ROA, ROE, ROI, ratios, margins | financial, 財務, ファイナンシャル |
| `171` | Technical — RSI, SMA20/50/200, 52W High/Low, pattern, candlestick, beta, ATR | technical, テクニカル, チャート指標 |

---


## Sort Order Codes


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ticker` | Ticker A→Z | ticker, ティッカー |
| `-ticker` | Ticker Z→A |  |
| `company` | Company name A→Z | company, 会社名 |
| `sector` | Sector | sector, セクター |
| `industry` | Industry | industry, 業種 |
| `country` | Country | country, 国 |
| `marketcap` | Market Cap (ascending) | market cap, 時価総額, 小さい順 |
| `-marketcap` | Market Cap (descending) | 時価総額大きい順 |
| `pe` | P/E (ascending) | PE, PER |
| `-pe` | P/E (descending) |  |
| `forwardpe` | Forward P/E (ascending) | forward PE |
| `eps` | EPS (ascending) | EPS |
| `dividendyield` | Dividend Yield (ascending) | dividend, 配当, 利回り |
| `-dividendyield` | Dividend Yield (descending) | 高配当順 |
| `price` | Price (ascending) | price, 株価 |
| `-price` | Price (descending) |  |
| `change` | Change (ascending) | change, 変動率 |
| `-change` | Change (descending) |  |
| `volume` | Volume (ascending) | volume, 出来高 |
| `-volume` | Volume (descending) | 出来高大きい順 |
| `recom` | Analyst Recommendation | recommendation, アナリスト推奨 |
| `earningsdate` | Earnings Date | earnings date, 決算日 |
| `targetprice` | Target Price | target price, 目標株価 |
| `shortfloat` | Short Float | short float |
| `averagevolume` | Average Volume | average volume |
| `relativevolume` | Relative Volume | relative volume |

---


## Descriptive Filters


### Exchange (`exch_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `exch_amex` | AMEX | AMEX |
| `exch_cboe` | CBOE | CBOE |
| `exch_nasd` | NASDAQ | NASDAQ, ナスダック |
| `exch_nyse` | NYSE | NYSE, ニューヨーク証券取引所 |

### Index (`idx_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `idx_sp500` | S&P 500 | S&P 500, S&P500 |
| `idx_dji` | Dow Jones | Dow, ダウ, ダウ工業 |
| `idx_ndx` | NASDAQ 100 | NASDAQ 100, ナスダック100 |
| `idx_rut` | Russell 2000 | Russell 2000, ラッセル2000, 小型株指数 |

### Sector (`sec_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `sec_basicmaterials` | Basic Materials | basic materials, 素材, 原材料 |
| `sec_communicationservices` | Communication Services | communication, 通信, メディア |
| `sec_consumercyclical` | Consumer Cyclical | consumer cyclical, 一般消費財, 景気敏感消費 |
| `sec_consumerdefensive` | Consumer Defensive | consumer defensive, 生活必需品, ディフェンシブ消費 |
| `sec_energy` | Energy | energy, エネルギー, 石油 |
| `sec_financial` | Financial | financial, 金融, 銀行 |
| `sec_healthcare` | Healthcare | healthcare, ヘルスケア, 医療 |
| `sec_industrials` | Industrials | industrials, 資本財, 産業 |
| `sec_realestate` | Real Estate | real estate, 不動産, REIT |
| `sec_technology` | Technology | technology, テクノロジー, ハイテク, IT |
| `sec_utilities` | Utilities | utilities, 公益, 電力, ガス |

### Market Cap (`cap_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `cap_mega` | Mega ($200B+) | mega cap, メガキャップ, 超大型 |
| `cap_large` | Large ($10B–$200B) | large cap, ラージキャップ, 大型 |
| `cap_mid` | Mid ($2B–$10B) | mid cap, ミッドキャップ, 中型 |
| `cap_small` | Small ($300M–$2B) | small cap, スモールキャップ, 小型 |
| `cap_micro` | Micro ($50M–$300M) | micro cap, マイクロキャップ, 超小型 |
| `cap_nano` | Nano (under $50M) | nano cap, ナノキャップ |
| `cap_largeover` | +Large ($10B+) | large+, 大型以上 |
| `cap_midover` | +Mid ($2B+) | mid+, 中型以上 |
| `cap_smallover` | +Small ($300M+) | small+, 小型以上 |
| `cap_microover` | +Micro ($50M+) | micro+, 超小型以上 |
| `cap_largeunder` | -Large (under $200B) | large以下 |
| `cap_midunder` | -Mid (under $10B) | mid以下 |
| `cap_smallunder` | -Small (under $2B) | small以下 |
| `cap_microunder` | -Micro (under $300M) | micro以下 |

### Country (`geo_`)


Common countries:


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `geo_usa` | USA | USA, アメリカ, 米国 |
| `geo_notusa` | Foreign (ex-USA) | foreign, 外国, 海外, ADR |
| `geo_asia` | Asia | Asia, アジア |
| `geo_europe` | Europe | Europe, ヨーロッパ, 欧州 |
| `geo_latinamerica` | Latin America | Latin America, 中南米 |
| `geo_bric` | BRIC | BRIC |
| `geo_china` | China | China, 中国 |
| `geo_chinahongkong` | China & Hong Kong |  |
| `geo_japan` | Japan | Japan, 日本 |
| `geo_india` | India | India, インド |
| `geo_unitedkingdom` | United Kingdom | UK, イギリス |
| `geo_canada` | Canada | Canada, カナダ |
| `geo_germany` | Germany | Germany, ドイツ |
| `geo_france` | France | France, フランス |
| `geo_brazil` | Brazil | Brazil, ブラジル |
| `geo_southkorea` | South Korea | South Korea, 韓国 |
| `geo_taiwan` | Taiwan | Taiwan, 台湾 |
| `geo_israel` | Israel | Israel, イスラエル |
| `geo_australia` | Australia | Australia, オーストラリア |
| `geo_switzerland` | Switzerland | Switzerland, スイス |
| `geo_netherlands` | Netherlands | Netherlands, オランダ |
| `geo_ireland` | Ireland | Ireland, アイルランド |
| `geo_singapore` | Singapore | Singapore, シンガポール |

Additional countries: Argentina, Bahamas, Belgium, BeNeLux, Bermuda, Cayman Islands, Chile, Colombia, Cyprus, Denmark, Finland, Greece, Hong Kong, Hungary, Iceland, Indonesia, Italy, Jordan, Kazakhstan, Luxembourg, Malaysia, Malta, Mexico, Monaco, New Zealand, Norway, Panama, Peru, Philippines, Portugal, Russia, South Africa, Spain, Sweden, Thailand, Turkey, UAE, Uruguay, Vietnam


### IPO Date (`ipodate_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ipodate_today` | Today | IPO today, 今日IPO |
| `ipodate_yesterday` | Yesterday |  |
| `ipodate_prevweek` | In the last week | recent IPO, 最近のIPO |
| `ipodate_prevmonth` | In the last month |  |
| `ipodate_prevquarter` | In the last quarter |  |
| `ipodate_prevyear` | In the last year |  |
| `ipodate_prev2yrs` | In the last 2 years |  |
| `ipodate_prev3yrs` | In the last 3 years |  |
| `ipodate_prev5yrs` | In the last 5 years |  |
| `ipodate_more1` | More than a year ago |  |
| `ipodate_more5` | More than 5 years ago | established, 安定企業 |
| `ipodate_more10` | More than 10 years ago |  |
| `ipodate_more15` | More than 15 years ago |  |
| `ipodate_more20` | More than 20 years ago |  |
| `ipodate_more25` | More than 25 years ago |  |

### Earnings Date (`earningsdate_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `earningsdate_today` | Today | earnings today, 今日決算 |
| `earningsdate_todaybefore` | Today Before Market Open | 寄り前決算 |
| `earningsdate_todayafter` | Today After Market Close | 引け後決算 |
| `earningsdate_tomorrow` | Tomorrow | earnings tomorrow, 明日決算 |
| `earningsdate_tomorrowbefore` | Tomorrow Before Market Open |  |
| `earningsdate_tomorrowafter` | Tomorrow After Market Close |  |
| `earningsdate_yesterday` | Yesterday | 昨日決算 |
| `earningsdate_yesterdaybefore` | Yesterday Before Market Open |  |
| `earningsdate_yesterdayafter` | Yesterday After Market Close |  |
| `earningsdate_thisweek` | This Week | earnings this week, 今週決算 |
| `earningsdate_nextweek` | Next Week | earnings next week, 来週決算 |
| `earningsdate_prevweek` | Previous Week | 先週決算 |
| `earningsdate_nextdays5` | Next 5 Days | 今後5日以内決算 |
| `earningsdate_prevdays5` | Previous 5 Days | 過去5日決算 |
| `earningsdate_thismonth` | This Month | earnings this month, 今月決算 |

---


## Fundamental Filters (`fa_`)


### P/E Ratio (`fa_pe_`)


Pattern: `fa_pe_u{N}` (under N), `fa_pe_o{N}` (over N), `fa_pe_{from}to{to}` (range, e.g., `fa_pe_10to20`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_pe_low` | Low (<15) | low PE, 低PER |
| `fa_pe_profitable` | Profitable (>0) | profitable, 黒字 |
| `fa_pe_high` | High (>50) | high PE, 高PER |
| `fa_pe_u5` | Under 5 | PE<5 |
| `fa_pe_u10` | Under 10 | PE<10 |
| `fa_pe_u15` | Under 15 | PE<15 |
| `fa_pe_u20` | Under 20 | PE<20, 割安 |
| `fa_pe_u25` | Under 25 | PE<25 |
| `fa_pe_u30` | Under 30 | PE<30 |
| `fa_pe_u35` | Under 35 |  |
| `fa_pe_u40` | Under 40 | PE<40 |
| `fa_pe_u45` | Under 45 |  |
| `fa_pe_u50` | Under 50 | PE<50 |
| `fa_pe_o5` | Over 5 | PE>5 |
| `fa_pe_o10` | Over 10 | PE>10 |
| `fa_pe_o15` | Over 15 | PE>15 |
| `fa_pe_o20` | Over 20 | PE>20 |
| `fa_pe_o25` | Over 25 | PE>25 |
| `fa_pe_o30` | Over 30 | PE>30 |
| `fa_pe_o35` | Over 35 |  |
| `fa_pe_o40` | Over 40 | PE>40 |
| `fa_pe_o45` | Over 45 |  |
| `fa_pe_o50` | Over 50 | PE>50 |

### Forward P/E (`fa_fpe_`)


Pattern: `fa_fpe_u{N}` (under N), `fa_fpe_o{N}` (over N), `fa_fpe_{from}to{to}` (range, e.g., `fa_fpe_10to20`). Same thresholds as P/E (5–50).

Special: `fa_fpe_low` (Low <15), `fa_fpe_profitable` (>0), `fa_fpe_high` (>50)


### PEG Ratio (`fa_peg_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_peg_low` | Low (<1) | PEG<1, 成長割安 |
| `fa_peg_high` | High (>2) | PEG>2 |
| `fa_peg_u1` | Under 1 | PEG<1 |
| `fa_peg_u2` | Under 2 | PEG<2 |
| `fa_peg_u3` | Under 3 | PEG<3 |
| `fa_peg_o1` | Over 1 | PEG>1 |
| `fa_peg_o2` | Over 2 | PEG>2 |
| `fa_peg_o3` | Over 3 | PEG>3 |

### P/S Ratio (`fa_ps_`)


Pattern: `fa_ps_u{N}` (under N), `fa_ps_o{N}` (over N), `fa_ps_{from}to{to}` (range, e.g., `fa_ps_1to5`). Range: 1–10.

Special: `fa_ps_low` (Low <1), `fa_ps_high` (High >10)


### P/B Ratio (`fa_pb_`)


Pattern: `fa_pb_u{N}` (under N), `fa_pb_o{N}` (over N), `fa_pb_{from}to{to}` (range, e.g., `fa_pb_1to3`). Range: 1–10.

Special: `fa_pb_low` (Low <1, 簿価割れ), `fa_pb_high` (High >5)


### P/Cash (`fa_pc_`)


Pattern: `fa_pc_u{N}` (under N), `fa_pc_o{N}` (over N), `fa_pc_{from}to{to}` (range, e.g., `fa_pc_3to10`). Range: 1–50.

Special: `fa_pc_low` (Low <3), `fa_pc_high` (High >50)


### P/Free Cash Flow (`fa_pfcf_`)


Pattern: `fa_pfcf_u{N}` (under N), `fa_pfcf_o{N}` (over N), `fa_pfcf_{from}to{to}` (range, e.g., `fa_pfcf_10to30`). Range: 5–100.

Special: `fa_pfcf_low` (Low <15, FCF割安), `fa_pfcf_high` (High >50)


### EV/EBITDA (`fa_evebitda_`)


Pattern: `fa_evebitda_u{N}` (under N), `fa_evebitda_o{N}` (over N), `fa_evebitda_{from}to{to}` (range, e.g., `fa_evebitda_5to15`). Range: 5–50.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_evebitda_negative` | Negative (<0) | EV/EBITDA negative |
| `fa_evebitda_low` | Low (<15) | low EV/EBITDA, EV/EBITDA割安 |
| `fa_evebitda_profitable` | Profitable (>0) | EV/EBITDA profitable |
| `fa_evebitda_high` | High (>50) | high EV/EBITDA |
| `fa_evebitda_u5` | Under 5 | EV/EBITDA<5 |
| `fa_evebitda_u10` | Under 10 | EV/EBITDA<10 |
| `fa_evebitda_u15` | Under 15 | EV/EBITDA<15 |
| `fa_evebitda_u20` | Under 20 | EV/EBITDA<20 |
| `fa_evebitda_u25` | Under 25 |  |
| `fa_evebitda_u30` | Under 30 |  |
| `fa_evebitda_u35` | Under 35 |  |
| `fa_evebitda_u40` | Under 40 |  |
| `fa_evebitda_u45` | Under 45 |  |
| `fa_evebitda_u50` | Under 50 |  |
| `fa_evebitda_o5` | Over 5 |  |
| `fa_evebitda_o10` | Over 10 |  |
| `fa_evebitda_o15` | Over 15 |  |
| `fa_evebitda_o20` | Over 20 |  |
| `fa_evebitda_o25` | Over 25 |  |
| `fa_evebitda_o30` | Over 30 |  |
| `fa_evebitda_o35` | Over 35 |  |
| `fa_evebitda_o40` | Over 40 |  |
| `fa_evebitda_o45` | Over 45 |  |
| `fa_evebitda_o50` | Over 50 |  |

### EV/Sales (`fa_evsales_`)


Pattern: `fa_evsales_u{N}` (under N), `fa_evsales_o{N}` (over N). Range: 1–10.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_evsales_negative` | Negative (<0) | EV/Sales negative |
| `fa_evsales_low` | Low (<1) | low EV/Sales |
| `fa_evsales_positive` | Positive (>0) | EV/Sales positive |
| `fa_evsales_high` | High (>10) | high EV/Sales |
| `fa_evsales_u1` | Under 1 | EV/Sales<1 |
| `fa_evsales_u2` | Under 2 | EV/Sales<2 |
| `fa_evsales_u3` | Under 3 |  |
| `fa_evsales_u5` | Under 5 |  |
| `fa_evsales_u10` | Under 10 |  |
| `fa_evsales_o1` | Over 1 |  |
| `fa_evsales_o2` | Over 2 |  |
| `fa_evsales_o3` | Over 3 |  |
| `fa_evsales_o5` | Over 5 |  |
| `fa_evsales_o10` | Over 10 |  |

### Dividend Yield (`fa_div_`)


Pattern: `fa_div_o{N}` (over N%), `fa_div_{from}to{to}` (range, e.g., `fa_div_3to8` = 3% to 8%)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_div_none` | None (0%) | no dividend, 無配 |
| `fa_div_pos` | Positive (>0%) | has dividend, 配当あり |
| `fa_div_high` | High (>5%) | high dividend, 高配当 |
| `fa_div_veryhigh` | Very High (>10%) | very high dividend, 超高配当 |
| `fa_div_o1` | Over 1% | 配当1%以上 |
| `fa_div_o2` | Over 2% | 配当2%以上 |
| `fa_div_o3` | Over 3% | 配当3%以上 |
| `fa_div_o4` | Over 4% | 配当4%以上 |
| `fa_div_o5` | Over 5% | 配当5%以上 |
| `fa_div_o6` | Over 6% | 配当6%以上 |
| `fa_div_o7` | Over 7% | 配当7%以上 |
| `fa_div_o8` | Over 8% | 配当8%以上 |
| `fa_div_o9` | Over 9% | 配当9%以上 |
| `fa_div_o10` | Over 10% | 配当10%以上 |

### Dividend Growth (`fa_divgrowth_`)


Pattern: `fa_divgrowth_{period}o{N}` where period = `1y`/`3y`/`5y` and N = 5/10/15/20/25/30.

Positive: `fa_divgrowth_{period}pos`. Growing streak: `fa_divgrowth_cy{N}` (N = 1–9 years).


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_divgrowth_1ypos` | 1 Year Positive | 1Y配当増配 |
| `fa_divgrowth_1yo5` | 1 Year Over 5% | 1Y DG>5% |
| `fa_divgrowth_1yo10` | 1 Year Over 10% | 1Y DG>10% |
| `fa_divgrowth_3ypos` | 3 Years Positive | 3Y配当増配 |
| `fa_divgrowth_3yo10` | 3 Years Over 10% | 3Y DG>10% |
| `fa_divgrowth_5ypos` | 5 Years Positive | 5Y配当増配 |
| `fa_divgrowth_5yo10` | 5 Years Over 10% | 5Y DG>10% |
| `fa_divgrowth_cy1` | Growing 1+ Year | 1年以上連続増配 |
| `fa_divgrowth_cy3` | Growing 3+ Years | 3年以上連続増配 |
| `fa_divgrowth_cy5` | Growing 5+ Years | 5年以上連続増配, 連続増配株 |
| `fa_divgrowth_cy7` | Growing 7+ Years | 7年以上連続増配 |
| `fa_divgrowth_cy9` | Growing 9+ Years | 9年以上連続増配 |

### Payout Ratio (`fa_payoutratio_`)


Pattern: `fa_payoutratio_u{N}` (under N%), `fa_payoutratio_o{N}` (over N%), `fa_payoutratio_{from}to{to}` (range, e.g., `fa_payoutratio_20to60`). Range: 0–100.

Special: `fa_payoutratio_none` (0%), `fa_payoutratio_pos` (>0%), `fa_payoutratio_low` (<20%), `fa_payoutratio_high` (>50%)


### EPS Growth


All EPS growth filters follow the same pattern: `neg` (negative), `pos` (positive), `poslow` (0-10%), `high` (>25%), `o{N}` (over N%), `u{N}` (under N%). N = 5/10/15/20/25/30.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_epsqoq_*` | EPS Growth Q/Q | EPS QoQ, 四半期EPS成長, 増益 |
| `fa_epsyoy_*` | EPS Growth This Year | EPS this year, 今年のEPS成長 |
| `fa_epsyoy1_*` | EPS Growth Next Year | EPS next year, 来年のEPS成長予想 |
| `fa_epsyoyttm_*` | EPS Growth TTM | EPS TTM, 直近12ヶ月EPS成長 |
| `fa_eps3years_*` | EPS Growth Past 3 Years | 3Y EPS成長 |
| `fa_eps5years_*` | EPS Growth Past 5 Years | 5Y EPS成長 |
| `fa_estltgrowth_*` | EPS Growth Next 5 Years | 5Y EPS成長予想, 長期成長 |

**Example codes:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_epsqoq_pos` | EPS Q/Q Positive | 増益 |
| `fa_epsqoq_o25` | EPS Q/Q Over 25% | 高成長株 |
| `fa_epsyoy_high` | EPS This Year High (>25%) |  |
| `fa_epsyoy1_pos` | EPS Next Year Positive | 来年増益予想 |
| `fa_epsyoyttm_o10` | EPS TTM Over 10% |  |
| `fa_eps3years_pos` | EPS Past 3Y Positive |  |
| `fa_eps5years_o20` | EPS Past 5Y Over 20% |  |
| `fa_estltgrowth_o15` | EPS Next 5Y Over 15% | 長期高成長 |

### Sales Growth


Same pattern as EPS Growth: `neg`, `pos`, `poslow`, `high`, `o{N}`, `u{N}`.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_salesqoq_*` | Sales Growth Q/Q | 売上QoQ, 増収 |
| `fa_salesyoyttm_*` | Sales Growth TTM | 売上TTM, 直近12ヶ月売上成長 |
| `fa_sales3years_*` | Sales Growth Past 3 Years | 3Y売上成長 |
| `fa_sales5years_*` | Sales Growth Past 5 Years | 5Y売上成長 |

**Example codes:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_salesqoq_pos` | Sales Q/Q Positive | 増収 |
| `fa_salesqoq_o25` | Sales Q/Q Over 25% | 高成長 |
| `fa_salesyoyttm_o10` | Sales TTM Over 10% |  |
| `fa_sales3years_high` | Sales Past 3Y High (>25%) |  |
| `fa_sales5years_pos` | Sales Past 5Y Positive |  |

### Earnings & Revenue Surprise (`fa_epsrev_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_epsrev_bp` | Both Positive (>0%) | positive surprise, ポジティブサプライズ, 決算好調 |
| `fa_epsrev_bm` | Both Met (0%) | met estimates, 予想一致 |
| `fa_epsrev_bn` | Both Negative (<0%) | negative surprise, ネガティブサプライズ, 決算不振 |

### Profitability — ROE, ROA, ROIC


All return metrics follow the pattern: `pos` (>0%), `neg` (<0%), `o{N}` (over N%), `u-{N}` (under -N%).

Special labels: `verypos` (ROE >30%, ROA >15%, ROIC >25%), `veryneg` (ROE <-15%, ROA <-15%, ROIC <-10%)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_roe_*` | Return on Equity | ROE, 自己資本利益率 |
| `fa_roa_*` | Return on Assets | ROA, 総資産利益率 |
| `fa_roi_*` | Return on Invested Capital (ROIC) | ROI, ROIC, 投下資本利益率 |

**Example codes:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_roe_o15` | ROE Over 15% | ROE>15%, 高収益 |
| `fa_roe_o30` | ROE Over 30% | ROE>30% |
| `fa_roa_o10` | ROA Over 10% | ROA>10% |
| `fa_roi_o20` | ROIC Over 20% | ROIC>20% |
| `fa_roi_verypos` | ROIC Very Positive (>25%) | 高ROIC |

### Margins


Pattern: `pos` (>0%), `neg` (<0%), `high` (gross >50%, operating >25%, net >20%), `veryneg` (<-20%), `o{N}` (over N%), `u{N}` (under N%), `u-{N}` (under -N%).

N range: 0–90 (5-point intervals).


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_grossmargin_*` | Gross Margin | gross margin, 粗利率 |
| `fa_opermargin_*` | Operating Margin | operating margin, 営業利益率 |
| `fa_netmargin_*` | Net Profit Margin | net margin, 純利益率 |

**Example codes:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_grossmargin_o50` | Gross Margin Over 50% | 高粗利 |
| `fa_opermargin_o20` | Operating Margin Over 20% | 高営業利益率 |
| `fa_netmargin_pos` | Net Margin Positive | 黒字 |
| `fa_netmargin_o10` | Net Margin Over 10% |  |
| `fa_grossmargin_u-10` | Gross Margin Under -10% | 赤字 |

### Debt & Liquidity


**LT Debt/Equity** (`fa_ltdebteq_`): `u{N}` / `o{N}`, N = 0.1–1.0. Special: `low` (<0.1), `high` (>0.5)

**Total Debt/Equity** (`fa_debteq_`): Same pattern. Special: `low` (<0.1), `high` (>0.5)

**Current Ratio** (`fa_curratio_`): `u{N}` / `o{N}`, N = 0.5–10. Special: `low` (<1), `high` (>3)

**Quick Ratio** (`fa_quickratio_`): `u{N}` / `o{N}`, N = 0.5–10. Special: `low` (<0.5), `high` (>3)


**Example codes:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `fa_ltdebteq_u0.5` | LT D/E Under 0.5 | 低負債 |
| `fa_debteq_low` | Total D/E Low (<0.1) | 超低負債 |
| `fa_curratio_o2` | Current Ratio Over 2 | 高流動性 |
| `fa_quickratio_o1` | Quick Ratio Over 1 |  |

---


## Technical Filters (`ta_`)


### RSI 14-day (`ta_rsi_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_rsi_ob90` | Overbought (90) | extremely overbought, 超過熱 |
| `ta_rsi_ob80` | Overbought (80) | overbought, 過熱 |
| `ta_rsi_ob70` | Overbought (70) | overbought, 買われすぎ |
| `ta_rsi_ob60` | Overbought (60) |  |
| `ta_rsi_os40` | Oversold (40) | slightly oversold |
| `ta_rsi_os30` | Oversold (30) | oversold, 売られすぎ |
| `ta_rsi_os20` | Oversold (20) | deeply oversold, 深い売られすぎ |
| `ta_rsi_os10` | Oversold (10) | extremely oversold |
| `ta_rsi_nob60` | Not Overbought (<60) |  |
| `ta_rsi_nob50` | Not Overbought (<50) |  |
| `ta_rsi_nos40` | Not Oversold (>40) |  |
| `ta_rsi_nos50` | Not Oversold (>50) |  |

### Moving Averages (`ta_sma20_`, `ta_sma50_`, `ta_sma200_`)


Each SMA has the following options:

- `pa` / `pb` — Price above/below SMA

- `pa{N}` / `pb{N}` — Price N% above/below SMA (N = 10,20,30,40,50 for SMA20/50; up to 100 for SMA200)

- `pc` / `pca` / `pcb` — Price crossed / crossed above / crossed below SMA

- `sa{X}` / `sb{X}` — SMA above/below other SMA (X = 20,50,200)

- `cross{X}` / `cross{X}a` / `cross{X}b` — SMA crossed / crossed above / crossed below other SMA


**Key codes:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_sma20_pa` | Price Above SMA20 | above 20MA, 20日線の上 |
| `ta_sma20_pb` | Price Below SMA20 | below 20MA, 20日線の下 |
| `ta_sma20_pca` | Price Crossed Above SMA20 | break above 20MA, 20日線突破 |
| `ta_sma20_pcb` | Price Crossed Below SMA20 | break below 20MA, 20日線割れ |
| `ta_sma50_pa` | Price Above SMA50 | above 50MA, 50日線の上 |
| `ta_sma50_pb` | Price Below SMA50 | below 50MA, 50日線の下 |
| `ta_sma50_pca` | Price Crossed Above SMA50 | break above 50MA, 50日線突破 |
| `ta_sma50_pcb` | Price Crossed Below SMA50 | break below 50MA, 50日線割れ |
| `ta_sma200_pa` | Price Above SMA200 | above 200MA, 200日線の上, 長期上昇 |
| `ta_sma200_pb` | Price Below SMA200 | below 200MA, 200日線の下, 長期下落 |
| `ta_sma200_pca` | Price Crossed Above SMA200 | break above 200MA, ゴールデンクロス |
| `ta_sma200_pcb` | Price Crossed Below SMA200 | break below 200MA, デッドクロス |
| `ta_sma200_sa50` | SMA200 Above SMA50 | death cross, デッドクロス配置 |
| `ta_sma200_sb50` | SMA200 Below SMA50 | golden cross, ゴールデンクロス配置 |
| `ta_sma50_cross200a` | SMA50 Crossed SMA200 Above | golden cross発生 |
| `ta_sma50_cross200b` | SMA50 Crossed SMA200 Below | death cross発生 |

### Change (`ta_change_`)


Today's price change. Pattern: `ta_change_u{N}` (up N%), `ta_change_d{N}` (down N%). N = 1–20.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_change_u` | Up | 今日上昇 |
| `ta_change_d` | Down | 今日下落 |
| `ta_change_u1` | Up 1% |  |
| `ta_change_u5` | Up 5% | 今日大幅上昇 |
| `ta_change_u10` | Up 10% | 今日急騰 |
| `ta_change_u15` | Up 15% |  |
| `ta_change_u20` | Up 20% |  |
| `ta_change_d1` | Down 1% |  |
| `ta_change_d5` | Down 5% | 今日大幅下落 |
| `ta_change_d10` | Down 10% | 今日急落 |
| `ta_change_d15` | Down 15% |  |
| `ta_change_d20` | Down 20% |  |

### Change from Open (`ta_changeopen_`)


Same pattern as Change: `ta_changeopen_u{N}` / `ta_changeopen_d{N}`. N = 1–20.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_changeopen_u` | Up from Open | 始値から上昇 |
| `ta_changeopen_d` | Down from Open | 始値から下落 |
| `ta_changeopen_u5` | Up 5% from Open |  |
| `ta_changeopen_d5` | Down 5% from Open |  |

### 52-Week High/Low (`ta_highlow52w_`)


Pattern: `nh` (new high), `nl` (new low), `b{range}h` (below high), `a{range}h` (above low)

Ranges below high: `0to3`, `0to5`, `0to10`, `5`, `10`, `15`, `20`, `30`, `40`, `50`, `60`, `70`, `80`, `90`

Ranges above low: same pattern

**Custom range:** For arbitrary ranges not in the preset list, FinViz supports custom range suffixes:

- `-bhx` (below high, custom): `ta_highlow52w_{from}to{to}-bhx` = {from}–{to}% below 52-week high
- `-alx` (above low, custom): `ta_highlow52w_{from}to{to}-alx` = {from}–{to}% above 52-week low

Examples:
- `ta_highlow52w_10to30-bhx` = 52-week high から 10-30% 下落
- `ta_highlow52w_10to30-alx` = 52-week low から 10-30% 上昇

This syntax is generated by FinViz's custom range UI (requires `&ft=4` in URL for custom filter type). Not registered in the finviz Python library.

**Strategy guide — choosing `-bhx` vs `-alx`:**

| Strategy | Suffix | Use When | Example |
|---|---|---|---|
| Pullback buy (押し目買い) | `-bhx` | Growth + quality stocks in temporary correction. Uptrend intact. | `ta_highlow52w_10to30-bhx` with `fa_epsqoq_pos` |
| Reversal / deep value (リバーサル) | `-alx` | Turnaround or bottom-fishing plays. Higher risk of continued decline. | `ta_highlow52w_10to30-alx` with `fa_pb_u1` |

Rule of thumb: Pair `-bhx` with growth/quality filters (EPS growth, sales growth). Pair `-alx` with deep value filters (low P/B, low EV/EBITDA).


**Key codes:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_highlow52w_nh` | New High | 52-week high, 52週高値, 新高値 |
| `ta_highlow52w_nl` | New Low | 52-week low, 52週安値, 新安値 |
| `ta_highlow52w_b0to3h` | 0-3% Below High | near high, 高値付近 |
| `ta_highlow52w_b0to5h` | 0-5% Below High | near high |
| `ta_highlow52w_b0to10h` | 0-10% Below High | close to high |
| `ta_highlow52w_b10h` | 10%+ Below High | pullback, 調整中 |
| `ta_highlow52w_b20h` | 20%+ Below High | correction, 修正局面 |
| `ta_highlow52w_b30h` | 30%+ Below High | deep correction |
| `ta_highlow52w_b50h` | 50%+ Below High | bear territory, 暴落 |
| `ta_highlow52w_a0to3h` | 0-3% Above Low | near low, 安値付近 |
| `ta_highlow52w_a0to5h` | 0-5% Above Low | near low |
| `ta_highlow52w_a20h` | 20%+ Above Low | recovering |
| `ta_highlow52w_a50h` | 50%+ Above Low | strong recovery |
| `ta_highlow52w_a100h` | 100%+ Above Low | doubled from low |

### 20-Day High/Low (`ta_highlow20d_`)


Same pattern as 52-Week: `nh`, `nl`, `b{range}h` (below high), `a{range}h` (above low).

Ranges: `0to3`, `0to5`, `0to10`, `5`, `10`, `15`, `20`, `30`, `40`, `50`.

Custom range also supported: `ta_highlow20d_{from}to{to}-bhx` / `-alx` (see 52-Week section).


**Key codes:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_highlow20d_nh` | 20-Day New High | 20日新高値 |
| `ta_highlow20d_nl` | 20-Day New Low | 20日新安値 |
| `ta_highlow20d_b0to5h` | 0-5% Below 20D High | 20日高値付近 |

### 50-Day High/Low (`ta_highlow50d_`)


Same pattern as 20-Day High/Low. `nh`, `nl`, `b{range}h`, `a{range}h`.


**Key codes:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_highlow50d_nh` | 50-Day New High | 50日新高値 |
| `ta_highlow50d_nl` | 50-Day New Low | 50日新安値 |

### All-Time High/Low (`ta_alltime_`)


Same structure as 52-Week High/Low. Ranges up to 500% above low. Custom range also supported: `ta_alltime_{from}to{to}-bhx` / `-alx`.


**Key codes:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_alltime_nh` | All-Time High | all-time high, 史上最高値, ATH |
| `ta_alltime_nl` | All-Time Low | all-time low, 史上最安値 |
| `ta_alltime_b0to3h` | 0-3% Below ATH | ATH付近 |
| `ta_alltime_b0to5h` | 0-5% Below ATH | ATH付近 |
| `ta_alltime_b10h` | 10%+ Below ATH | ATHから10%下落 |
| `ta_alltime_b20h` | 20%+ Below ATH | ATHから20%下落 |
| `ta_alltime_b50h` | 50%+ Below ATH | ATHから半値 |

### Performance (`ta_perf_`)


Pattern: `ta_perf_{period}{direction}{threshold}`

Periods: `d` (today), `1w` (week), `4w` (month), `13w` (quarter), `26w` (half), `52w` (year), `ytd` (YTD), `3y`, `5y`, `10y`

Directions: `up`/`down` (any), `{N}o` (+N%), `{N}u` (-N%)


**Key codes:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_perf_dup` | Today Up | today up, 今日上昇 |
| `ta_perf_ddown` | Today Down | today down, 今日下落 |
| `ta_perf_d5o` | Today +5% | big up today |
| `ta_perf_d5u` | Today -5% | big down today |
| `ta_perf_1wup` | Week Up | week up, 週間上昇 |
| `ta_perf_1wdown` | Week Down | week down, 週間下落 |
| `ta_perf_4wup` | Month Up | month up, 月間上昇 |
| `ta_perf_4wdown` | Month Down | month down, 月間下落 |
| `ta_perf_13wup` | Quarter Up | quarter up, 四半期上昇 |
| `ta_perf_13wdown` | Quarter Down | quarter down |
| `ta_perf_26wup` | Half Year Up | half up, 半年上昇 |
| `ta_perf_52wup` | Year Up | year up, 年間上昇 |
| `ta_perf_52wdown` | Year Down | year down, 年間下落 |
| `ta_perf_ytdup` | YTD Up | YTD up, 年初来上昇 |
| `ta_perf_ytddown` | YTD Down | YTD down, 年初来下落 |
| `ta_perf_3yup` | 3 Years Up | 3Y up |
| `ta_perf_5yup` | 5 Years Up | 5Y up |
| `ta_perf_10yup` | 10 Years Up | 10Y up |
| `ta_perf_52w100o` | Year +100% | 年間2倍 |
| `ta_perf_52w50u` | Year -50% | 年間半値 |

### Performance 2 (`ta_perf2_`)


Identical structure to Performance but allows a second independent performance filter.

Prefix: `ta_perf2_` instead of `ta_perf_`. Same periods and thresholds.

Use case: Filter stocks that are up this quarter AND down this month.


### Gap (`ta_gap_`)


Pattern: `ta_gap_u{N}` (gap up N%), `ta_gap_d{N}` (gap down N%). N = 0–20.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_gap_u` | Gap Up | gap up, ギャップアップ |
| `ta_gap_d` | Gap Down | gap down, ギャップダウン |
| `ta_gap_u0` | Gap Up 0%+ |  |
| `ta_gap_u3` | Gap Up 3%+ |  |
| `ta_gap_u5` | Gap Up 5%+ | big gap up |
| `ta_gap_u10` | Gap Up 10%+ |  |
| `ta_gap_d0` | Gap Down 0%+ |  |
| `ta_gap_d3` | Gap Down 3%+ |  |
| `ta_gap_d5` | Gap Down 5%+ | big gap down |
| `ta_gap_d10` | Gap Down 10%+ |  |

### Beta (`ta_beta_`)


Pattern: `ta_beta_u{N}` (under N), `ta_beta_o{N}` (over N). Also ranges: `0to0.5`, `0to1`, `0.5to1`, `0.5to1.5`, `1to1.5`, `1to2`.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_beta_u0` | Beta Under 0 | negative beta |
| `ta_beta_u0.5` | Beta Under 0.5 | low beta, 低ベータ, ディフェンシブ |
| `ta_beta_u1` | Beta Under 1 | below market |
| `ta_beta_o1` | Beta Over 1 | above market |
| `ta_beta_o1.5` | Beta Over 1.5 | high beta, 高ベータ |
| `ta_beta_o2` | Beta Over 2 | very high beta |
| `ta_beta_o3` | Beta Over 3 | extremely high beta |

### Volatility (`ta_volatility_`)


Pattern: `ta_volatility_{period}_{direction}{N}` where period = w (week) / m (month), N = 2–15.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_volatility_mo10` | Month - Over 10% |  |
| `ta_volatility_mo12` | Month - Over 12% |  |
| `ta_volatility_mo15` | Month - Over 15% |  |
| `ta_volatility_mo2` | Month - Over 2% |  |
| `ta_volatility_mo3` | Month - Over 3% |  |
| `ta_volatility_mo4` | Month - Over 4% |  |
| `ta_volatility_mo5` | Month - Over 5% |  |
| `ta_volatility_mo6` | Month - Over 6% |  |
| `ta_volatility_mo7` | Month - Over 7% |  |
| `ta_volatility_mo8` | Month - Over 8% |  |
| `ta_volatility_mo9` | Month - Over 9% |  |
| `ta_volatility_wo10` | Week - Over 10% |  |
| `ta_volatility_wo12` | Week - Over 12% |  |
| `ta_volatility_wo15` | Week - Over 15% |  |
| `ta_volatility_wo2` | Week - Over 2% |  |
| `ta_volatility_wo3` | Week - Over 3% |  |
| `ta_volatility_wo4` | Week - Over 4% |  |
| `ta_volatility_wo5` | Week - Over 5% |  |
| `ta_volatility_wo6` | Week - Over 6% |  |
| `ta_volatility_wo7` | Week - Over 7% |  |
| `ta_volatility_wo8` | Week - Over 8% |  |
| `ta_volatility_wo9` | Week - Over 9% |  |

### Average True Range (`ta_averagetruerange_`)


Pattern: `ta_averagetruerange_o{N}` (over N), `ta_averagetruerange_u{N}` (under N). N = 0.25–5.0.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_averagetruerange_o0.5` | ATR Over 0.5 | ATR>0.5 |
| `ta_averagetruerange_o1` | ATR Over 1 | ATR>1 |
| `ta_averagetruerange_o2` | ATR Over 2 | high ATR, 高ATR |
| `ta_averagetruerange_o3` | ATR Over 3 | very high ATR |
| `ta_averagetruerange_o5` | ATR Over 5 | extreme ATR |
| `ta_averagetruerange_u0.5` | ATR Under 0.5 | low ATR, 低ATR |
| `ta_averagetruerange_u1` | ATR Under 1 |  |
| `ta_averagetruerange_u2` | ATR Under 2 |  |

### Chart Patterns (`ta_pattern_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_pattern_channel` | Channel |  |
| `ta_pattern_channel2` | Channel (Strong) |  |
| `ta_pattern_channeldown` | Channel Down | falling channel, 下降チャネル |
| `ta_pattern_channeldown2` | Channel Down (Strong) |  |
| `ta_pattern_channelup` | Channel Up | rising channel, 上昇チャネル |
| `ta_pattern_channelup2` | Channel Up (Strong) |  |
| `ta_pattern_doublebottom` | Double Bottom | double bottom, ダブルボトム |
| `ta_pattern_doubletop` | Double Top | double top, ダブルトップ |
| `ta_pattern_headandshoulders` | Head & Shoulders | H&S, ヘッドアンドショルダー |
| `ta_pattern_headandshouldersinv` | Head & Shoulders Inverse | inverse H&S, 逆H&S |
| `ta_pattern_horizontal` | Horizontal S/R | horizontal channel, レンジ |
| `ta_pattern_horizontal2` | Horizontal S/R (Strong) |  |
| `ta_pattern_multiplebottom` | Multiple Bottom | multiple bottom |
| `ta_pattern_multipletop` | Multiple Top | multiple top |
| `ta_pattern_tlresistance` | TL Resistance |  |
| `ta_pattern_tlresistance2` | TL Resistance (Strong) |  |
| `ta_pattern_tlsupport` | TL Support |  |
| `ta_pattern_tlsupport2` | TL Support (Strong) |  |
| `ta_pattern_wedge` | Wedge |  |
| `ta_pattern_wedge2` | Wedge (Strong) |  |
| `ta_pattern_wedgedown` | Wedge Down | falling wedge |
| `ta_pattern_wedgedown2` | Wedge Down (Strong) |  |
| `ta_pattern_wedgeresistance` | Triangle Ascending | ascending triangle |
| `ta_pattern_wedgeresistance2` | Triangle Ascending (Strong) |  |
| `ta_pattern_wedgesupport` | Triangle Descending | descending triangle |
| `ta_pattern_wedgesupport2` | Triangle Descending (Strong) |  |
| `ta_pattern_wedgeup` | Wedge Up | rising wedge |
| `ta_pattern_wedgeup2` | Wedge Up (Strong) |  |

### Candlestick (`ta_candlestick_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ta_candlestick_d` | Doji | doji, 十字線 |
| `ta_candlestick_dd` | Dragonfly Doji | dragonfly doji, トンボ |
| `ta_candlestick_gd` | Gravestone Doji | gravestone doji |
| `ta_candlestick_h` | Hammer | hammer, ハンマー |
| `ta_candlestick_ih` | Inverted Hammer | inverted hammer |
| `ta_candlestick_lls` | Long Lower Shadow | long lower shadow, 下ヒゲ |
| `ta_candlestick_lus` | Long Upper Shadow | long upper shadow, 上ヒゲ |
| `ta_candlestick_mb` | Marubozu Black | marubozu black, 陰の丸坊主 |
| `ta_candlestick_mw` | Marubozu White | marubozu white, 陽の丸坊主 |
| `ta_candlestick_stb` | Spinning Top Black | spinning top black |
| `ta_candlestick_stw` | Spinning Top White | spinning top white |

---


## Share Filters (`sh_`)


### Average Volume (`sh_avgvol_`)


Pattern: `sh_avgvol_o{N}` (over NK), `sh_avgvol_u{N}` (under NK). Also ranges: `100to500`, `100to1000`, `500to1000`, `500to10000`.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `sh_avgvol_u50` | Under 50K | very low volume |
| `sh_avgvol_u100` | Under 100K | low volume |
| `sh_avgvol_o100` | Over 100K |  |
| `sh_avgvol_o200` | Over 200K | min volume, 流動性確保 |
| `sh_avgvol_o500` | Over 500K |  |
| `sh_avgvol_o1000` | Over 1M | high volume, 高出来高 |
| `sh_avgvol_o2000` | Over 2M | very high volume |
| `sh_avgvol_100to500` | 100K to 500K |  |
| `sh_avgvol_500to1000` | 500K to 1M |  |

### Relative Volume (`sh_relvol_`)


Pattern: `sh_relvol_o{N}` (over N), `sh_relvol_u{N}` (under N). N = 0.1–10.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `sh_relvol_u0.5` | Under 0.5 | low relative volume |
| `sh_relvol_u1` | Under 1 | below avg volume |
| `sh_relvol_o1` | Over 1 | above avg volume |
| `sh_relvol_o1.5` | Over 1.5 | elevated volume |
| `sh_relvol_o2` | Over 2 | volume surge, 出来高急増 |
| `sh_relvol_o3` | Over 3 | very high relative vol |
| `sh_relvol_o5` | Over 5 | extreme volume |
| `sh_relvol_o10` | Over 10 | unusual volume, 異常出来高 |

### Current Volume (`sh_curvol_`)


Pattern: `sh_curvol_o{N}`. No predefined dropdown options in screener UI; use with `f=` parameter.


### Price (`sh_price_`)


Pattern: `sh_price_u{N}` (under $N), `sh_price_o{N}` (over $N). Also ranges: `1to5`, `1to10`, `5to10`, `5to20`, `10to20`, `10to50`, `20to50`, `50to100`.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `sh_price_u1` | Under $1 | penny stock, ペニーストック |
| `sh_price_u5` | Under $5 | low price, 低価格 |
| `sh_price_u10` | Under $10 |  |
| `sh_price_u20` | Under $20 |  |
| `sh_price_u50` | Under $50 | mid price |
| `sh_price_o5` | Over $5 |  |
| `sh_price_o10` | Over $10 |  |
| `sh_price_o20` | Over $20 |  |
| `sh_price_o50` | Over $50 |  |
| `sh_price_o100` | Over $100 | expensive, 高額株 |
| `sh_price_5to50` | $5 to $50 |  |
| `sh_price_10to50` | $10 to $50 | 中価格帯 |

### Float (`sh_float_`)


Pattern: `sh_float_u{N}` (under NM), `sh_float_o{N}` (over NM). Also percentage: `sh_float_u{N}p` / `sh_float_o{N}p`.


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `sh_float_u1` | Under 1M | very low float |
| `sh_float_u5` | Under 5M | low float, 低フロート |
| `sh_float_u10` | Under 10M |  |
| `sh_float_u20` | Under 20M |  |
| `sh_float_o50` | Over 50M |  |
| `sh_float_o100` | Over 100M |  |
| `sh_float_o500` | Over 500M | high float |
| `sh_float_o1000` | Over 1000M |  |
| `sh_float_u10p` | Under 10% of Outstanding | very low float % |
| `sh_float_u20p` | Under 20% |  |
| `sh_float_o50p` | Over 50% |  |
| `sh_float_o80p` | Over 80% | high float % |

### Short Float (`sh_short_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `sh_short_low` | Low (<5%) | low short interest |
| `sh_short_high` | High (>20%) | heavily shorted, 空売り大量 |
| `sh_short_u5` | Under 5% |  |
| `sh_short_u10` | Under 10% |  |
| `sh_short_o5` | Over 5% | some short interest |
| `sh_short_o10` | Over 10% | high short, ショートスクイーズ候補 |
| `sh_short_o15` | Over 15% |  |
| `sh_short_o20` | Over 20% | heavily shorted |
| `sh_short_o25` | Over 25% | very heavily shorted |
| `sh_short_o30` | Over 30% | extreme short interest |

### Shares Outstanding (`sh_outstanding_`)


Pattern: `sh_outstanding_u{N}` (under NM), `sh_outstanding_o{N}` (over NM).


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `sh_outstanding_u1` | Under 1M |  |
| `sh_outstanding_u5` | Under 5M |  |
| `sh_outstanding_u10` | Under 10M | very low shares |
| `sh_outstanding_u50` | Under 50M |  |
| `sh_outstanding_u100` | Under 100M |  |
| `sh_outstanding_o10` | Over 10M |  |
| `sh_outstanding_o50` | Over 50M |  |
| `sh_outstanding_o100` | Over 100M |  |
| `sh_outstanding_o200` | Over 200M |  |
| `sh_outstanding_o500` | Over 500M |  |
| `sh_outstanding_o1000` | Over 1000M | high shares outstanding |

### Option/Short (`sh_opt_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `sh_opt_option` | Optionable | optionable, オプション取引可能 |
| `sh_opt_short` | Shortable | shortable, 空売り可能 |
| `sh_opt_notoption` | Not Optionable | オプション不可 |
| `sh_opt_notshort` | Not Shortable | 空売り不可 |
| `sh_opt_optionshort` | Optionable and Shortable | オプション・空売り両方可能 |
| `sh_opt_optionnotshort` | Optionable and Not Shortable |  |
| `sh_opt_notoptionshort` | Not Optionable and Shortable |  |
| `sh_opt_notoptionnotshort` | Not Optionable and Not Shortable |  |

### Insider Ownership (`sh_insiderown_`)


Pattern: `sh_insiderown_o{N}` (over N%). Special: `low` (<5%), `high` (>30%), `veryhigh` (>50%)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `sh_insiderown_low` | Low (<5%) | low insider |
| `sh_insiderown_high` | High (>30%) | insider owned |
| `sh_insiderown_veryhigh` | Very High (>50%) | majority insider |
| `sh_insiderown_o10` | Over 10% | インサイダー保有10%+ |
| `sh_insiderown_o20` | Over 20% |  |
| `sh_insiderown_o30` | Over 30% |  |
| `sh_insiderown_o50` | Over 50% | 過半数インサイダー |
| `sh_insiderown_o70` | Over 70% |  |
| `sh_insiderown_o90` | Over 90% |  |

### Insider Transactions (`sh_insidertrans_`)


Pattern: `sh_insidertrans_o{N}` (over +N%), `sh_insidertrans_u-{N}` (under -N%). N = 5–90.

Special: `pos` (>0%), `neg` (<0%), `verypos` (>20%), `veryneg` (<20%)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `sh_insidertrans_pos` | Positive (>0%) | insider buying, インサイダー買い |
| `sh_insidertrans_neg` | Negative (<0%) | insider selling, インサイダー売り |
| `sh_insidertrans_verypos` | Very Positive (>20%) | heavy insider buying, インサイダー大量買い |
| `sh_insidertrans_veryneg` | Very Negative (<20%) | heavy insider selling |

### Institutional Ownership (`sh_instown_`)


Pattern: `sh_instown_o{N}` (over N%), `sh_instown_u{N}` (under N%). N = 10–90.

Special: `low` (<5%), `high` (>90%)


### Institutional Transactions (`sh_insttrans_`)


Pattern: `sh_insttrans_o{N}` (over +N%), `sh_insttrans_u-{N}` (under -N%). N = 5–50.

Special: `pos` (>0%), `neg` (<0%), `verypos` (>20%), `veryneg` (<20%)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `sh_insttrans_pos` | Positive (>0%) | institutional buying, 機関買い |
| `sh_insttrans_neg` | Negative (<0%) | institutional selling |

---


## Analyst Filters (`an_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `an_recom_strongbuy` | Strong Buy (1) | strong buy, 強い買い推奨 |
| `an_recom_buybetter` | Buy or better (1-2) | buy, 買い推奨 |
| `an_recom_buy` | Buy (2) |  |
| `an_recom_holdbetter` | Hold or better (1-3) | hold, ホールド以上 |
| `an_recom_hold` | Hold (3) |  |
| `an_recom_holdworse` | Hold or worse (3-5) |  |
| `an_recom_sell` | Sell (4) |  |
| `an_recom_sellworse` | Sell or worse (4-5) | sell, 売り推奨 |
| `an_recom_strongsell` | Strong Sell (5) | strong sell, 強い売り |

---


## Target Price (`targetprice_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `targetprice_above` | Above Price | target above, 目標株価以上 |
| `targetprice_below` | Below Price | target below, 目標株価以下 |
| `targetprice_a5` | 5% Above Price |  |
| `targetprice_a10` | 10% Above Price |  |
| `targetprice_a20` | 20% Above Price | 割安, 上昇余地 |
| `targetprice_a30` | 30% Above Price |  |
| `targetprice_a40` | 40% Above Price |  |
| `targetprice_a50` | 50% Above Price | 大幅割安 |
| `targetprice_b5` | 5% Below Price |  |
| `targetprice_b10` | 10% Below Price |  |
| `targetprice_b20` | 20% Below Price |  |
| `targetprice_b30` | 30% Below Price |  |
| `targetprice_b40` | 40% Below Price |  |
| `targetprice_b50` | 50% Below Price | 大幅割高 |

---


## Latest News (`news_date_`)


| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `news_date_today` | Today | news today, 今日のニュース |
| `news_date_todayafter` | Aftermarket Today |  |
| `news_date_yesterday` | Yesterday |  |
| `news_date_yesterdayafter` | In the Aftermarket Yesterday |  |
| `news_date_sinceyesterday` | Since Yesterday |  |
| `news_date_sinceyesterdayafter` | Since Aftermarket Yesterday |  |
| `news_date_prevminutes5` | In the last 5 minutes | 直近5分 |
| `news_date_prevminutes30` | In the last 30 minutes | 直近30分 |
| `news_date_prevhours1` | In the last hour | 直近1時間 |
| `news_date_prevhours24` | In the last 24 hours | 直近24時間 |
| `news_date_prevdays7` | In the last 7 days | 直近1週間 |
| `news_date_prevmonth` | In the last month | 直近1ヶ月 |

---


## Thematic Filters

Theme and sub-theme filters are available on both **public** `finviz.com` and **Elite** `elite.finviz.com`. No Elite subscription is required.

**CLI Usage:**

- Use `--themes` for theme slugs: `--themes "artificialintelligence,cybersecurity"`
- Use `--subthemes` for sub-theme slugs: `--subthemes "aicloud,aicompute"`
- **Do NOT** pass `theme_*` or `subtheme_*` tokens via `--filters` — the script will reject them with a clear error message.

**Grouped URL syntax:** Multiple themes (or sub-themes) are joined with `|` (URL-encoded as `%7C`) in a single token:

```
f=theme_artificialintelligence%7Ccybersecurity,subtheme_aicloud%7Caicompute,cap_midover
```

### Theme (`theme_`) — 40 themes

| Slug | Label | Natural Language Keywords |
|------|-------|---------------------------|
| `agingpopulationlongevity` | Aging Population & Longevity |  |
| `agriculturefoodtech` | Agriculture & FoodTech |  |
| `artificialintelligence` | Artificial Intelligence | AI, 人工知能 |
| `autonomoussystems` | Autonomous Systems | autonomous, 自律システム |
| `bigdata` | Big Data | big data, ビッグデータ |
| `biometrics` | Biometrics |  |
| `cloudcomputing` | Cloud Computing | cloud, クラウド |
| `commoditiesagriculture` | Commodities - Agriculture |  |
| `commoditiesenergy` | Commodities - Energy |  |
| `commoditiesmetals` | Commodities - Metals |  |
| `consumergoods` | Consumer Goods |  |
| `cryptoblockchain` | Crypto & Blockchain | crypto, 暗号通貨, ブロックチェーン |
| `cybersecurity` | Cybersecurity | cybersecurity, サイバーセキュリティ |
| `defenseaerospace` | Defense & Aerospace |  |
| `digitalentertainment` | Digital Entertainment |  |
| `ecommerce` | E-commerce | e-commerce, EC |
| `educationtechnology` | Education Technology |  |
| `electricvehicles` | Electric Vehicles | EV, 電気自動車 |
| `energyrenewable` | Energy - Renewable | renewable, 再生可能エネルギー |
| `energytraditional` | Energy - Traditional |  |
| `environmentalsustainability` | Environmental Sustainability |  |
| `fintech` | FinTech | fintech, フィンテック |
| `hardware` | Hardware | hardware, ハードウェア |
| `healthcarebiotech` | Healthcare & Biotech | biotech, バイオテック |
| `healthyfoodnutrition` | Healthy Food & Nutrition |  |
| `industrialautomation` | Industrial Automation |  |
| `internetofthings` | Internet of Things | IoT |
| `nanotechnology` | Nanotechnology |  |
| `quantumcomputing` | Quantum Computing | quantum, 量子コンピューティング |
| `realestatereits` | Real Estate & REITs | REITs, 不動産投資信託 |
| `robotics` | Robotics | robotics, ロボティクス |
| `semiconductors` | Semiconductors | semiconductors, 半導体 |
| `smarthome` | Smart Home |  |
| `socialmedia` | Social Media |  |
| `software` | Software | software, ソフトウェア |
| `spacetech` | Space Tech | space, 宇宙 |
| `telecommunications` | Telecommunications |  |
| `transportationlogistics` | Transportation & Logistics |  |
| `virtualaugmentedreality` | Virtual & Augmented Reality | VR, AR, メタバース |
| `wearables` | Wearables |  |

### Sub-theme (`subtheme_`) — 268 sub-themes

Pattern: `subtheme_{category}{subtopic}`. Pass bare slugs via `--subthemes`.

#### Agriculture (5)
| Slug | Label |
|------|-------|
| `agriculturealtprotein` | Agriculture - Alternative Proteins |
| `agriculturecropinputs` | Agriculture - Agricultural Inputs & Crop Science |
| `agricultureindoorfarming` | Agriculture - Controlled Environment Agriculture |
| `agricultureprocessing` | Agriculture - Agri-Food Processing & Distribution |
| `agriculturesmartfarming` | Agriculture - Precision Agriculture & Farm Automation |

#### AI (13)
| Slug | Label |
|------|-------|
| `aiadssearch` | AI - Ads, Search & Recommendations |
| `aiagi` | AI - AGI, general intelligence |
| `aiapplications` | AI - Apps, Domain-Specific AI |
| `aicloud` | AI - Cloud & Infrastructure |
| `aicompute` | AI - Compute & Acceleration |
| `aidata` | AI - Data Infrastructure & Enablement |
| `aiedge` | AI - Edge & Embedded Systems |
| `aienergy` | AI - Power & Energy Solutions |
| `aienterprise` | AI - Enterprise Productivity & Software Integration |
| `aimodels` | AI - Foundation Models & Platforms |
| `ainetworking` | AI - Networking & Systems Optimization |
| `airobotics` | AI - Robotics & Automation |
| `aisecurity` | AI - Cybersecurity |

#### Automation (7)
| Slug | Label |
|------|-------|
| `automationautomation` | Automation - Factory & Process Automation Systems |
| `automationdprinting` | Automation - Additive Manufacturing, 3D Printing |
| `automationiot` | Automation - Industrial IoT, Connectivity |
| `automationlogistics` | Automation - Smart Logistics & Warehouse Automation |
| `automationmachinevision` | Automation - Industrial Sensors & Machine Vision |
| `automationrobotics` | Automation - Industrial Robotics & Autonomous Systems |
| `automationsoftware` | Automation - Industrial Software & Digital Twin |

#### Autonomous (6)
| Slug | Label |
|------|-------|
| `autonomousavmobility` | Autonomous - Vehicles & Mobility |
| `autonomousdefense` | Autonomous - Aerospace, Defense & Drones |
| `autonomousindustrial` | Autonomous - Industrial & Logistics Automation |
| `autonomousmachinevision` | Autonomous - Sensors & Perception Systems |
| `autonomoussoftware` | Autonomous - Software & Cloud Infrastructure |
| `autonomousspecialized` | Autonomous - Maritime, Agriculture & Specialized Autonomy |

#### Big Data (4)
| Slug | Label |
|------|-------|
| `bigdataaiplatforms` | Big Data - AI Platforms & Predictive Analytics |
| `bigdataanalyticsbi` | Big Data - Analytics & Business Intelligence |
| `bigdatainfrastructure` | Big Data - Infrastructure & Storage |
| `bigdataproviders` | Big Data - Data Generation, Sourcing & Providers |

#### Biometrics (4)
| Slug | Label |
|------|-------|
| `biometricsgovdefense` | Biometrics - Government, Defense & Public Security |
| `biometricshardware` | Biometrics - Biometric Sensors & Hardware |
| `biometricsidentity` | Biometrics - Identity Verification & Security |
| `biometricssoftware` | Biometrics - Recognition & Analytics |

#### Blockchain (6)
| Slug | Label |
|------|-------|
| `blockchainenterprise` | Blockchain - Enterprise Blockchain Solutions |
| `blockchaininfrastructure` | Blockchain - Blockchain Infrastructure |
| `blockchainmining` | Blockchain - Cryptocurrency Mining & Staking |
| `blockchainpayments` | Blockchain - Financial Services & Payments |
| `blockchainplatforms` | Blockchain - Cryptocurrency Platforms |
| `blockchaintokenization` | Blockchain - Tokenization & Digital Assets |

#### Cloud (12)
| Slug | Label |
|------|-------|
| `clouddatabases` | Cloud - Data Platforms & Databases |
| `clouddatacenters` | Cloud - Data Centers |
| `clouddevops` | Cloud - DevOps, Observability |
| `cloudedge` | Cloud - Edge, CDN, Zero-Trust Networking |
| `cloudhardware` | Cloud - Hardware, Networking & OEM |
| `cloudhsaas` | Cloud - Horizontal SaaS & Cloud Applications |
| `cloudhybridcloud` | Cloud - Hybrid Cloud |
| `cloudhyperscalers` | Cloud - Hyperscalers |
| `cloudmulticloud` | Cloud - Multi-Cloud Management |
| `cloudpaas` | Cloud - Platforms & Services, PaaS |
| `cloudsecurity` | Cloud - Security |
| `cloudserverless` | Cloud - Serverless Computing |

#### Comm Agri (5)
| Slug | Label |
|------|-------|
| `commagribiofuels` | Comm Agri - Renewable Fuels & Biofuels |
| `commagrifertilizers` | Comm Agri - Fertilizers, Crop Inputs & Seeds |
| `commagrigrains` | Comm Agri - Grains & Oilseeds |
| `commagrilivestock` | Comm Agri - Livestock & Animal Protein |
| `commagrisofts` | Comm Agri - Softs & Plantation Crops |

#### Comm Energy (4)
| Slug | Label |
|------|-------|
| `commenergybiofuels` | Comm Energy - Biofuels & Renewable Fuels |
| `commenergygaslng` | Comm Energy - Natural Gas & LNG |
| `commenergyoil` | Comm Energy - Crude Oil |
| `commenergyuranium` | Comm Energy - Uranium & Nuclear Fuels |

#### Comm Metals (7)
| Slug | Label |
|------|-------|
| `commmetalsbattery` | Comm Metals - Battery & Energy Transition Metals |
| `commmetalsgold` | Comm Metals - Gold |
| `commmetalsindustrial` | Comm Metals - Industrial & Base Metals |
| `commmetalsprecious` | Comm Metals - Precious Metals |
| `commmetalsrareearth` | Comm Metals - Rare Earth & Strategic Materials |
| `commmetalsrecycling` | Comm Metals - Recycling & Circular Materials |
| `commmetalssilver` | Comm Metals - Silver |

#### Consumer (6)
| Slug | Label |
|------|-------|
| `consumerapparel` | Consumer - Apparel & E-Commerce Retail |
| `consumerfarmdirect` | Consumer - Farming & Direct Marketplaces |
| `consumerfood` | Consumer - Health, Food & Beverages |
| `consumerhousehold` | Consumer - Smart Homes & Household Products |
| `consumerluxury` | Consumer - Modern Luxury & Lifestyle |
| `consumersecondhand` | Consumer - Resale & Sharing Platforms |

#### Cybersecurity (8)
| Slug | Label |
|------|-------|
| `cybersecurityappsecurity` | Cybersecurity - Application Security |
| `cybersecuritycloud` | Cybersecurity - Cloud Security |
| `cybersecurityendpoint` | Cybersecurity - Endpoint Security |
| `cybersecurityidentityiam` | Cybersecurity - Identity & Access Management |
| `cybersecuritynetwork` | Cybersecurity - Network Security |
| `cybersecuritysiem` | Cybersecurity - Security Information & Event Management |
| `cybersecuritythreatops` | Cybersecurity - Threat Intelligence |
| `cybersecurityzerotrust` | Cybersecurity - Zero Trust |

#### Defense (7)
| Slug | Label |
|------|-------|
| `defenseaviation` | Defense - Next-Generation Aircraft & Maintenance |
| `defensecyberdefense` | Defense - Cyber Defense & Electronic Warfare |
| `defensedrones` | Defense - Drones & Anti-Drone Systems |
| `defensemanufacturing` | Defense - Secure Defense Supply Chains |
| `defensemissiles` | Defense - Missile Defense & Long-Range Weapons |
| `defensespacetech` | Defense - Space Technology & Satellite Services |
| `defenseweapons` | Defense - Precision Weapons & Ammunition Resupply |

#### E-commerce (9)
| Slug | Label |
|------|-------|
| `ecommerceadsmedia` | E-commerce - Retail Media & Advertising |
| `ecommercedtc` | E-commerce - Direct-to-Consumer |
| `ecommercegrocery` | E-commerce - Grocery & Local Commerce Platforms |
| `ecommercelogistics` | E-commerce - Logistics & Delivery |
| `ecommercemarketplaces` | E-commerce - Online Marketplaces |
| `ecommerceomnichannel` | E-commerce - Omnichannel Retailers, Online & Physical Stores |
| `ecommerceplatforms` | E-commerce - Platforms |
| `ecommercesecondhand` | E-commerce - Recommerce, Secondhand Marketplaces |
| `ecommercesocial` | E-commerce - Social & Influencer Commerce |

#### Education (4)
| Slug | Label |
|------|-------|
| `educationcurriculum` | Education - Digital Curriculum |
| `educationinfrastructure` | Education - Infrastructure |
| `educationplatforms` | Education - Online Learning Platforms |
| `educationworkforce` | Education - Workforce Training |

#### Energy Base (7)
| Slug | Label |
|------|-------|
| `energybasemajors` | Energy Base - Integrated Energy Majors |
| `energybasenuclear` | Energy Base - Nuclear Power & Advanced Reactors |
| `energybaseoilproduction` | Energy Base - Oil & Gas Exploration & Production |
| `energybaseoilrefining` | Energy Base - Refining & Midstream Infrastructure |
| `energybaseoilservices` | Energy Base - Oilfield Services & Equipment |
| `energybasethermal` | Energy Base - Coal & Thermal Power Generation |
| `energybaseutilities` | Energy Base - Utilities & Conventional Power Operators |

#### Energy Clean (9)
| Slug | Label |
|------|-------|
| `energycleanbatteries` | Energy Clean - Batteries & Storage |
| `energycleanbiofuels` | Energy Clean - Fuels & Bioenergy |
| `energycleangeothermal` | Energy Clean - Geothermal |
| `energycleanhydrogen` | Energy Clean - Hydrogen & Fuel Cells |
| `energycleanmaterials` | Energy Clean - Materials & Critical Metals |
| `energycleansmartgrid` | Energy Clean - Smart Grid & Electrification |
| `energycleansolar` | Energy Clean - Solar |
| `energycleanutilities` | Energy Clean - Utilities & Clean Power Operators |
| `energycleanwind` | Energy Clean - Wind |

#### Entertainment (6)
| Slug | Label |
|------|-------|
| `entertainmentbetting` | Entertainment - Sports Betting, Wagering & Prediction Markets |
| `entertainmentgambling` | Entertainment - iGaming & Online Gambling |
| `entertainmentgaming` | Entertainment - Game Publishers & Developers |
| `entertainmentinfrastructure` | Entertainment - Streaming & Gaming Infrastructure |
| `entertainmentmusic` | Entertainment - Music & Audio Streaming |
| `entertainmentvideo` | Entertainment - Video Streaming |

#### Environmental (5)
| Slug | Label |
|------|-------|
| `environmentalagriculture` | Environmental - Sustainable Agriculture |
| `environmentalairquality` | Environmental - Clean Technologies & Pollution Control |
| `environmentalclimate` | Environmental - Climate Technologies & Carbon Solutions |
| `environmentalwaste` | Environmental - Waste Management & Recycling |
| `environmentalwater` | Environmental - Water Infrastructure & Treatment |

#### EVs (7)
| Slug | Label |
|------|-------|
| `evsbatteries` | EVs - Batteries & Materials |
| `evscharging` | EVs - Charging & Infrastructure |
| `evschips` | EVs - Auto Semiconductors & Power Electronics |
| `evsfleets` | EVs - Fleet Management & Telematics |
| `evsmanufacturers` | EVs - Manufacturers |
| `evsselfdriving` | EVs - Autonomous Driving |
| `evssuppliers` | EVs - Key Suppliers & Autonomy Tech |

#### FinTech (7)
| Slug | Label |
|------|-------|
| `fintechblockchain` | FinTech - Crypto, Blockchain & Tokenization |
| `fintechexchanges` | FinTech - Exchanges & Market Infrastructure |
| `fintechinsurance` | FinTech - InsurTech & Embedded Insurance |
| `fintechlending` | FinTech - Lending, Credit & BNPL |
| `fintechneobanks` | FinTech - Digital Banking & Neobanks |
| `fintechpayments` | FinTech - Digital Payments & Merchant Infrastructure |
| `fintechtrading` | FinTech - Trading Platforms & WealthTech |

#### Hardware (11)
| Slug | Label |
|------|-------|
| `hardwaredatacenters` | Hardware - Data Center Infrastructure |
| `hardwareelectronics` | Hardware - Consumer Electronics |
| `hardwaregaming` | Hardware - Gaming & Immersive Peripherals |
| `hardwareindustrialiot` | Hardware - Industrial & IoT |
| `hardwarenetworking` | Hardware - Networking Equipment |
| `hardwarenextgen` | Hardware - Next-Gen & Specialty |
| `hardwarepcsdevices` | Hardware - Personal Computing & Devices |
| `hardwareprinting` | Hardware - Printing & Imaging |
| `hardwareservers` | Hardware - Servers, OEMs & Enterprise Systems |
| `hardwarestorage` | Hardware - Storage |
| `hardwaretelecom` | Hardware - Communications & Telecom |

#### Healthcare (9)
| Slug | Label |
|------|-------|
| `healthcaredevices` | Healthcare - Medical Devices & HealthTech Hardware |
| `healthcarediagnostics` | Healthcare - Diagnostics & Liquid Biopsy |
| `healthcaregenomics` | Healthcare - Genomics & Personalized Medicine |
| `healthcareitdata` | Healthcare - IT, Services & Data Infrastructure |
| `healthcaremetabolic` | Healthcare - Metabolic & Cardiometabolic |
| `healthcarenextgen` | Healthcare - Next-Gen Biotech Platforms |
| `healthcareoncology` | Healthcare - Oncology & Precision Cancer Therapeutics |
| `healthcaretelemedicine` | Healthcare - Digital Health & Telemedicine |
| `healthcaretherapeutics` | Healthcare - Regenerative Medicine & Psychedelics |

#### IoT (6)
| Slug | Label |
|------|-------|
| `iotedgedevices` | IoT - Connected Devices & Sensors |
| `iotenterprise` | IoT - Industrial & Enterprise IoT |
| `iothardware` | IoT - Edge Computing & Hardware Infrastructure |
| `iotnetworking` | IoT - Connectivity & Networks |
| `iotsecurity` | IoT - Security & Data Management |
| `iotsoftware` | IoT - Platforms, Software & Analytics |

#### Longevity (4)
| Slug | Label |
|------|-------|
| `longevityagingpharma` | Longevity - Age-Related Pharmaceuticals & Biotech |
| `longevityhealthcare` | Longevity - Healthcare & Medical Devices |
| `longevityhealthyaging` | Longevity - Healthy Aging & Nutrition |
| `longevityseniorliving` | Longevity - Senior Living & Assisted Care |

#### NanoTech (6)
| Slug | Label |
|------|-------|
| `nanotechelectronics` | NanoTech - Nanoelectronics & Semiconductors |
| `nanotechenergy` | NanoTech - Energy & Environment |
| `nanotechmaterials` | NanoTech - Nanomaterials & Manufacturing |
| `nanotechmedicine` | NanoTech - Nanomedicine & Drug Delivery |
| `nanotechproducts` | NanoTech - Consumer & Industrial Products |
| `nanotechresearchtools` | NanoTech - Research Tools & Advanced Instruments |

#### Nutrition (4)
| Slug | Label |
|------|-------|
| `nutritionaltprotein` | Nutrition - Plant-Based Foods & Meat Alternatives |
| `nutritionmealdelivery` | Nutrition - Food Delivery & Meal Kits |
| `nutritionretailers` | Nutrition - Organic & Natural Food Retailers |
| `nutritionsupplements` | Nutrition - Functional & Nutritional Supplements |

#### Quantum (6)
| Slug | Label |
|------|-------|
| `quantumapplications` | Quantum - Applications |
| `quantumcloud` | Quantum - Cloud Ecosystems |
| `quantumenablingtech` | Quantum - Enabling Technologies |
| `quantumhardware` | Quantum - Hardware Platforms |
| `quantumnetworking` | Quantum - Networking & Security |
| `quantumsoftware` | Quantum - Software & Tools |

#### Real Estate (7)
| Slug | Label |
|------|-------|
| `realestatehealthcare` | Real Estate - Healthcare & Senior Living |
| `realestatehousing` | Real Estate - Housing & Urban Living |
| `realestateittelecom` | Real Estate - Digital Infrastructure |
| `realestateoffice` | Real Estate - Office & Commercial Workspaces |
| `realestateretail` | Real Estate - Retail & Consumer Real Estate |
| `realestatetourism` | Real Estate - Travel & Entertainment Properties |
| `realestatewarehousing` | Real Estate - E-Commerce, Warehousing & Logistics |

#### Robotics (6)
| Slug | Label |
|------|-------|
| `roboticsautomation` | Robotics - Industrial Automation |
| `roboticsavmobility` | Robotics - Autonomous Vehicles & Mobility |
| `roboticsconsumer` | Robotics - Service & Consumer Robotics |
| `roboticslogistics` | Robotics - Logistics & Warehouse Robotics |
| `roboticsmachinevision` | Robotics - Sensors & Vision Systems |
| `roboticsmedical` | Robotics - Medical & Surgical Robotics |

#### Semis (9)
| Slug | Label |
|------|-------|
| `semisanalog` | Semis - Analog, Mixed-Signal & Power Management |
| `semiscompute` | Semis - Logic & CPUs, GPUs, Accelerators |
| `semisdesigntools` | Semis - EDA Tools & Design Software |
| `semisfoundries` | Semis - Foundries & Manufacturing |
| `semislithography` | Semis - Equipment, Lithography & Deposition |
| `semismemory` | Semis - Memory & Storage |
| `semisnextgen` | Semis - Emerging Technologies |
| `semispackaging` | Semis - Testing, Packaging & Assembly |
| `semiswireless` | Semis - Wireless & Connectivity |

#### Smart Home (6)
| Slug | Label |
|------|-------|
| `smarthomeautomation` | Smart Home - Automation & Control Systems |
| `smarthomedevices` | Smart Home - Connected Devices & Appliances |
| `smarthomeenergy` | Smart Home - Energy & Utilities |
| `smarthomenetworking` | Smart Home - Connectivity & Networking |
| `smarthomesecurity` | Smart Home - Security & Monitoring |
| `smarthomevoiceai` | Smart Home - Voice Assistants & AI Integration |

#### Social (5)
| Slug | Label |
|------|-------|
| `socialadvertising` | Social - Advertising Platforms |
| `socialgaming` | Social - Gaming Platforms |
| `socialnetworks` | Social - Networks & Communication Platforms |
| `socialniche` | Social - Niche Platforms |
| `socialvisualcontent` | Social - Image & Video Content Platforms |

#### Software (12)
| Slug | Label |
|------|-------|
| `softwarecollaboration` | Software - Collaboration & Communications |
| `softwarecrm` | Software - Customer Relationship Management & Marketing |
| `softwaredataanalytics` | Software - Data & Analytics |
| `softwaredesign` | Software - Design, Creativity & Engineering |
| `softwaredevops` | Software - DevOps, Management & Observability |
| `softwareecommerce` | Software - E-Commerce & Digital Platforms |
| `softwareenterprise` | Software - Enterprise Resource Planning & Management |
| `softwaregaming` | Software - Gaming & Platforms |
| `softwarehsaas` | Software - Horizontal SaaS Platforms |
| `softwareos` | Software - Operating Systems |
| `softwaresecurity` | Software - Cybersecurity |
| `softwarevsaas` | Software - Vertical SaaS Platforms |

#### Space (5)
| Slug | Label |
|------|-------|
| `spacedataanalytics` | Space - Data Analytics & Earth Observation |
| `spacedefense` | Space - Defense & Cybersecurity |
| `spaceinfrastructure` | Space - Infrastructure & Exploration |
| `spacelaunch` | Space - Logistics & Launch Services |
| `spacesatellites` | Space - Satellite Networks & Connectivity |

#### Telecom (6)
| Slug | Label |
|------|-------|
| `telecomcloudedge` | Telecom - Cloud & Edge Connectivity |
| `telecomenterprise` | Telecom - Enterprise & Unified Communications |
| `telecomg` | Telecom - 5G Technology & Semiconductors |
| `telecominfrastructure` | Telecom - Infrastructure & Equipment |
| `telecomsatcom` | Telecom - Satellite & Space Communication |
| `telecomwireless` | Telecom - Wireless Networks & Carriers |

#### Transportation (8)
| Slug | Label |
|------|-------|
| `transportationaircargo` | Transportation - Air Freight & Express Delivery |
| `transportationairtravel` | Transportation - Air Travel & Passenger Transportation |
| `transportationinfrastructure` | Transportation - Infrastructure & Equipment |
| `transportationmaritime` | Transportation - Marine Shipping & Ports |
| `transportationnextgen` | Transportation - Urban Mobility & Emerging Transport Tech |
| `transportationrail` | Transportation - Freight Rail & Infrastructure |
| `transportationtrucking` | Transportation - Trucking, LTL & Ground Freight |
| `transportationwarehousing` | Transportation - Logistics & Supply Chain Solutions |

#### V/A Reality (5)
| Slug | Label |
|------|-------|
| `varealityapplications` | V/A Reality - Content & Applications |
| `varealityenterprise` | V/A Reality - Enterprise & Industrial Solutions |
| `varealityhardware` | V/A Reality - Headsets & Hardware |
| `varealityinfrastructure` | V/A Reality - Infrastructure & Cloud Rendering |
| `varealitysoftware` | V/A Reality - Software Platforms & Operating Systems |

#### Wearables (5)
| Slug | Label |
|------|-------|
| `wearablesimmersive` | Wearables - Audio-Visual Immersive Devices |
| `wearablesmedical` | Wearables - Health Monitoring & Medical Devices |
| `wearablessmartwatches` | Wearables - Smartwatches & Fitness Devices |
| `wearablessoftware` | Wearables - Software & Ecosystems |
| `wearablessport` | Wearables - Sports, Fitness & Lifestyle Applications |

---


## ETF Filters (`etf_`)


ETF-specific filters appear when screening ETFs (industry = Exchange Traded Fund).


### Annualized Return (`etf_return_`)


Pattern: `etf_return_{period}o{N}` (over N%), `etf_return_{period}u{N}` (under -N%). Periods: `1y`, `3y`, `5y`. N = 0, 05, 10, 25.


### Net Expense Ratio (`etf_netexpense_`)


Pattern: `etf_netexpense_u{NN}` (under N.N%). NN = 01–10 (0.1%–1.0%).


### Net Fund Flows (`etf_fundflows_`)


Pattern: `etf_fundflows_{period}o{N}` / `etf_fundflows_{period}u{N}`. Periods: `1m`, `3m`, `ytd`. N = 0, 10, 25, 50.


### Asset Type (`etf_assettype_`)


28 asset types: bonds, commodities, equities, currency, crypto, MLP, preferred stock, SPAC, multi-asset, target date.


### Single Category (`etf_category_`)


34 categories for fine-grained ETF classification (bonds, commodities, currency, equity subtypes).


### Sponsor (`etf_sponsor_`)


437 ETF sponsors (e.g., `etf_sponsor_blackrockishares`, `etf_sponsor_vanguard`, `etf_sponsor_schwab`, `etf_sponsor_fidelity`).


---


## Industry Codes (`ind_`)


150 industry codes. Pattern: `ind_{lowercasename}` with spaces, hyphens, and special characters removed.


**Common examples:**

| Code | Meaning | Natural Language Keywords |
|------|---------|---------------------------|
| `ind_stocksonly` | Stocks only (ex-Funds) | funds除外, 株式のみ |
| `ind_exchangetradedfund` | Exchange Traded Fund | ETF |
| `ind_semiconductors` | Semiconductors | 半導体 |
| `ind_softwareapplication` | Software - Application | アプリ |
| `ind_softwareinfrastructure` | Software - Infrastructure | インフラソフト |
| `ind_biotechnology` | Biotechnology | バイオテクノロジー |
| `ind_banksregional` | Banks - Regional | 地銀 |
| `ind_banksdiversified` | Banks - Diversified | メガバンク |
| `ind_oilgasep` | Oil & Gas E&P | 石油ガス探鉱 |
| `ind_oilgasintegrated` | Oil & Gas Integrated | 統合石油 |
| `ind_reitindustrial` | REIT - Industrial | 物流REIT |
| `ind_reitresidential` | REIT - Residential | 住宅REIT |
| `ind_utilitiesregulatedelectric` | Utilities - Regulated Electric | 規制電力 |
| `ind_insurancepropertycasualty` | Insurance - Property & Casualty | 損保 |
| `ind_capitalmarkets` | Capital Markets | 資本市場 |
| `ind_drugmanufacturersgeneral` | Drug Manufacturers - General | 大手製薬 |
| `ind_medicaldevices` | Medical Devices | 医療機器 |
| `ind_aerospacedefense` | Aerospace & Defense | 航空宇宙・防衛 |
| `ind_restaurants` | Restaurants | 外食 |
| `ind_internetretail` | Internet Retail | ネット通販 |
| `ind_gold` | Gold | 金鉱 |
| `ind_steel` | Steel | 鉄鋼 |

For the complete list of 150 industry codes, use the finviz screener dropdown or the `finviz` Python library.


---


## Common Screening Recipes


### High Dividend Value (高配当バリュー)

```

f=cap_midover,fa_div_o3,fa_pe_u20,fa_pb_u2,fa_roe_o10,geo_usa

```

Mid-cap+ US stocks with 3%+ yield, P/E under 20, P/B under 2, ROE over 10%.


### Small-Cap Growth (小型成長株)

```

f=cap_small,fa_epsqoq_o25,fa_salesqoq_o15,fa_roe_o15,sh_avgvol_o200

```

Small-cap with 25%+ quarterly EPS growth, 15%+ sales growth, 15%+ ROE, adequate liquidity.


### Oversold Large-Cap (売られすぎ大型株)

```

f=cap_largeover,ta_rsi_os30,ta_sma200_pa,fa_pe_profitable,sh_avgvol_o500

```

Large-cap+ with RSI below 30 but still above 200-day MA, profitable, liquid.


### Breakout Candidates (ブレイクアウト候補)

```

f=cap_midover,ta_highlow52w_b0to5h,sh_relvol_o1.5,ta_sma50_pa,sh_avgvol_o300

```

Mid-cap+ within 5% of 52-week high, above-average volume, above 50-day MA.


### Insider Buying (インサイダー買い)

```

f=cap_smallover,sh_insidertrans_verypos,fa_pe_profitable,sh_avgvol_o100

```

Small-cap+ with very positive insider transactions, profitable, minimum volume.


### Short Squeeze Candidates (ショートスクイーズ候補)

```

f=sh_short_o20,sh_relvol_o2,ta_perf_1wup,cap_smallover

```

20%+ short float, 2x+ relative volume, up this week, small-cap or larger.


### Dividend Growth (配当成長)

```

f=fa_div_o2,fa_divgrowth_3yo10,fa_payoutratio_u60,fa_roe_o15,cap_midover,geo_usa

```

2%+ yield, 3Y dividend growth 10%+, payout under 60%, ROE 15%+, mid-cap+ US stocks.


### Deep Value (ディープバリュー)

```

f=fa_pb_u1,fa_pe_u10,fa_curratio_o1.5,fa_netmargin_pos,sh_avgvol_o100,cap_smallover

```

P/B under 1, P/E under 10, current ratio over 1.5, profitable, liquid.


### Momentum Leaders (モメンタムリーダー)

```

f=ta_perf_13wup,ta_perf_26wup,ta_sma50_pa,ta_sma200_pa,sh_relvol_o1,cap_midover

```

Up over 13 and 26 weeks, above 50 and 200 MA, above-average volume, mid-cap+.


### Fallen Angels (急落後リバウンド候補)

```

f=cap_largeover,ta_highlow52w_b20h,ta_rsi_os40,fa_pe_profitable,sh_avgvol_o500

```

Large-cap+ down 20%+ from 52W high, RSI under 40, profitable, liquid.


### AI Theme (AIテーマ)

```
--themes "artificialintelligence" --filters "cap_midover,ta_perf_13wup"
# URL: f=theme_artificialintelligence,cap_midover,ta_perf_13wup
```

AI-themed stocks, mid-cap+, up this quarter.

### AI Cloud + Compute Sub-themes (AIクラウド&コンピュート)

```
--themes "artificialintelligence" --subthemes "aicloud,aicompute" --filters "cap_midover"
# URL: f=theme_artificialintelligence,subtheme_aicloud%7Caicompute,cap_midover
```

AI theme with cloud and compute sub-theme drill-down, mid-cap+.


### Earnings Positive Surprise (決算好調)

```

f=fa_epsrev_bp,cap_midover,sh_avgvol_o200

```

Both EPS and Revenue beat estimates, mid-cap+, liquid.


### Near All-Time High (最高値付近)

```

f=ta_alltime_b0to5h,cap_largeover,sh_avgvol_o500

```

Within 5% of all-time high, large-cap+, liquid.


### Low EV/EBITDA Value (低EV/EBITDA)

```

f=fa_evebitda_u10,fa_evebitda_profitable,cap_midover,fa_roe_o10

```

EV/EBITDA under 10 and profitable, mid-cap+, ROE over 10%.

```

### scripts/open_finviz_screener.py

```python
#!/usr/bin/env python3
"""Build a FinViz screener URL from filter codes and open it in Chrome.

Usage:
    python3 open_finviz_screener.py --filters "cap_small,fa_div_o3,fa_pe_u20" --url-only
    python3 open_finviz_screener.py --themes "artificialintelligence,cybersecurity" --url-only
    python3 open_finviz_screener.py --themes "artificialintelligence" --subthemes "aicloud" --filters "cap_midover" --url-only
    python3 open_finviz_screener.py --filters "cap_small,fa_div_o3" --view valuation
    python3 open_finviz_screener.py --filters "cap_small,fa_div_o3" --elite
"""

from __future__ import annotations

import argparse
import os
import re
import shutil
import subprocess
import sys
import webbrowser
from urllib.parse import quote

# View type name -> code mapping
VIEW_CODES: dict[str, str] = {
    "overview": "111",
    "valuation": "121",
    "ownership": "131",
    "performance": "141",
    "custom": "152",
    "financial": "161",
    "technical": "171",
}

# Known filter prefixes (warning only if unknown)
KNOWN_PREFIXES: set[str] = {
    "an_",
    "cap_",
    "earningsdate_",
    "etf_",
    "exch_",
    "fa_",
    "geo_",
    "idx_",
    "ind_",
    "ipodate_",
    "news_",
    "sec_",
    "sh_",
    "subtheme_",
    "ta_",
    "targetprice_",
    "theme_",
}

# Strict token pattern: lowercase letters, digits, underscore, dot, hyphen only
_TOKEN_RE = re.compile(r"^[a-z0-9_.\-]+$")

# Slug pattern for theme/sub-theme values: lowercase letters and digits only
_SLUG_RE = re.compile(r"^[a-z0-9]+$")

# Order parameter pattern: optional leading dash, then lowercase letters/digits/underscore
_ORDER_RE = re.compile(r"^-?[a-z0-9_]+$")


def normalize_grouped_slug(value: str, prefix: str) -> str:
    """Strip optional prefix and whitespace from a theme/sub-theme slug."""
    value = value.strip()
    full_prefix = f"{prefix}_"
    if value.startswith(full_prefix):
        value = value[len(full_prefix) :]
    return value


def validate_grouped_slugs(raw: str, prefix: str) -> list[str]:
    """Validate comma-separated theme or sub-theme slugs.

    Args:
        raw: Comma-separated slug values (with or without prefix).
        prefix: ``"theme"`` or ``"subtheme"``.

    Returns:
        Deduplicated list of bare slugs in input order.

    Raises:
        SystemExit: If any slug is empty or contains invalid characters.
    """
    parts = [normalize_grouped_slug(p, prefix) for p in raw.split(",") if p.strip()]
    if not parts:
        print(f"Error: --{prefix}s must contain at least one slug.", file=sys.stderr)
        sys.exit(1)

    validated: list[str] = []
    for slug in parts:
        if not _SLUG_RE.match(slug):
            print(
                f"Error: Invalid {prefix} slug '{slug}'. "
                "Only lowercase letters and digits are allowed (no underscores, dots, or hyphens).",
                file=sys.stderr,
            )
            sys.exit(1)
        validated.append(slug)

    # Deduplicate preserving order
    return list(dict.fromkeys(validated))


def build_filter_parts(
    filters: list[str],
    themes: list[str] | None = None,
    subthemes: list[str] | None = None,
) -> list[str]:
    """Assemble filter parts in canonical order: theme → subtheme → plain filters."""
    parts: list[str] = []
    if themes:
        parts.append("theme_" + "|".join(themes))
    if subthemes:
        parts.append("subtheme_" + "|".join(subthemes))
    parts.extend(filters)
    return parts


def validate_filters(raw_filters: str) -> list[str]:
    """Validate and return a list of filter tokens.

    Each token must match ``^[a-z0-9_.\\-]+$`` (lowercase, digits, underscore,
    dot, hyphen).  Tokens containing ``&``, ``=``, spaces, or other characters
    are rejected to prevent URL injection.

    Unknown prefixes generate a warning to stderr but are not rejected.

    Returns:
        Sorted list of valid filter tokens.

    Raises:
        SystemExit: If any token fails the character-class check.
    """
    tokens: list[str] = [t.strip() for t in raw_filters.split(",") if t.strip()]
    if not tokens:
        print("Error: --filters must contain at least one filter code.", file=sys.stderr)
        sys.exit(1)

    validated: list[str] = []
    for token in tokens:
        # Check for theme/subtheme BEFORE regex validation
        if token.startswith("theme_") or token.startswith("subtheme_"):
            suggested = "--themes" if token.startswith("theme_") else "--subthemes"
            print(
                f"Error: '{token}' detected in --filters. "
                f"Use {suggested} instead for theme/sub-theme filtering.",
                file=sys.stderr,
            )
            sys.exit(1)
        if not _TOKEN_RE.match(token):
            print(
                f"Error: Invalid filter token '{token}'. "
                "Only lowercase letters, digits, underscores, and dots are allowed.",
                file=sys.stderr,
            )
            sys.exit(1)

        # Warn on unknown prefix (not an error)
        prefix = token.split("_", 1)[0] + "_" if "_" in token else ""
        if prefix and prefix not in KNOWN_PREFIXES:
            print(f"Warning: Unknown filter prefix '{prefix}' in '{token}'.", file=sys.stderr)

        validated.append(token)

    return validated


def validate_order(order: str) -> str:
    """Validate the sort order parameter.

    Must match ``^-?[a-z0-9_]+$`` (optional leading dash, then lowercase
    letters, digits, underscores).  Rejects characters that could inject
    additional URL parameters.

    Returns:
        The validated order string.

    Raises:
        SystemExit: If the order value fails validation.
    """
    if not _ORDER_RE.match(order):
        print(
            f"Error: Invalid order value '{order}'. "
            "Only lowercase letters, digits, underscores, and an optional leading dash are allowed.",
            file=sys.stderr,
        )
        sys.exit(1)
    return order


def detect_elite(args: argparse.Namespace) -> bool:
    """Determine whether to use elite.finviz.com.

    Priority:
    1. ``--elite`` flag → True
    2. ``$FINVIZ_API_KEY`` environment variable present → True
    3. Otherwise → False (public)
    """
    if args.elite:
        return True
    if os.environ.get("FINVIZ_API_KEY"):
        return True
    return False


def build_url(
    filters: list[str],
    *,
    elite: bool = False,
    view: str = "overview",
    order: str | None = None,
    themes: list[str] | None = None,
    subthemes: list[str] | None = None,
) -> str:
    """Build the full FinViz screener URL.

    Args:
        filters: List of validated filter tokens.
        elite: Use elite.finviz.com if True.
        view: View type name (overview, valuation, etc.).
        order: Optional sort order code (e.g., ``-marketcap``).
        themes: Optional list of theme slugs.
        subthemes: Optional list of sub-theme slugs.

    Returns:
        Complete URL string.
    """
    host = "elite.finviz.com" if elite else "finviz.com"
    view_code = VIEW_CODES.get(view, VIEW_CODES["overview"])

    parts = build_filter_parts(filters, themes, subthemes)
    filter_str = ",".join(parts)
    encoded_filter_str = quote(filter_str, safe=",_.-")

    url = f"https://{host}/screener.ashx?v={view_code}&f={encoded_filter_str}"
    if order:
        url += f"&o={order}"
    return url


def open_browser(url: str) -> None:
    """Open *url* in Google Chrome, with fallbacks.

    macOS: ``open -a "Google Chrome"``  → ``open``
    Linux: ``google-chrome`` → ``chromium-browser`` → ``xdg-open``
    Final fallback: ``webbrowser.open()``.
    """
    if sys.platform == "darwin":
        # Try Chrome first
        try:
            subprocess.run(  # nosec B607 — macOS open is a known local tool
                ["open", "-a", "Google Chrome", url],
                check=True,
                capture_output=True,
            )
            return
        except (subprocess.CalledProcessError, FileNotFoundError):
            pass
        # Fallback to default browser on macOS
        try:
            subprocess.run(["open", url], check=True, capture_output=True)  # nosec B607
            return
        except (subprocess.CalledProcessError, FileNotFoundError):
            pass
    elif sys.platform.startswith("linux"):
        for cmd in ("google-chrome", "chromium-browser", "xdg-open"):
            if shutil.which(cmd):
                try:
                    subprocess.run([cmd, url], check=True, capture_output=True)
                    return
                except (subprocess.CalledProcessError, FileNotFoundError):
                    continue

    # Final fallback
    webbrowser.open(url)


def parse_args(argv: list[str] | None = None) -> argparse.Namespace:
    parser = argparse.ArgumentParser(
        description="Build a FinViz screener URL and open it in Chrome.",
    )
    parser.add_argument(
        "--filters",
        required=False,
        default=None,
        help="(optional) Comma-separated FinViz filter codes (e.g., cap_small,fa_div_o3,fa_pe_u20).",
    )
    parser.add_argument(
        "--themes",
        default=None,
        help="Comma-separated theme slugs (e.g., artificialintelligence,cybersecurity).",
    )
    parser.add_argument(
        "--subthemes",
        default=None,
        help="Comma-separated sub-theme slugs (e.g., aicloud,aicompute).",
    )
    parser.add_argument(
        "--elite",
        action="store_true",
        default=False,
        help="Use elite.finviz.com (auto-detected from $FINVIZ_API_KEY if not set).",
    )
    parser.add_argument(
        "--view",
        default="overview",
        choices=sorted(VIEW_CODES.keys()),
        help="Screener view type (default: overview).",
    )
    parser.add_argument(
        "--order",
        default=None,
        help="Sort order code (e.g., -marketcap, dividendyield). Prefix - for descending.",
    )
    parser.add_argument(
        "--url-only",
        action="store_true",
        default=False,
        help="Print the URL without opening a browser.",
    )
    return parser.parse_args(argv)


def main(argv: list[str] | None = None) -> None:
    args = parse_args(argv)

    # Validate inputs
    filters: list[str] = []
    themes: list[str] | None = None
    subthemes: list[str] | None = None

    if args.filters is not None:
        filters = validate_filters(args.filters)
    if args.themes is not None:
        themes = validate_grouped_slugs(args.themes, "theme")
    if args.subthemes is not None:
        subthemes = validate_grouped_slugs(args.subthemes, "subtheme")

    if not filters and not themes and not subthemes:
        print(
            "Error: At least one of --filters, --themes, or --subthemes is required.",
            file=sys.stderr,
        )
        sys.exit(1)

    order = validate_order(args.order) if args.order else None
    elite = detect_elite(args)
    url = build_url(
        filters, elite=elite, view=args.view, order=order, themes=themes, subthemes=subthemes
    )

    mode = "Elite" if elite else "Public"
    print(f"[{mode}] {url}")

    if not args.url_only:
        open_browser(url)


if __name__ == "__main__":
    main()

```



---

## Skill Companion Files

> Additional files collected from the skill directory layout.

### scripts/tests/conftest.py

```python
"""Shared fixtures for FinViz Screener tests"""

import os
import sys

# Add scripts directory to path so modules can be imported
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
# Add tests directory to path so helpers can be imported
sys.path.insert(0, os.path.dirname(__file__))

```

### scripts/tests/test_open_finviz_screener.py

```python
"""Tests for open_finviz_screener.py"""

from __future__ import annotations

import argparse
import subprocess
from unittest import mock

import pytest
from open_finviz_screener import (
    KNOWN_PREFIXES,
    VIEW_CODES,
    build_filter_parts,
    build_url,
    detect_elite,
    open_browser,
    validate_filters,
    validate_grouped_slugs,
    validate_order,
)


# ---------------------------------------------------------------------------
# TestValidateGroupedSlugs
# ---------------------------------------------------------------------------
class TestValidateGroupedSlugs:
    """Grouped slug validation for themes and sub-themes."""

    def test_single_theme_slug(self):
        result = validate_grouped_slugs("artificialintelligence", "theme")
        assert result == ["artificialintelligence"]

    def test_multi_theme_slugs(self):
        result = validate_grouped_slugs("artificialintelligence,cybersecurity", "theme")
        assert result == ["artificialintelligence", "cybersecurity"]

    def test_prefix_stripping_theme(self):
        result = validate_grouped_slugs("theme_artificialintelligence", "theme")
        assert result == ["artificialintelligence"]

    def test_prefix_stripping_subtheme(self):
        result = validate_grouped_slugs("subtheme_aicloud", "subtheme")
        assert result == ["aicloud"]

    def test_mixed_prefix_no_prefix(self):
        result = validate_grouped_slugs("theme_artificialintelligence,cybersecurity", "theme")
        assert result == ["artificialintelligence", "cybersecurity"]

    def test_duplicate_removal(self):
        result = validate_grouped_slugs(
            "artificialintelligence,cybersecurity,artificialintelligence", "theme"
        )
        assert result == ["artificialintelligence", "cybersecurity"]

    def test_reject_empty(self):
        with pytest.raises(SystemExit):
            validate_grouped_slugs("", "theme")

    def test_reject_invalid_chars(self):
        with pytest.raises(SystemExit):
            validate_grouped_slugs("ai_cloud", "subtheme")

    def test_reject_uppercase(self):
        with pytest.raises(SystemExit):
            validate_grouped_slugs("ArtificialIntelligence", "theme")

    def test_whitespace_trimming(self):
        result = validate_grouped_slugs("  artificialintelligence , cybersecurity  ", "theme")
        assert result == ["artificialintelligence", "cybersecurity"]


# ---------------------------------------------------------------------------
# TestBuildFilterParts
# ---------------------------------------------------------------------------
class TestBuildFilterParts:
    """Filter parts assembly from themes, sub-themes, and plain filters."""

    def test_theme_only(self):
        result = build_filter_parts([], ["artificialintelligence"], None)
        assert result == ["theme_artificialintelligence"]

    def test_multi_theme_pipe(self):
        result = build_filter_parts([], ["artificialintelligence", "cybersecurity"], None)
        assert result == ["theme_artificialintelligence|cybersecurity"]

    def test_subtheme_only(self):
        result = build_filter_parts([], None, ["aicloud"])
        assert result == ["subtheme_aicloud"]

    def test_multi_subtheme_pipe(self):
        result = build_filter_parts([], None, ["aicloud", "aicompute"])
        assert result == ["subtheme_aicloud|aicompute"]

    def test_all_combined(self):
        result = build_filter_parts(
            ["cap_midover", "ta_perf_13wup"],
            ["artificialintelligence"],
            ["aicloud"],
        )
        assert result == [
            "theme_artificialintelligence",
            "subtheme_aicloud",
            "cap_midover",
            "ta_perf_13wup",
        ]


# ---------------------------------------------------------------------------
# TestBuildUrl
# ---------------------------------------------------------------------------
class TestBuildUrl:
    """URL construction for various configurations."""

    def test_public_overview_default(self):
        url = build_url(["cap_small", "fa_div_o3"])
        assert url == "https://finviz.com/screener.ashx?v=111&f=cap_small,fa_div_o3"

    def test_elite_url(self):
        url = build_url(["cap_small", "fa_div_o3"], elite=True)
        assert url.startswith("https://elite.finviz.com/screener.ashx")
        assert "f=cap_small,fa_div_o3" in url

    def test_valuation_view(self):
        url = build_url(["fa_pe_u20"], view="valuation")
        assert "v=121" in url

    def test_financial_view(self):
        url = build_url(["fa_roe_o15"], view="financial")
        assert "v=161" in url

    def test_technical_view(self):
        url = build_url(["ta_rsi_os30"], view="technical")
        assert "v=171" in url

    def test_ownership_view(self):
        url = build_url(["fa_insttown_o50"], view="ownership")
        assert "v=131" in url

    def test_performance_view(self):
        url = build_url(["ta_perf_13wup"], view="performance")
        assert "v=141" in url

    def test_custom_view(self):
        url = build_url(["cap_large"], view="custom")
        assert "v=152" in url

    def test_order_parameter(self):
        url = build_url(["cap_small"], order="-marketcap")
        assert "&o=-marketcap" in url

    def test_no_order_parameter(self):
        url = build_url(["cap_small"])
        assert "&o=" not in url

    def test_unknown_view_falls_back_to_overview(self):
        url = build_url(["cap_small"], view="nonexistent")
        assert "v=111" in url

    def test_all_view_codes_covered(self):
        expected = {"111", "121", "131", "141", "152", "161", "171"}
        assert set(VIEW_CODES.values()) == expected

    def test_single_theme_url(self):
        url = build_url([], themes=["artificialintelligence"])
        assert "theme_artificialintelligence" in url

    def test_multi_theme_url_encoded(self):
        url = build_url([], themes=["artificialintelligence", "cybersecurity"])
        assert "%7C" in url
        assert "theme_artificialintelligence%7Ccybersecurity" in url

    def test_theme_subtheme_filters_url(self):
        url = build_url(
            ["cap_midover"],
            themes=["artificialintelligence"],
            subthemes=["aicloud"],
        )
        assert "theme_artificialintelligence" in url
        assert "subtheme_aicloud" in url
        assert "cap_midover" in url


# ---------------------------------------------------------------------------
# TestValidateFilters
# ---------------------------------------------------------------------------
class TestValidateFilters:
    """Filter token validation."""

    # --- Valid tokens ---
    def test_single_filter(self):
        result = validate_filters("cap_small")
        assert result == ["cap_small"]

    def test_multiple_filters(self):
        result = validate_filters("cap_small,fa_div_o3,fa_pe_u20")
        assert result == ["cap_small", "fa_div_o3", "fa_pe_u20"]

    def test_whitespace_trimming(self):
        result = validate_filters("  cap_small , fa_div_o3  ")
        assert result == ["cap_small", "fa_div_o3"]

    def test_filter_with_dot(self):
        result = validate_filters("fa_ltdebteq_u0.5")
        assert result == ["fa_ltdebteq_u0.5"]

    def test_long_prefix_earningsdate(self):
        result = validate_filters("earningsdate_thisweek")
        assert result == ["earningsdate_thisweek"]

    def test_filter_with_hyphen(self):
        """Filters like fa_grossmargin_u-10 contain hyphens."""
        result = validate_filters("fa_grossmargin_u-10")
        assert result == ["fa_grossmargin_u-10"]

    def test_filter_with_hyphen_negative_value(self):
        result = validate_filters("fa_roa_u-50,sh_insidertrans_u-90")
        assert result == ["fa_roa_u-50", "sh_insidertrans_u-90"]

    def test_known_prefixes_accepted(self):
        # One filter from each known prefix category (theme_ and subtheme_ excluded — use --themes/--subthemes)
        tokens = [
            "an_recom_strongbuy",
            "cap_large",
            "earningsdate_thisweek",
            "etf_return_1yo10",
            "exch_nasd",
            "fa_pe_u20",
            "geo_usa",
            "idx_sp500",
            "ind_semiconductors",
            "ipodate_prevweek",
            "news_date_today",
            "sec_technology",
            "sh_avgvol_o200",
            "ta_rsi_os30",
            "targetprice_a20",
        ]
        result = validate_filters(",".join(tokens))
        assert len(result) == len(tokens)

    # --- Range pattern tokens ---
    def test_filter_with_range_pattern(self):
        """Range filter like fa_div_3to8 should pass validation."""
        result = validate_filters("fa_div_3to8")
        assert result == ["fa_div_3to8"]

    def test_filter_with_decimal_range(self):
        """Decimal range filter like ta_beta_0.5to1.5 should pass validation."""
        result = validate_filters("ta_beta_0.5to1.5")
        assert result == ["ta_beta_0.5to1.5"]

    def test_filter_with_custom_highlow_below_high(self):
        """Custom 52-week below-high range like ta_highlow52w_10to30-bhx should pass."""
        result = validate_filters("ta_highlow52w_10to30-bhx")
        assert result == ["ta_highlow52w_10to30-bhx"]

    def test_filter_with_custom_highlow_above_low(self):
        """Custom 52-week above-low range like ta_highlow52w_10to30-alx should pass."""
        result = validate_filters("ta_highlow52w_10to30-alx")
        assert result == ["ta_highlow52w_10to30-alx"]

    # --- Rejected tokens (URL injection) ---
    def test_reject_ampersand(self):
        with pytest.raises(SystemExit):
            validate_filters("cap_small&evil=1")

    def test_reject_equals(self):
        with pytest.raises(SystemExit):
            validate_filters("cap_small=bad")

    def test_reject_space_in_token(self):
        with pytest.raises(SystemExit):
            validate_filters("cap small")

    def test_reject_url_encoded(self):
        with pytest.raises(SystemExit):
            validate_filters("cap%20small")

    def test_reject_uppercase(self):
        with pytest.raises(SystemExit):
            validate_filters("Cap_Small")

    def test_reject_semicolon(self):
        with pytest.raises(SystemExit):
            validate_filters("cap_small;drop")

    def test_reject_slash(self):
        with pytest.raises(SystemExit):
            validate_filters("cap_small/evil")

    def test_reject_question_mark(self):
        with pytest.raises(SystemExit):
            validate_filters("cap_small?v=111")

    # --- Empty input ---
    def test_reject_empty_string(self):
        with pytest.raises(SystemExit):
            validate_filters("")

    def test_reject_only_commas(self):
        with pytest.raises(SystemExit):
            validate_filters(",,,")

    # --- Unknown prefix warning (stderr, no error) ---
    def test_unknown_prefix_warns(self, capsys):
        result = validate_filters("xyz_something")
        assert result == ["xyz_something"]
        captured = capsys.readouterr()
        assert "Warning: Unknown filter prefix" in captured.err

    def test_known_prefix_no_warning(self, capsys):
        validate_filters("fa_pe_u20")
        captured = capsys.readouterr()
        assert "Warning" not in captured.err

    def test_known_prefixes_count(self):
        """All 17 FinViz filter prefixes are registered."""
        assert len(KNOWN_PREFIXES) == 17

    def test_known_prefixes_include_theme(self):
        assert "theme_" in KNOWN_PREFIXES

    def test_known_prefixes_include_subtheme(self):
        assert "subtheme_" in KNOWN_PREFIXES

    def test_conflict_theme_in_filters(self, capsys):
        with pytest.raises(SystemExit):
            validate_filters("theme_artificialintelligence,cap_small")
        captured = capsys.readouterr()
        assert "--themes" in captured.err

    def test_conflict_subtheme_in_filters(self, capsys):
        with pytest.raises(SystemExit):
            validate_filters("subtheme_aicloud,cap_small")
        captured = capsys.readouterr()
        assert "--subthemes" in captured.err

    def test_conflict_theme_pipe_in_filters(self, capsys):
        """Pipe-containing theme token must be caught before _TOKEN_RE rejects it."""
        with pytest.raises(SystemExit):
            validate_filters("theme_artificialintelligence|cybersecurity")
        captured = capsys.readouterr()
        assert "--themes" in captured.err


# ---------------------------------------------------------------------------
# TestValidateOrder
# ---------------------------------------------------------------------------
class TestValidateOrder:
    """Order parameter validation."""

    # --- Valid orders ---
    def test_simple_order(self):
        assert validate_order("marketcap") == "marketcap"

    def test_descending_order(self):
        assert validate_order("-marketcap") == "-marketcap"

    def test_order_with_underscore(self):
        assert validate_order("dividend_yield") == "dividend_yield"

    def test_order_with_digits(self):
        assert validate_order("sma200") == "sma200"

    # --- Rejected orders (URL injection) ---
    def test_reject_ampersand(self):
        with pytest.raises(SystemExit):
            validate_order("-marketcap&evil=1")

    def test_reject_equals(self):
        with pytest.raises(SystemExit):
            validate_order("order=bad")

    def test_reject_space(self):
        with pytest.raises(SystemExit):
            validate_order("market cap")

    def test_reject_url_encoded(self):
        with pytest.raises(SystemExit):
            validate_order("-market%20cap")

    def test_reject_semicolon(self):
        with pytest.raises(SystemExit):
            validate_order("-marketcap;drop")

    def test_reject_uppercase(self):
        with pytest.raises(SystemExit):
            validate_order("-MarketCap")

    def test_reject_dot(self):
        with pytest.raises(SystemExit):
            validate_order("market.cap")


# ---------------------------------------------------------------------------
# TestEliteDetection
# ---------------------------------------------------------------------------
class TestEliteDetection:
    """Elite vs Public detection logic."""

    def _make_args(self, elite: bool = False) -> argparse.Namespace:
        return argparse.Namespace(elite=elite)

    def test_elite_flag_explicit(self):
        args = self._make_args(elite=True)
        assert detect_elite(args) is True

    def test_env_var_present(self):
        args = self._make_args(elite=False)
        with mock.patch.dict(
            "os.environ",
            {"FINVIZ_API_KEY": "test_key_123"},  # pragma: allowlist secret
        ):
            assert detect_elite(args) is True

    def test_no_flag_no_env(self):
        args = self._make_args(elite=False)
        with mock.patch.dict("os.environ", {}, clear=True):
            assert detect_elite(args) is False

    def test_elite_flag_overrides_missing_env(self):
        args = self._make_args(elite=True)
        with mock.patch.dict("os.environ", {}, clear=True):
            assert detect_elite(args) is True

    def test_empty_env_var_not_detected(self):
        args = self._make_args(elite=False)
        with mock.patch.dict("os.environ", {"FINVIZ_API_KEY": ""}):
            assert detect_elite(args) is False


# ---------------------------------------------------------------------------
# TestOpenBrowser
# ---------------------------------------------------------------------------
class TestOpenBrowser:
    """Browser opening with OS-specific fallbacks."""

    @mock.patch("open_finviz_screener.sys")
    @mock.patch("open_finviz_screener.subprocess.run")
    def test_macos_chrome(self, mock_run, mock_sys):
        mock_sys.platform = "darwin"
        mock_run.return_value = mock.MagicMock(returncode=0)
        open_browser("https://finviz.com/screener.ashx?v=111&f=cap_small")
        mock_run.assert_called_once_with(
            ["open", "-a", "Google Chrome", "https://finviz.com/screener.ashx?v=111&f=cap_small"],
            check=True,
            capture_output=True,
        )

    @mock.patch("open_finviz_screener.sys")
    @mock.patch("open_finviz_screener.subprocess.run")
    def test_macos_fallback_to_open(self, mock_run, mock_sys):
        mock_sys.platform = "darwin"
        # First call (Chrome) fails, second call (open) succeeds
        mock_run.side_effect = [
            subprocess.CalledProcessError(1, "open"),
            mock.MagicMock(returncode=0),
        ]
        open_browser("https://finviz.com/screener.ashx?v=111&f=cap_small")
        assert mock_run.call_count == 2
        assert mock_run.call_args_list[1][0][0] == [
            "open",
            "https://finviz.com/screener.ashx?v=111&f=cap_small",
        ]

    @mock.patch("open_finviz_screener.sys")
    @mock.patch("open_finviz_screener.shutil.which")
    @mock.patch("open_finviz_screener.subprocess.run")
    def test_linux_chrome(self, mock_run, mock_which, mock_sys):
        mock_sys.platform = "linux"
        mock_which.return_value = "/usr/bin/google-chrome"
        mock_run.return_value = mock.MagicMock(returncode=0)
        open_browser("https://finviz.com/screener.ashx?v=111&f=cap_small")
        mock_run.assert_called_once()
        assert mock_run.call_args[0][0][0] == "google-chrome"

    @mock.patch("open_finviz_screener.webbrowser.open")
    @mock.patch("open_finviz_screener.subprocess.run")
    def test_fallback_to_webbrowser(self, mock_run, mock_wb_open):
        # Both macOS calls fail → webbrowser fallback
        mock_run.side_effect = [
            subprocess.CalledProcessError(1, "open"),
            subprocess.CalledProcessError(1, "open"),
        ]
        url = "https://finviz.com/screener.ashx?v=111&f=cap_small"
        open_browser(url)
        mock_wb_open.assert_called_once_with(url)


# ---------------------------------------------------------------------------
# TestMainIntegration
# ---------------------------------------------------------------------------
class TestMainIntegration:
    """Integration tests via parse_args + main logic."""

    def test_url_only_prints_url(self, capsys):
        from open_finviz_screener import main

        with mock.patch.dict("os.environ", {}, clear=True):
            main(["--filters", "cap_small,fa_div_o3", "--url-only"])
        captured = capsys.readouterr()
        assert "https://finviz.com/screener.ashx" in captured.out
        assert "cap_small,fa_div_o3" in captured.out
        assert "[Public]" in captured.out

    def test_elite_flag_in_output(self, capsys):
        from open_finviz_screener import main

        with mock.patch.dict("os.environ", {}, clear=True):
            main(["--filters", "cap_small", "--elite", "--url-only"])
        captured = capsys.readouterr()
        assert "[Elite]" in captured.out
        assert "elite.finviz.com" in captured.out

    def test_view_selection(self, capsys):
        from open_finviz_screener import main

        with mock.patch.dict("os.environ", {}, clear=True):
            main(["--filters", "fa_pe_u20", "--view", "valuation", "--url-only"])
        captured = capsys.readouterr()
        assert "v=121" in captured.out

    def test_order_in_output(self, capsys):
        from open_finviz_screener import main

        with mock.patch.dict("os.environ", {}, clear=True):
            # Use = syntax because argparse treats -marketcap as a flag
            main(["--filters", "cap_small", "--order=-marketcap", "--url-only"])
        captured = capsys.readouterr()
        assert "o=-marketcap" in captured.out

    def test_themes_only_no_filters(self, capsys):
        from open_finviz_screener import main

        with mock.patch.dict("os.environ", {}, clear=True):
            main(["--themes", "artificialintelligence", "--url-only"])
        captured = capsys.readouterr()
        assert "theme_artificialintelligence" in captured.out

    def test_themes_and_filters(self, capsys):
        from open_finviz_screener import main

        with mock.patch.dict("os.environ", {}, clear=True):
            main(["--themes", "artificialintelligence", "--filters", "cap_midover", "--url-only"])
        captured = capsys.readouterr()
        assert "theme_artificialintelligence" in captured.out
        assert "cap_midover" in captured.out

    def test_subthemes_cli(self, capsys):
        from open_finviz_screener import main

        with mock.patch.dict("os.environ", {}, clear=True):
            main(["--subthemes", "aicloud,aicompute", "--url-only"])
        captured = capsys.readouterr()
        assert "%7C" in captured.out or "|" in captured.out
        assert "subtheme_" in captured.out

    def test_empty_themes_string(self, capsys):
        """--themes '' should produce a specific error, not the generic 'at least one' error."""
        from open_finviz_screener import main

        with pytest.raises(SystemExit):
            main(["--themes", "", "--url-only"])
        captured = capsys.readouterr()
        assert "--themes must contain at least one slug" in captured.err

    def test_no_input_at_all(self):
        from open_finviz_screener import main

        with pytest.raises(SystemExit):
            main(["--url-only"])

```

finviz-screener | SkillHub