LLM-Driven Multi-Market Stock Analysis System Design
A reliable stock analysis system separates deterministic signals from language-model interpretation. This article outlines a daily batch architecture for mainland Chinese, Hong Kong, and U.S. equities, indices, and ETFs, covering data contracts, evidence-based dashboards, configurable strategies, model boundaries, backtesting, and operational controls. The goal is auditable decision support—not automated trading promises.
Stock analysis that amounts to “show the model a candlestick chart and ask for a conclusion” is difficult to reproduce or audit. A more reliable approach treats the system as a daily batch pipeline: standardize data definitions and timestamps, generate computable signals with rules and statistical models, then use a large language model to consolidate evidence into readable conclusions and risk warnings.
For a system covering mainland Chinese A-shares, Hong Kong and U.S. equities, and common broad-market indices, sector indices, and ETFs, the main differences are trading calendars, price-adjustment conventions, currencies, and time zones—not the underlying analytical framework.
1. Define the Problem as Decision Support
For individual investors and research teams, the problem is usually not a lack of data but fragmented information. Prices, disclosures, and news live in separate sources; news may arrive late; ownership and capital-flow metrics may use inconsistent definitions. Manual reviews are difficult to complete reliably after every market close.
The objective should be decision support, not a promise of automated order execution. Each output should answer four questions:
- What changed from yesterday’s conclusion?
- Which verifiable evidence supports the assessment?
- What are the main risks?
- Which checks remain before taking action?
Two common objections should inform the engineering design.
First, using a generative model directly for technical analysis is often unnecessary. Moving averages, volatility bands, and trend structures are better handled through deterministic calculations.
Second, in news-driven short-term trading, public reporting often lags themes already reflected in prices. The architecture should therefore separate computable factors from textual interpretation. The factor engine determines direction and thresholds; the language model turns multi-source evidence into a consistent narrative while explicitly identifying timing limitations and conflicts.
2. Use a Six-Layer Architecture
Layers should communicate through structured objects rather than relying on prompts as the only interface.
Universe and calendar layer: Maintain watchlists of stocks, indices, and ETFs, along with market-specific trading days, suspensions, price adjustments, and time zones. Trigger analysis within a fixed window after each market’s local close so that incomplete intraday candles are not treated as daily bars.
Data ingestion layer: Collect prices, financial statements, disclosures, news, sentiment, and available public capital-flow statistics, including cross-border flows into and out of mainland Chinese and Hong Kong markets where available. Every record should include its source, collection time, and event time. Store raw snapshots in object storage for replay.
Feature and strategy layer: Calculate technical indicators, approximate traded-volume or holding distributions, fundamental ratios, and rule-based strategy signals. Implement strategies as pure functions that accept a historical window and return direction, strength, and invalidation conditions.
Evidence consolidation and model layer: Assemble numerical signals, disclosure summaries, and news timelines into an evidence package before calling the LLM. Conclusions must not contain data that the model was not given.
Decision dashboard layer: Use a fixed layout for the core assessment, composite score, calculation basis for reference buy and sell ranges, risk alerts, and an action checklist.
Distribution and validation layer: Use a message queue to deliver results to dashboards or notification channels. Later, evaluate direction and simulated returns using closing-price paths, and write the results back to support prompt and weight revisions. Never automatically rewrite historical conclusions.
A task definition can remain lightweight. The contract matters more than the framework:
job:market: CN | HK | USasof: 2026-04-08symbols: [watchlist]stages: [ingest, features, strategies, llm_brief, dashboard, notify]degrade: If sentiment data is missing, skip sentiment text; do not fill gaps with speculation
In the cloud, object storage can retain snapshots, message queues can decouple ingestion from analysis, and container platforms can run daily jobs. Logs, monitoring, and alerts expose failures and delays. These are general capabilities and do not require proprietary interface names.
3. Keep Dashboard Fields Consistent
A dashboard is valuable because its layout supports comparison over time—not because it adopts a different writing style every day. Include at least the following fields:
- Core assessment: Bullish, wait-and-see, or cautious, with a defined validity period—for example, review before the next trading session opens.
- Scores: Component scores and a total score. Components may cover trend, volatility, event risk, and liquidity. The total is a weighted result; weights belong in configuration and should be backtestable. The model must not change them during generation.
- Price levels: Support, resistance, and invalidation levels must come from indicator calculations, such as previous highs and lows, moving averages, or volatility bands. The model explains these levels rather than inventing new numbers.
- Risk alerts: Trading suspensions, earnings-report windows, unusual volume, missing data, cross-market currency movements, and extreme index conditions.
- Action checklist: Confirm that position limits still satisfy the user’s rules, price adjustments have been checked, original disclosures have been reviewed, and conclusions are not being drawn from delayed data.
A score is not prediction accuracy. The interface should state that it measures evidence consistency, not future returns.
4. Implement Multidimensional Analysis
Technical indicators
Use deterministic calculations for moving-average trends, momentum, volatility, and price–volume divergence. Real-time prices are suitable for intraday monitoring, but daily decisions must use corrected post-close data. Record whether a price feed is still provisional.
Approximate holding and cost distributions
Most retail datasets support only approximations, such as volume-by-price distributions and turnover-based decay estimates. State the method and historical window. Do not present these estimates as exchange-level, transaction-by-transaction ownership records.
News and disclosures
Keep official disclosures and news in separate pipelines. Give original disclosures priority over media summaries, and extract event types, amounts, and dates.
Tag news with publication times and topics, and assess how much the related price move may already have occurred. If the relevant sector moved sharply before the news became public, the narrative should say that the information may be lagging rather than treating an old story as a new catalyst.
Capital flows and fundamentals
Use publicly available capital-flow definitions and compare individual securities with their indices and sectors. Otherwise, a volume spike in one stock may be mistaken for a trend reversal.
For fundamentals, use only verifiable fields: revenue, profit, valuation percentiles, assets, and liabilities. Missing values must remain missing. The model must not fabricate financial-statement figures.
Evidence consolidation
Use an evidence table in which each item has a type, timestamp, direction—positive, negative, or neutral—and confidence attribution indicating whether it comes from a rule or a model.
When evidence conflicts, downgrade the conclusion to wait-and-see and identify both sides of the conflict. This is more consistent with risk control than forcing a directional answer.
5. Build Configurable Strategies and Daily Market Reviews
Built-in strategies should be pluggable and individually disableable. Examples include:
- Moving-average bullish and bearish signals.
- Volatility-range breakouts.
- Sentiment-cycle proxies, such as advancing versus declining stocks or statistics on consecutive daily price-limit gains, enabled only when a suitable data source exists.
- Rule-based approximations of trend structures.
Interpretive systems such as Chan theory, a Chinese technical-analysis approach, or Elliott Wave analysis must first be expressed as testable rules with invalidation conditions. Adding their names to a prompt and expecting the model to interpret a chart is not enough.
For U.S. equities, market-regime labels such as trending, range-bound, or high-volatility can be derived from index returns and volatility. Use these labels as context filters for individual-stock signals, not as unexplained standalone switches.
Generate a daily market review covering major index returns, advancing and declining stocks, changes in trading value, and sector-relative strength. Individual-stock conclusions must reference that day’s market environment.
When an index falls sharply, reduce the weight assigned to improving technical signals in individual stocks. The checklist should also flag liquidity and price-gap risks.
Do not share unconverted thresholds across mainland Chinese, Hong Kong, and U.S. markets. Price limits, trading hours, short-selling mechanisms, and financial-reporting frequency differ. Configure strategy parameters by market and report backtest results separately.
6. Set Clear Boundaries for the Language Model
Language models are well suited to:
- Summarizing multiple documents.
- Explaining conflicting evidence.
- Converting evidence tables into a fixed reporting template.
- Explaining indicator meanings in plain language.
They are not suited to inventing entry or exit levels without data, claiming historical win rates instead of running a backtest, or identifying wave structures from screenshots without a defensible basis.
Prompts should require the model to:
- Use only numbers in the evidence package.
- Attach evidence identifiers to every judgment.
- Return “insufficient data” when a conclusion cannot be supported.
Use a relatively low temperature and generate structured fields before rendering the dashboard so that outputs can be validated. If the model service times out, publish only the rule-engine results and label them “not synthesized by the language model.”
When using a cloud-hosted inference service, retain request records and evidence-package hashes for subsequent audits. Do not include API keys, brokerage account details, or nonpublic orders in prompts.
7. Backtest and Validate Without Rewriting History
Backtesting should evaluate the direction the system actually reported at the time—not reconstruct its analysis using future data.
The process is:
- Freeze the day’s evidence package and conclusion.
- Over the following N trading days, use adjusted closing prices to measure directional correctness, maximum adverse movement, and simple simulated returns.
- Use a fixed holding period and include simplified transaction-cost assumptions.
- Disclose the sample period, treatment of trading suspensions, and price-adjustment method.
Break down accuracy by market, strategy, and whether a major disclosure occurred. A single overall win rate can hide important differences.
Simulated returns are not live trading returns. Slippage, market impact, failed execution, currency movements, and taxes or fees can all cause actual results to differ.
Validation reports should reveal systematic weaknesses—for example, a news module that consistently arrives late or a moving-average parameter that fails in high-volatility conditions. Use these findings to revise rules and weights going forward, not to retroactively change previously distributed records.
8. Address Operations, Security, and Compliance
Daily tasks need an idempotency key based on market, date, and symbol. Failed jobs should be rerunnable without sending duplicate notifications.
Monitor at least:
- Data ingestion latency.
- Missing-data rates.
- Model refusal rates.
- Validation failures caused by numerical mismatches between conclusions and evidence.
Use only public or licensed data that the system is authorized to access. Retain internal source-link identifiers for traceability; external presentation does not need to depend on project identifiers from a particular community or hosting platform.
Outputs should carry a disclaimer: the content supports research, does not constitute investment advice, and leaves decision responsibility with the user.
For personal use, start with a small watchlist, one market, a rule engine, and template-based briefs. Enterprise deployments can then add permissions, auditing, and tenant isolation.
Establish a reliable evidence trail and meaningful backtesting before increasing the number of strategies. That is usually a more effective path to a usable analysis system than accumulating increasingly elaborate model prompts.
