How to Use Large Language Models for Stock Cycle Analysis
This article explains why feeding stock-picking questions directly to a large language model is not viable, and how to position the model as the semantic reasoning layer of a research pipeline instead. It covers a cycle-stage framework that replaces price-level prediction, a three-tier pipeline of quantitative screening, semantic refinement, and risk validation, plus engineering practices and common pitfalls. Readers will find reusable prompt structures, pseudocode for the screening logic, and guidance on keeping human review in the loop. The method is a research efficiency tool, not investment advice.
1. The Starting Problem: Why You Should Not Hand Stock Picking to an LLM
The first time most people try to use an AI coding tool or a general-purpose LLM for investment research, they get a polite refusal: the model cannot provide investment advice. This is not a capability gap. It is the result of two constraints stacking on top of each other.
The first is a compliance constraint. Model services offered to the public typically ship with safety policies that intercept direct buy/sell instructions and questions about price direction. This is standard industry practice. The second constraint is more fundamental: language models are good at semantic understanding, information summarization, and structured reasoning, but they do not natively hold structured data such as real-time quotes, tick-by-tick trades, or financial statement footnotes, and they know nothing about your account’s risk tolerance or position constraints. A model without data interfaces and rule constraints is like a well-read guide with no map and no compass: it can explain how the terrain formed, but it cannot get you to the destination.
So the correct technical framing is this: treat the LLM as the semantic processing and reasoning layer of the research pipeline, not as a market data source or the decision maker. Any judgment about “which stage we are in right now” must come from reproducible quantitative rules. What the model handles is cross-sectional comparison within a candidate set, generating research hypotheses, and organizing falsification conditions.
2. The Framework: Cycle Stages Instead of Price Targets
Abstracting a stock’s lifecycle into a set of stages is a common idea in quantitative investment research. One widely used breakdown looks like this:
- Winter: prices drift lower for a long stretch, volume shrinks, attention is minimal;
- Spring: sideways action in a bottom range, capital accumulates slowly, trend direction unconfirmed;
- Early summer: price breaks a key level, moving average structure turns bullish, but the market has not formed a consensus;
- Midsummer: the trend is established and rising steadily, price and volume confirm each other, the main advance;
- Late summer: an accelerating blow-off top, retail sentiment euphoric, volatility expanding, more signs of distribution;
- Autumn: good news is priced out, price falls back, value reverts.
The core discipline of the framework fits in one sentence: participate only in the early-to-middle phase of a confirmed trend, and take profits when sentiment becomes extreme. The discipline works because it converts the unpredictable problem of picking tops and bottoms into the relatively observable problem of structure and volume state.
One point deserves emphasis: the stage breakdown is only a prior hypothesis and must be tested against data. Every stage-classification indicator should be backtested out of sample, with win rates and drawdown distributions observed across different market regimes (trending, range-bound, loose and tight liquidity), so that a historical fit is not mistaken for a future rule.
3. Pipeline Design: A Three-Tier Structure of Coarse Screening, Fine Screening, and Validation
Tier 1: Quantitative coarse screening that shrinks the search space by two orders of magnitude
Thousands of instruments across the market cannot be read one by one, so rules have to narrow the field first. The coarse screen should keep only a few high signal-to-noise conditions, for example: price position relative to medium- and long-term moving averages, the time window in which the breakout occurred, volume expansion relative to the average multiple, whether volatility sits in a reasonable band, and whether fundamentals carry obvious flaws (unusual audit opinions, consecutive losses, major violations).
An illustrative rule expression (pseudocode, only to explain the screening logic, not an interface of any specific platform):
def screen(stock):cond_trend = stock.ma20 > stock.ma60 and stock.cross_up_days <= 5cond_volume = stock.vol_ratio_5d > 1.5cond_risk = not stock.has_audit_warning and stock.pb > 0cond_volatility = stock.atr_pct < 0.08return cond_trend and cond_volume and cond_risk and cond_volatilitycandidates = [s for s in universe if screen(s)]
The output of the coarse screen must be a structured list with field definitions, not just a block of code. Suggested fields: instrument ticker, industry, currently assigned stage, breakout date, volume ratio, volatility, market cap band, and a summary of recent announcements. Field completeness sets the ceiling on the quality of the reasoning in the second tier.
Tier 2: Semantic fine screening that has the model compare rather than predict
When you hand the screened list to the model, the key to prompt design is not “pick the ones that will go up” but bounding the task and the output structure. A reusable prompt skeleton:
Role: investment research assistant. Organize and compare information only; do not predict price direction.Input: candidate instrument list (fields below).Constraints:1. Reason only from the given fields; mark missing information as "unknown"; do not fill gaps or speculate;2. Score each instrument 1-5 on three dimensions: industry outlook consistency, price-volume structure health, announcement and fundamental risk;3. Output a table + one sentence of core logic per instrument + one main falsification condition;4. Do not output target prices; do not output buy/sell recommendations.
This design yields three benefits: comparable, traceable, and reviewable output. The model’s value lies in consolidating scattered fields into a structured judgment and in flagging logical conflicts on its own, for example “breakout accompanied by high turnover while the industry outlook is deteriorating.”
Tier 3: Risk validation and human review
Fine-screening results cannot be taken at face value. Add at least three kinds of validation: first, data consistency checks that confirm adjustment methods for prices, financial reporting conventions, and industry classifications are aligned; second, logic falsification checks that write an observable failure signal for each conclusion; third, portfolio-level checks that cap single-industry exposure and the overall volatility budget. A human makes the final decision; the model only supplies research material.
4. Engineering the Pipeline
To turn this flow into a reusable system, four areas matter. On the data layer, use object storage for quote and announcement snapshots and a message queue to decouple ingestion from computation. On the compute layer, run batch and backtest jobs on a container platform so environments stay reproducible. For observability, wire in logging and monitoring with alerts, and set thresholds for job failures, data delays, and field missing rates. On the model invocation side, add caching and rate limiting to avoid repeated spend and sudden spikes. If you use a general-purpose LLM service from a cloud provider, put prompts, model versions, and parameter configurations under version control so historical conclusions remain traceable.
5. Common Pitfalls and Risk Control
First, treating model output as prediction. Fluent prose from a language model is easily misread as high confidence, when it only reflects plausibility at the text level. Second, ignoring the data timestamp. Using future data creates look-ahead bias, so backtests must be sliced strictly by time. Third, over-tuning prompts while ignoring data quality; when fields are missing, no amount of prompt craft produces reliable conclusions. Fourth, ignoring extreme market conditions, where price-volume structure can fail instantly as liquidity dries up.
To be clear: the method described here is a research efficiency tool and does not constitute investment advice. Markets carry the risk of losing principal, and any automated flow should retain human final review and position limits. Put the LLM in the “organize and reason” seat and quantitative rules in the “classify and screen” seat, with a clean division of labor. That is the sustainable technical design.
