Engineering Practices for LLM-Assisted Stock Screening: A Practical Guide

    This article presents a systematic, engineering-focused approach to integrating large language models (LLMs) into a stock selection workflow. It outlines a three-stage pipeline that combines quantitative screening to narrow the market, LLM-based analysis for fundamental research, and human judgment for final decision-making and risk management. The guide also clarifies the realistic capabilities and limitations of LLMs in finance, provides prompt design examples, and emphasizes the need for rigorous risk controls.

    Introduction: Can AI Help You Pick Stocks?

    As the capabilities of general-purpose large language models (LLMs) advance rapidly, more investors are exploring whether AI can improve stock selection and investment research efficiency. LLMs indeed demonstrate impressive information-processing abilities, from summarizing text and interpreting financial reports to conducting industry research. However, a clear conclusion can be drawn from practice: LLMs are powerful research assistants, but they are not—and should not be—“stock recommendation engines” that make decisions for you.

    This article takes an engineering perspective, systematically explaining how to embed LLMs into a complete stock-selection workflow: quantitative indicators for initial filtering, LLMs for fundamental and logical analysis, and human oversight for final decisions and risk management.

    Defining the Boundaries: What LLMs Can and Cannot Do (and a Note of Caution)

    Before designing a workflow, it’s critical to establish what LLMs can and cannot achieve.

    What LLMs cannot do:

    1. Predict short-term price movements. Daily stock price fluctuations are driven by random factors such as capital flows and unexpected events. No model can reliably predict next-day movement.
    2. Guarantee information timeliness. General LLMs have a knowledge cutoff date; their awareness of the latest announcements or intraday data depends on external data sources.
    3. Provide investment recommendations due to compliance constraints. When directly asked for traded recommendations, a responsible LLM will decline and warn about risks—not a lack of intelligence, but a necessary guardrail.

    What LLMs excel at:

    1. Structured information processing: Quickly reading through earnings reports, announcements, and research abstracts to extract key details.
    2. Comparative analysis: Evaluating multiple candidate stocks across consistent criteria like valuation, growth, and industry standing.
    3. Logic validation: Acting as a “devil’s advocate” to scrutinize your thesis for potential flaws.
    4. Knowledge explanation: Clarifying industry jargon, financial metrics, or chart patterns, lowering the research barrier.

    The reasonable positioning, therefore, is: LLMs serve as a “navigator” or “co-pilot,” not as “autopilot.”

    The Three-Stage Workflow Architecture

    A practical AI-assisted stock screening process can be structured in three stages:

    1. Market Data → [Stage 1: Quantitative Screen] → Candidate Pool (tens of stocks)
    2. Candidate Pool → [Stage 2: LLM Deep Research] → Watchlist (2-5 stocks)
    3. Watchlist → [Stage 3: Human Decision & Risk Control] → Trading Plan

    Stage 1: Quantitative Screening — Narrowing the Market

    With thousands of listed stocks, manually researching every one is unrealistic, and feeding the entire market to an LLM is constrained by context length and yields little value. The first step, therefore, is a quantitative pre-filter.

    One common approach is to categorize stocks by their lifecycle stage. Using a four-season analogy, stock price trends can be broken down:

    • Winter (Downtrend): Persistent decline, shrinking volume, low market attention.
    • Spring (Base Building): Sideways movement at lows; capital accumulates quietly, but the trend is unclear.
    • Early Summer (Initial Breakout): Price breaks resistance on higher volume, moving averages turn bullish, yet the market hasn’t fully noticed. This is often considered a favorable window for risk-reward.
    • Mid-summer (Main Rally): The trend is established, rising steadily along moving averages.
    • Late Summer (Parabolic Acceleration): Accelerating gains, surging volume, heavy retail inflow, and quickly accumulating risk.
    • Autumn (Distribution): High-level stagnation with heavy volume, positive news is priced in, and capital exits.

    The discipline here is to focus only on the “early summer” to “mid-summer” phases, realize profits during acceleration, and strictly avoid the distribution phase.

    The “early summer” characteristics can be translated into calculable quantitative conditions (illustrative pseudocode):

    1. def is_early_uptrend(stock):
    2. cond1 = stock.close > stock.ma20 > stock.ma60 # Early bullish alignment
    3. cond2 = stock.ma60_slope(days=10) > 0 # Long-term MA turning up
    4. cond3 = stock.volume / stock.volume_ma20 > 1.5 # Moderate volume expansion
    5. cond4 = stock.pct_change(days=60) < 0.30 # Limited cumulative gain, no acceleration
    6. cond5 = stock.close_recent_high_breakout() # Breakout from prior plateau
    7. return all([cond1, cond2, cond3, cond4, cond5])

    This narrows the universe to a pool of dozens of candidates. It is important to emphasize that quantitative conditions only address whether the price pattern “looks right,” not whether the stock “is worth buying.” This is where the LLM comes in.

    Stage 2: LLM Deep Research — From ~30 to ~3

    The second step is using the LLM for focused analysis, and prompt design is the key here.

    A poor prompt is: “Which of these 30 stocks will go up?”—the model cannot, and should not, answer this.

    A well-structured prompt should contain four elements: role, input data, analysis dimensions, and output format. For example:

    1. You are a rigorous securities research assistant. Below is information on
    2. 30 candidate stocks (code, industry, recent financial summary, recent
    3. announcement highlights).
    4. Please perform a qualitative analysis of each stock along these dimensions,
    5. without predicting price movement:
    6. 1. Industry momentum and policy environment;
    7. 2. Company fundamentals: revenue/profit growth, debt structure, cash flow quality;
    8. 3. Any material positive or risk events in recent announcements (share reduction, litigation, goodwill, etc.);
    9. 4. Valuation relative to the industry peer group.
    10. Finally, exclude names with clear risk flags or deteriorating fundamentals,
    11. rank the rest by "fundamental soundness," and present the output as a table.

    To ensure reliable analysis, it is advisable to provide the LLM with structured input data (financial summaries, announcement texts) rather than just ticker symbols—since the model’s internal knowledge may be outdated, especially for lesser-known small-cap stocks. Storing market and financial data files in cloud object storage and updating them via scheduled tasks can feed the model through an API, creating a semi-automated pipeline.

    After receiving the initial analysis, a follow-up “stress test” prompt is also valuable:

    1. For the recommended stocks above, play the role of a short-seller.
    2. List the top 3 reasons an investment thesis for each stock could be disproven in
    3. the upcoming quarter.

    This “red-team thinking” effectively counteracts optimistic bias from a single perspective. It is a distinct advantage of LLMs in research—they do not develop a positional bias just because they hold a view.

    Stage 3: Human Decision-Making and Risk Control

    No matter how robust the first two stages are, final decisions must be made by a human, supported by explicit risk rules:

    1. Position Management: A single position should not exceed a fixed percentage of total capital (e.g., 10%-20%) to avoid over-concentration.
    2. Stop-Loss Discipline: Determine a stop-loss level (e.g., fall below the breakout platform or a key moving average) before entering, and execute strictly.
    3. Periodic Review: During the holding period, re-run quantitative conditions weekly to check the lifecycle stage. If it shows signs of the “late summer” phase (sharp spikes, abnormal turnover), take profit in stages as planned.
    4. Cross-Verification: Always verify key facts (financial data, announcement content) from LLM output against primary information sources to prevent incorrect conclusions due to model “hallucinations.”

    Common Pitfalls and Best Practices

    Pitfall 1: Asking AI for direct stock picks. This yields neither useful answers nor the much-needed research process.

    Pitfall 2: Treating model output as ground truth. An LLM can generate plausible but entirely fabricated references. All critical data must be traced back to sources.

    Pitfall 3: Neglecting backtesting. Any cycle division or screening rules should first be validated against historical data for win rate and risk-reward before applying real capital. A low-cost historical backtesting environment can be set up using cloud container platforms and scheduled tasks.

    Summary of best practices:

    • The quantitative model provides breadth—scanning the market quickly.
    • The LLM provides depth—efficient reading and comparative analysis.
    • The human provides judgment—position sizing, discipline, and the final call.

    Conclusion

    The correct way to use LLMs for stock screening is not to search for an “AI stock oracle,” but to build an industrialized pipeline: data screening → AI research → human decision. AI compresses what used to be days of desk research into minutes, but the essence of investing—pricing risk and adhering to discipline—remains human. Always remember that market risk is inherent, and any tool is only an aid; rational decision-making and strict risk control are the foundation of long-term survival.