
Fundamental Filter
Fundamental factor screening, filter stocks by PE/PB/ROE, financial statement fields...
Install
npx skills add HKUDS/Vibe-Trading --skill fundamental-filter -g -a claude-code -y- Repository
- HKUDS/Vibe-Trading37.4k
- Category
- Marketing
- Updated
- 3d ago
- License
- MIT
- Context cost
- Mediumabout 1,611 tokens
- Runs scripts
- Yes, review before use
What it does
Fundamental factor screening, filter stocks by PE/PB/ROE, financial statement fields, and other metrics for value or growth selection. Supports A-shares (via tushare extra_fields or fundamental_fields) and HK/US stocks (via yfinance Ticker info).
Fundamental Factor Screening
Purpose
Filter stocks using fundamental financial data (PE/PB/ROE, etc.) to build value or growth screen signals for backtesting. Supports multiple markets with different data sources.
Market Support
| Market | Data Source | Method | Supported Metrics |
|---|---|---|---|
| A-shares | tushare daily_basic | extra_fields in config.json | pe, pb, pe_ttm, ps_ttm, dv_ttm, total_mv, circ_mv, roe |
| A-shares | Tushare statements | fundamental_fields in config.json | income, balancesheet, cashflow, fina_indicator fields |
| US stocks | yfinance Ticker.info | Direct API call | trailingPE, forwardPE, priceToBook, returnOnEquity, marketCap, dividendYield |
| HK stocks | yfinance Ticker.info | Direct API call | trailingPE, priceToBook, returnOnEquity, marketCap |
Signal Logic
Value Filter (Default)
- PE < pe_max AND PE > 0 (exclude loss-making stocks)
- PB < pb_max
- ROE > roe_min
- All conditions met → long (1), otherwise → flat (0)
Growth Filter (Optional)
- PE_TTM within reasonable range (0 < PE_TTM < pe_ttm_max)
- ROE > roe_min (profitability floor)
- Market cap > mv_min (exclude micro-caps)
A-Share Usage (tushare)
config.json
{
"source": "tushare",
"codes": ["000001.SZ", "600036.SH", "000858.SZ"],
"start_date": "2023-01-01",
"end_date": "2024-12-31",
"extra_fields": ["pe", "pb", "pe_ttm", "roe", "total_mv"],
"initial_cash": 1000000,
"commission": 0.001
}
The extra_fields columns are automatically merged into the daily DataFrame by the DataLoader.
A-Share Statement Pre-Filter
Use fundamental_fields when the strategy needs PIT-safe financial statement data instead of daily valuation fields:
