Code review finance
Skill LisonEvf/finance-skills/skills/development/code-review-finance
Reviews code with awareness of financial domain pitfalls: lookahead bias, data leakage, proper decimal handling, survivorship bias, overfitting, and correct backtesting methodology. Trigger when the user requests code review of trading or financial code.From its SKILL.md
npx -y skills add LisonEvf/finance-skills --skill code-review-financeAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
2.2 KB, as published. Nobody here has run it
Code Review (Finance-Aware)
Reviews code for financial-domain-specific correctness issues beyond general code quality.
Real Code Reference
tradinglearn/strategies/macd_strategy.py—generate_signals()uses.shift()to prevent lookahead; verify this is correcttradinglearn/backtest/backtester.py—run_backtest()iterates bars sequentially; verify ordertradinglearn/pytdx2/backtest.py—BacktestEnginehas its own execution loop; check for data leakage between train/test
What to Check
- Lookahead bias: verify no future data used in signal calculation (
.shift(1)is correct, raw access is suspicious) - Data leakage: train/test split must be temporal, not random —
data[:split_date]train,data[split_date:]test - Decimal handling: prices in cents vs yuan — K-line returns /1000, quotes return /100
- Survivorship bias: delisted stocks must be in historical universes
- Overfitting: parameter count vs data points ratio, out-of-sample validation
- Transaction costs: commission rate, slippage assumptions must be realistic
- Bid/ask spread: execution at mid-price is unrealistic for illiquid stocks
- Dividend handling: total return should include dividends
Review Process
- Read strategy logic, understand the core idea
- Trace data flow from raw prices → indicators → signals → trades
- Check temporal integrity — no peeking into future at any step
- Verify metric formulas against standard definitions
- Assess overfitting risk from parameter count and search space
- Report findings: critical / warning / suggestion