LLM-Assisted Development: From Brokerage Statements to Backtest Reports
A brokerage statement analysis project provides a practical way to assess whether large language models can help deliver verifiable software results. This article explains how to separate trade reviews from strategy backtesting, validate imported records, build recoverable market data pipelines, reconstruct account performance, and produce evidence-based reports. The focus is on traceability, reproducible calculations, and clear acceptance criteria—not polished output alone.
1. Evaluate LLMs by Whether They Deliver Verifiable Results
Evaluating a large language model’s development capabilities requires more than checking whether it can quickly generate code or produce a polished analysis. Real projects typically involve requirements clarification, file processing, external APIs, data storage, business calculations, and error recovery. A mistake in any of these areas can make the final conclusions unreliable, even when the program runs successfully.
Analyzing stock trading statements is a useful small-scale test of these capabilities. The inputs are personal transaction records, the external dependency is historical market data, and the outputs include trading behavior statistics, actual account performance, and backtest results under explicitly defined rules. The scope is manageable, yet broad enough to expose common problems in LLM-assisted development.
This kind of project supports a discussion of practical methods, not broad conclusions about any model’s overall performance, reliability, or investment analysis capabilities. A successful run may reflect a simple task. A stalled run may result from API rate limits, a pending tool operation, or an execution environment failure.
More useful evaluation criteria include:
- Requirements understanding: Can the model distinguish a review of actual trades from a strategy backtest?
- Data processing: Can it read all records and identify missing fields?
- Engineering implementation: Can it help build a maintainable, recoverable data pipeline?
- Result verification: Can calculations be traced back to source records?
- Awareness of limitations: Can it acknowledge insufficient data instead of forcing a conclusion?
2. Clarify the Goal: A Trade Review Is Not a Strategy Backtest
Giving a model transaction records and historical prices does not mean a backtest has been completed. This type of project involves at least three distinct layers.
Trade Review
A trade review answers, “What actually happened?” Relevant metrics include the number of purchases and sales, holding periods, transaction fees, realized profit and loss, and the trades responsible for most losses.
These metrics primarily depend on execution records. Reconstructing the full account also requires opening positions, opening cash, deposits and withdrawals, dividends, and other account events.
Behavioral Analysis
Behavioral analysis asks, “Which trading habits may be associated with the results?” Examples include whether frequent turnover generated high costs, whether profitable trades generally had shorter holding periods, or whether the trader repeatedly added to positions after losses.
This analysis can identify statistical associations, but it should not casually infer causation. A behavior appearing alongside losses does not mean it will necessarily cause losses in every market environment.
Strategy Backtesting
A strategy backtest asks, “What would have happened if trades had followed predefined rules?” It requires explicit definitions for signal timing, execution prices, position constraints, transaction costs, and conditions under which execution is impossible.
Deriving rules from successful historical trades and then using the same history to prove those rules effective introduces hindsight selection bias. A more defensible approach separates the rule-development period from the validation period and examines stability across different market conditions.
The first project milestone should therefore be a trustworthy trade review. Behavioral analysis and strategy experiments can follow, rather than starting with a vague request to “evaluate my trading ability.”
3. Build Trustworthy Inputs: File Conversion Does Not Replace Validation
Brokerage statements are often exported as spreadsheets. Converting them into plain text or lightweight markup can help a model understand their structure, but conversion does not guarantee completeness.
Common problems include:
- Parsing only one worksheet from a workbook containing several.
- Losing date or account fields because of merged cells.
- Treating security codes as numbers and removing leading zeros.
- Conflating missing values, zeros, and dashes.
- Misinterpreting numeric types because amounts contain thousands separators.
- Importing summary rows as actual transactions.
Keep three representations: the original file, normalized structured data, and a text view for the model. The original file supports traceability, structured data supports computation, and the text view supports interpretation. The model-readable text should not become the sole source of truth.
At a minimum, field mapping should cover execution date, security identifier, security name, event type, executed quantity, execution price, transaction amount, and fees. Preserve execution time, market identifier, and execution ID when available.
Use an exact decimal representation for monetary values. Quantity precision should reflect the asset type and trading rules. Event classification must extend beyond purchases and sales to include dividends, custody transfers, security transfers, and other nonstandard events.
The first acceptance check after import should confirm:
- The number of valid source records matches the number stored.
- The date range matches the user’s expectations.
- Purchase amounts, sale amounts, and total fees reconcile with the source file.
- Duplicate records, invalid identifiers, and abnormal prices have been identified.
- Every unrecognized event type appears on a manual review list.
The model can propose mapping rules, but the final mapping must pass programmatic checks and manual spot checks.
4. Break the Work into Testable Stages
A single request to “read the statements, fetch prices, create a database, run a backtest, and generate a report” makes development difficult to control. The model may begin drawing conclusions before validating the data, or omit important constraints merely to get the workflow running.
A safer approach defines stages with explicit deliverables.
Stage 1: Extract the Security List
Produce a unique list of securities, market identifiers, first and last trade dates, and unresolved items.
Treat security names as supporting information. Match market data using stable identifiers to avoid errors caused by name changes or abbreviated names.
Stage 2: Test the Data API
Check authorization scope, historical coverage, field definitions, rate limits, and response formats. Then test a small set of securities and dates.
A successful API call only means the request was processed. It does not establish that the returned data is suitable for analysis. Tests should also verify date ordering, field types, duplicates, trading suspension handling, and price-adjustment conventions.
Stage 3: Implement Collection and Storage
Fetch a minimal sample first, validate it, and only then expand coverage. The collection process should support rate limiting, timeouts, retries, checkpoint-based resumption, and idempotent writes.
Stage 4: Reconstruct Trades and Calculate Metrics
Separate calculation logic from report generation. Verify the numbers before asking the model to explain them. Every metric should include its calculation definition and data scope.
Stage 5: Add Backtesting Experiments
Introduce hypothetical strategies only after the input data and execution rules pass acceptance checks. If the final conclusions are disputed, this separation makes it easier to identify whether the disagreement concerns data, rules, or interpretation.
5. Collect Market Data at the Resolution the Analysis Requires
Do not assume that every project needs all available daily and intraday data. Data resolution should follow the analytical question.
Daily data is generally sufficient for an initial review of price changes during holding periods and daily account valuation. Finer-grained data becomes necessary when analyzing intraday execution timing or intraday strategies.
Daily bars cannot establish whether a stop-loss or take-profit level was reached first within the same day. Nor can they precisely reconstruct intraday execution conditions. When these questions arise, state the limitation rather than asking the model to infer a price path from a single daily bar.
The collection period also needs a clear rationale:
- Actual trade reviews should cover the holding and valuation periods.
- Indicator calculations may require an observation window before the analysis start date.
- Positions carried into the period require opening position information.
- Longer strategy validation periods should be defined separately, rather than collecting all historical data without limits.
When using multiple providers, store the source identifier, collection time, and price convention separately. Do not combine data from different sources into an apparently complete table without checking for discrepancies.
Price adjustment requires particular care. Reconciling actual executions requires the actual prices applicable at the time. Continuous return analysis may use a consistent adjusted-price convention. Corporate actions, price adjustments, and position changes must remain consistent; adjusting prices while ignoring changes in quantity or cash can produce incorrect results.
6. Design the Database for Traceability and Extension
Even a small personal project should avoid putting everything into one large table. At a minimum, consider separating these entities:
- Raw import records: Source file, import batch, and original fields.
- Security reference data: Security identifiers, markets, and validity periods.
- Normalized transaction records: Standardized executions and account events.
- Historical market data: Date or timestamp, prices, volume, and source.
- Collection tasks: Requested scope, status, retry count, and error details.
- Calculation results: Metrics, calculation version, and input data version.
Market data should have appropriate uniqueness constraints based on security identifier, timestamp, interval, source, and adjustment convention. Re-running a task should update or skip existing data, not insert duplicates.
Transaction deduplication requires more caution. Multiple legitimate executions may have the same security, timestamp, price, and quantity. Use a reliable execution ID when available. Otherwise, use source row numbers, import batches, and multi-field rules, while retaining a manual review process.
Do not place access credentials directly in requirements documents, code, or logs. Use runtime configuration or a dedicated credential-management mechanism, and redact sensitive log content. Brokerage statements also contain personal financial information, so apply least-privilege access and upload only the minimum necessary data.
7. Make Execution Observable Before Diagnosing a Stall
A long period without visible activity does not automatically indicate model failure. A delay may occur during generation, tool execution, API requests, database writes, or interface updates.
The collection process should record its current step and time spent in each stage. At a minimum, expose:
- Completed and pending security counts.
- The current security and date range.
- Newly inserted, updated, and skipped record counts.
- Request duration, retry count, and the latest error.
- The last successful write checkpoint.
Network timeouts and temporary service failures may justify bounded retries. Insufficient permissions, malformed requests, and incompatible fields should not trigger repeated blind attempts.
A paused task should resume from a checkpoint. Users should not have to keep clicking “run again,” and reruns should not create duplicate data. Reliability assessments should rely on observable execution information, not simply whether the interface displays animation or text.
8. Prioritize Calculation Rules over Report Wording
The most common errors in trade analysis often involve account and execution semantics, not code syntax.
Define the Cost-Basis Method
When positions are built through multiple purchases and sold in stages, use a consistent cost-allocation method, such as moving weighted average or first-in, first-out.
Different methods affect how realized profit and loss is allocated to individual sales. The report must disclose the method and avoid mixing conventions.
Net sale proceeds should deduct applicable fees, and position valuations should correspond to the valuation date. Unrealized gains and losses must remain separate from realized profit and loss.
Account for Cash Flows and Returns
Cumulative profit is not the same as a rate of return. Deposits during the period change the capital available. Simply subtracting opening assets from closing assets may incorrectly classify added funds as profit.
Time-weighted or money-weighted returns may be appropriate depending on the analytical goal, but their data requirements and scope must be explained. If cash-flow events are missing, mark account return calculations as incomplete.
Constrain Backtest Execution
A signal generated after the market closes cannot automatically execute at that day’s closing price. Likewise, a price touching a threshold does not guarantee a trade could have been filled.
Backtests should account for applicable trading rules, suspensions, price limits, volume constraints, fees, and slippage. Where detailed market data is unavailable, conservative assumptions may be used, but they must be disclosed along with their potential effect on the results.
Add Basic Invariant Checks
Position quantities should not become negative without an explained reason. Cash changes should reconcile with trades and funding events. Daily account equity should equal cash plus the market value of securities.
If these checks fail, stop report generation and investigate the underlying data first.
9. Reports Should Present Evidence, Not Label the User
Statements such as “you are destined to fail” or “you are heading for ruin” are neither rigorous nor useful. Trades from a limited historical period cannot support deterministic predictions about someone’s future performance.
A professional report should include:
- Data scope: Covered dates, record counts, missing fields, and known limitations.
- Metric results: Returns, drawdowns, trading costs, holding periods, and their calculation definitions.
- Behavioral observations: Patterns that recur within the current sample.
- Evidence references: The trades or periods supporting each important conclusion.
- Validation recommendations: Hypotheses worth testing in an independent period.
The model’s role is to organize verified calculation results into clear prose. It should not estimate key metrics by reading large volumes of transaction records in natural language.
For example, a report may state that “short-holding-period trades accounted for a high proportion of fees in this sample,” but only after the relevant grouped statistics have been calculated. That observation does not justify claiming that fewer trades will necessarily improve future returns.
10. The Real Test Is End-to-End Delivery
The central question is not whether an LLM can write a report that sounds professional. It is whether it can help developers establish a complete, verifiable workflow:
Traceable source files → validated data conversion → recoverable market data collection → reproducible business calculations → evidence-backed conclusions.
Start with a minimum viable version: import the statements completely, confirm the security list, collect the necessary daily data, reconstruct basic positions, and generate a trade review that explains its calculation conventions.
Once these components are stable, add finer-grained data, cross-source validation, and strategy experiments.
LLMs can reduce the effort involved in coding, documentation, and test-case preparation. They cannot replace developer responsibility for business rules, data quality, and acceptance criteria. The most meaningful evaluation measures are reproducible results, required manual corrections, error recovery, and maintenance costs—not the quality of a single conversation.
This article discusses data engineering and historical trading analysis methods. It does not constitute investment advice. Historical performance and backtest results do not guarantee future returns.
