StockASkill: A Local-First AgentSkill for Intelligent Stock Selection
Organizations: Independent Researcher Team.
Abstract
Quantitative equity selection and portfolio construction in emerging and cross-border markets frequently suffer from computational bottlenecks, remote API fragility, survivorship bias, and rigid execution constraints such as discrete board lots and investor-mandated drawdown limits. In this paper, we present StockASkill, a local-first, full-data-driven AgentSkill engineered as a specialized Quant Co-Processor for autonomous AI agents and quantitative researchers. Tailored for agile portfolios (10^5 ~ 10^7 RMB) where discrete lot execution and capital protection are mandatory, StockASkill embeds a columnar DuckDB OLAP engine over 42.44 million historical price records and 186,432 financial disclosures spanning 26 years across China A-shares, Hong Kong, US equities, and ETFs. By eliminating ad-hoc network dependencies during analysis, StockASkill reduces cross-sectional screening latency across 5,400+ equities from over 25 seconds to sub-0.5 seconds (a 95%+ reduction). We formalize an end-to-end mathematical pipeline integrating a 7+1 factor alpha model, an SLSQP convex optimizer under smooth CVaR drawdown surrogates with exact path projection, dynamic 100-share board lot integer quantization, and an autonomous thesis lifecycle finite-state machine. Furthermore, we provide a zero-disk, strongly-typed JSON streaming interface designed for high-throughput LLM tool-calling. Open-sourced at https://github.com/axjing/stockaskill, comprehensive empirical benchmarks from 2018 to 2024 demonstrate that the architecture achieves annualized Sharpe ratios exceeding 1.48 and Calmar ratios up to 2.17, while reducing max drawdown by up to 85% relative to benchmark indices.
Figures & tables
| Table Name | Primary Key | Description & Compression |
|---|---|---|
| daily_price | (code, market, date) | Split-adjusted OHLCV, turnover, VWAP, quality flags ( RLE/BitPacking ) |
| financial_indicator | (code, market, report_date) | Quarterly ROE, gross margin, FCF, debt-to-asset, revenue YoY |
| stock_pool | (code, market) | Universe metadata, listing date, ST/delisted flags, completeness score |
| sync_state | (scope_type, scope_key, data_kind) | Sync watermarks, last success timestamp, stream status |
| factor_daily_snapshot | (code, market, trade_date) | Precomputed cross-sectional factor values and percentile ranks |
| trade_calendar | (market, date) | Valid open exchange trading dates per market |
| Task Description | Engine Architecture | Latency | Speedup | Network I/O |
| Full-Market Screen | Row SQLite + Python Loop | 28.45 s | 0 MB | |
| Full-Market Screen | In-Memory Pandas Threads | 14.12 s | 0 MB | |
| Full-Market Screen | StockASkill (DuckDB SIMD) | 0.38 s | 0 MB | |
| Single Stock Diagnosis | Ad-hoc Remote REST API | 4.82 s | 2.4 MB | |
| Single Stock Diagnosis | StockASkill Local-First | 0.08 s | 0 MB | |
| Goal-Constrained MVO | Scipy SLSQP + Board Lot | 0.41 s | — | 0 MB |
| Parameter Category | Specification / Methodology | Value / Rule |
|---|---|---|
| Investment Universe | Dynamic Point-in-Time CSI 300 + CSI 500 | 800 Equities |
| Capital Capacity | Target Retail/Micro-Fund Capital Scale ( ) | 500,000 RMB |
| Rebalancing Frequency | Monthly Execution Schedule | Every 21 Trading Days |
| Portfolio Size | Top- Screened Alpha Candidates | Equities |
| Composite Factor Weights | Equal-Weighted Baseline ( ) | per factor |
| Covariance Estimator | Ledoit-Wolf Shrinkage Matrix ( ) | Trailing 126 Days |
| Strategy Preset | Constraint Mandate | Ann. Return | MaxDD | Sharpe | Calmar |
|---|---|---|---|---|---|
| CSI 300 Benchmark | Passive Buy & Hold | 3.12% | -39.54% | 0.22 | 0.08 |
| Momentum Enhanced | 18.42% | -11.85% | 1.48 | 1.55 | |
| Low Volatility | 12.65% | -5.82% | 1.62 | 2.17 | |
| Quality Growth | 15.11% | -7.94% | 1.54 | 1.90 |
Quantitative Finance
Quantitative finance uses mathematical models, statistics, and machine learning to value assets, measure risk, and guide trading and portfolio decisions.
See all 204 papers