finlab_skill
- TypeScript
260
GitHub Stars
10
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill koreal6803/finlab-ai --skill finlab- backtesting-reference.md12.6 KB
- best-practices.md14.9 KB
- data-reference.md17.1 KB
- dataframe-reference.md18.8 KB
- factor-analysis-reference.md18.8 KB
- factor-examples.md27.7 KB
- machine-learning-reference.md18.6 KB
- README.md1.6 KB
- SKILL.md13.3 KB
- trading-reference.md7.3 KB
Overview
This skill is a concise, execution-first guide to the FinLab quantitative trading package for the Taiwan stock market. It focuses on practical workflows for data access, factor construction, backtesting, and moving from simulation to live orders. Use it to quickly produce reproducible strategies, run backtests, and get actionable metrics and reports.
How this skill works
The guide walks through a 5-step workflow: fetch FinLab tables with data.get(), build factors and boolean conditions using FinLabDataFrame helpers, construct a position DataFrame, run sim() for backtesting, and optionally convert results to live orders via OrderExecutor. It highlights token setup (.env), quota handling, and running code so users see results rather than copy-pasting instructions.
When to use it
- You need rapid backtest results and metrics for Taiwan (TSE/OTC) strategies.
- You are building factor-based stock selection using FinLab data and indicators.
- You want to convert backtest outputs to broker orders for execution.
- You must diagnose lookahead bias, data frequency or universe issues.
- You want to compare multiple strategies and print clear reports/charts.
Best practices
- Persist FINLAB_API_TOKEN in a .env and load with python-dotenv for reproducible runs.
- Always run code and present numeric results or open saved charts; avoid handing off execution to users.
- Use shift(1) and FinLabDataFrame methods to prevent lookahead bias; never reindex manually.
- Test with sim(..., upload=False) for experiments; set upload=True only for production-ready strategies.
- Respect daily quota limits; detect free tier and surface upgrade guidance when quota errors occur.
Example use cases
- Build a monthly rebalanced low P/B strategy: fetch price and PB, rank by PB, is_smallest(10), sim(resample='M').
- Backtest a momentum+liquidity screen: close.rise(10) & volume.average(20) > threshold, limit top N by market value.
- Compare two risk-managed variants: run sim() with different stop_loss/take_profit and print a comparison table.
- Convert a successful backtest to live orders: Position.from_report(report) -> OrderExecutor -> create_orders().
- Run factor analysis and IC tests using built-in factor-analysis helpers to refine signals.
FAQ
Free tier resets at 8:00 AM Taiwan time (UTC+8). Inform users about upgrade to VIP (5000 MB) and show the payment link for higher quota.
How do I avoid lookahead bias?
Use time-shifts (e.g., shift(1)), FinLabDataFrame methods for indicators, and never assign new indices or use positional iloc that references future rows.