Evaluating LLM Engineering Skills with a Trade Review System

    What_large language models can actually do in real development is hard to judge from a few chat answers. This article walks through building a stock trade review system with an LLM as a coding assistant, showing how to break the project into verifiable stages, handle structured trade data, manage market data collection, and evaluate the model with concrete engineering metrics rather than impressions.

    1. Evaluate LLMs with Verifiable Engineering Tasks

    When a new large language model is released, a few rounds of Q&A are rarely enough to judge whether it fits real development work. Fluent answers, long code blocks, and professional-sounding explanations do not mean a system will run, let alone that its results are trustworthy.

    A more valuable approach is to pick a small project with clear boundaries, realistic inputs, and verifiable results. Let the model participate in requirements analysis, implementation, debugging, and report generation, then observe how it performs across the full workflow.

    A stock trade review system is a good case study. It touches tabular data, external data APIs, database modeling, job scheduling, statistical computation, and natural-language explanation—exposing both the strengths and limits of a model across multiple engineering activities.

    One caveat first: such a system analyzes historical trading behavior. It is not a return-prediction tool, and a model should never draw definitive conclusions about an investor’s prospects from a single trade confirmation file. Reliable conclusions require complete data, explicit assumptions, and reproducible calculations.

    2. Trade Review vs. Strategy Backtesting

    Before writing any code, the most important step is defining the problem. “Analyze my trade confirmations against historical market data” can mean two very different tasks.

    1. Trade review: explaining what already happened

    A trade review starts from real execution records and answers questions such as:

    • Which trades drove the gains and losses?
    • How much did fees affect the outcome?
    • Are there signs of over-concentration, overtrading, or averaging down after losses?
    • How do results differ across holding periods and position sizes?
    • How did prices move after actual executions?

    This kind of analysis does not require inventing a trading strategy. The goal is to accurately reconstruct trades, positions, and cash flows.

    2. Strategy backtesting: validating executable rules

    Backtesting requires rules defined in advance—entry, exit, position sizing, and risk controls—then simulates them against historical data.

    For example, “buy and hold for five trading days” is a valid rule. “Sell when the chart looks bad” is not backtestable, because it lacks an objective trigger condition.

    If you derive rules from your own trade history and validate them on the same data, overfitting is likely. A safer approach is to separate a rule-building window from a validation window, and reserve untouched data for out-of-sample testing.

    So the first phase of this project should focus on reviewing real trades. Only after the data and calculations are proven reliable should the scope expand to backtesting.

    3. Processing Trade Confirmations: Readable Text Is Not Structured Data

    Spreadsheets exported from trading software typically include trade date, security code, security name, transaction type, quantity, price, amount, and fees. Real files also often contain subtotal rows, blank rows, repeated headers, fund transfers, and corporate action records.

    Converting a spreadsheet into marked-up text helps a model understand column names and samples, but it should not be the only data source. Conversion can lose cell types, leading zeros, date formats, formula results, or relationships between worksheets.

    A more reliable approach keeps both representations:

    • The original file and its structured parse, as the basis for computation;
    • Field descriptions, samples, and quality summaries, as material for model understanding.

    1. Preserve original records and provenance

    Every import should record the file’s checksum, import batch, original row numbers, and parsing version, so any number can be traced back to its source row.

    Store security codes as strings to avoid losing leading zeros. Use fixed-point or exact decimal types for monetary amounts to minimize cumulative floating-point errors.

    2. Define standard fields

    At minimum, normalize the following fields:

    Field Purpose
    Account identifier Distinguishes accounts; must be anonymized before entering model context
    Security identifier Links trades to market data
    Trade date and time Establishes order of transactions
    Transaction type Distinguishes buys, sells, dividends, transfers, etc.
    Quantity and trade price Reconstructs position changes
    Trade amount and fees Computes cash flow and transaction costs
    Source batch and row number Supports traceability and auditing

    Fee fields may already include certain taxes, or taxes may be listed separately—never sum them again without verification.

    3. Reconcile after cleaning

    At minimum, verify the number of trades, total trade amounts, total fees, and position changes for sample records.

    If positions exist before the analysis window, you must provide opening positions and cost basis; otherwise the first sell in the window may be misidentified as an anomalous trade. When a security changes its name, don’t match by name alone—use a stable security identifier and keep the necessary mappings.

    4. Break the Work into Acceptable Stages

    Asking a model to “build data collection, backtesting, and reporting” in one shot invites scope drift: the model may skip data validation entirely and produce a complete-looking but unverifiable result.

    Use staged development instead:

    1. Identify trade confirmation fields and transaction types;
    2. Extract the security identifiers involved;
    3. Manually confirm the security list and analysis time range;
    4. Verify market data API access and response structure;
    5. Set up the database and collect a small sample;
    6. Run bulk collection with quality checks;
    7. Reconstruct positions and cash flows;
    8. Compute statistical metrics;
    9. Generate a review report with evidence citations.

    Each stage needs defined inputs, outputs, and acceptance criteria. For example, the extraction stage’s requirement should not be “produce a list,” but “every security identifier must be traceable to an original record, with unrecognizable items listed separately.”

    This approach both reduces deviation from requirements and lowers the cost of fixes.

    5. Market Data Collection: Confirm Scope, Access, and Granularity Up Front

    “Pull all daily and intraday data” sounds simple but hides many undefined conditions.

    Clarify first:

    • Does “all” mean since listing, or just the analysis window?
    • What intraday granularity is needed?
    • Does the data API allow access to the required historical range?
    • Does the current account have the needed permissions?
    • How should gaps from suspensions, newly listed stocks, or delistings be interpreted?
    • Should you use raw or adjusted prices?

    API access is tied to permissions, rate limits, and data types. You cannot infer that all historical data is available just from an account tier or a quota number.

    1. Start with a minimal sample validation

    Pick a few securities and a short window first. Check returned fields, time formats, ordering, duplicates, and price conventions. Only expand the collection range after the sample passes.

    For daily-granularity position analysis, daily bars are usually sufficient for phase one. Finer-grained data is only needed when the question involves intraday execution, trade timing, or minute-level rules.

    2. Use raw and adjusted prices for different purposes

    Verifying real executions generally requires raw prices at the corresponding times. When studying price changes across periods, adjusted series are fine—but record the adjustment method, calculation convention, and data version.

    Never mix adjusted prices directly with real trade amounts, or position values and returns will be distorted. Dividends, splits, and other corporate actions must be handled explicitly in position reconstruction logic.

    3. Missing data is not the same as no data

    A successful request does not guarantee complete data. Combine the trading calendar, listing periods, and suspension records to distinguish legitimate gaps from abnormal ones.

    Collected data should pass checks for duplicate keys, time ranges, null fields, and price consistency. Keep a recorded reason for legitimate gaps; route abnormal gaps into a re-collection queue instead of silently ignoring them.

    6. Design the Database and Collection Jobs for Recovery and Auditing

    A local database matters not just for storing data, but for establishing stable data boundaries.

    Split it by responsibility:

    • Raw import records;
    • Normalized trade records;
    • Security master data;
    • Market data;
    • Corporate action data;
    • Collection job state;
    • Analysis results and configuration snapshots.

    For market data, use a unique constraint over security identifier, time, granularity, and price convention. If multiple sources or historical versions must coexist, add a version dimension.

    Deduplicating trade records cannot rely solely on time, price, and quantity—two legitimate trades may coincidentally be identical. Prefer the execution ID from the source; when none exists, manage duplicates by batch and original row number.

    1. Replace vague progress with a state machine

    Every collection job should have explicit states, for example:

    Pending → Running → Success / Retry-waiting / Failed

    State records should include at least the requested range, rows written, retry count, last error, and update time. After an interruption, resume from the completed boundary rather than re-collecting everything.

    2. Retries must have boundaries

    Network timeouts and transient service errors warrant limited retries; permission errors and invalid parameters should fail immediately with a correction prompt. Respect rate limits with waiting and backoff—not with ever-increasing concurrency.

    Writes should be idempotent: running the same batch twice must not create duplicate records. Progress should only advance after data is successfully committed, so the UI never shows completion while the database has not caught up.

    7. Diagnose “No Response” in Layers

    When using an AI coding tool, long silence does not necessarily mean the model has failed. The problem may lie in the model response, tool execution, an external API, or the local environment.

    Common cases include:

    • The model is still generating, but the client shows no progress;
    • External requests lack timeouts and hang indefinitely;
    • Subprocess output is buffered and not flushed;
    • Database locks or task dependencies block execution;
    • A tool call failed, but the error never reached the UI.

    So log the start time, end time, and status of model requests, external requests, and local jobs separately, and provide heartbeats for long-running tasks.

    After manually stopping and rerunning, first confirm the original job actually exited—otherwise two collection processes may write simultaneously. Rely on explicit cancellation, timeout, and recovery mechanisms instead of repeated manual retries as a routine practice.

    8. Let Deterministic Code Compute, Let the Model Explain

    Models are good at explaining metrics, summarizing behavior, and proposing follow-up questions—not at independently handling all numeric computation.

    A recommended pipeline:

    Structured records → Deterministic computation → Automated verification → Metrics and evidence → Model-written report

    Calculation conventions to settle in advance:

    • Position cost: moving average or lot-by-lot matching?
    • How to separate realized from unrealized P&L?
    • How to allocate buy and sell fees?
    • How do deposits and withdrawals affect return calculations?
    • How to account for dividends and other corporate actions?
    • How do multiple partial buys and sells combine into one trade?

    For instance, the win rate over individual executions and the win rate over complete holding periods are different metrics—do not mix them.

    The report can cover net P&L, transaction costs, turnover, holding periods, position concentration, and sources of returns. Maximum drawdown, however, requires a continuous equity or NAV series; a handful of closed trades is not enough.

    If cash flows frequently, judging performance by “ending assets minus starting assets” is also inadequate. Choose a return framework suited to the analysis goal and explain how external cash flows are handled.

    Report conclusions work best in an “observation—evidence—limitations” structure. For example:

    “In this sample, trades with short holding periods showed lower average net returns. This result is based on complete trade cycles meeting the definition within the analyzed window. Given the limited sample size and uncontrolled market conditions, we cannot conclude that short holding periods are inherently ineffective.”

    This is more rigorous than emotional commentary and much easier to verify.

    9. Evaluate the Model with Engineering Metrics, Not Impressions

    This project tests how a model performs on specific tasks under specific constraints—not its ability across all development scenarios.

    Key dimensions to observe:

    Dimension Verifiable questions
    Requirements understanding Does it distinguish review from backtesting and identify missing conditions?
    Data handling Does it preserve code formats, fee conventions, and opening positions?
    Implementation quality Does it include timeouts, idempotency, retries, and error handling?
    Debugging ability Does it locate problems from logs instead of blindly changing code?
    Conclusion reliability Does it cite computed evidence and state limitations?
    Human cost How many corrections and reworks were needed?

    When comparing models, keep the tasks, input data, tool permissions, and acceptance criteria identical, and record results across repeated runs. A single success may be luck; a single failure may stem from an API or local environment issue.

    10. Security and Final Acceptance

    Trade records, account information, and API credentials all demand careful handling. Never put API tokens in ordinary documentation, prompts, or logs—inject them through controlled configuration. The model only needs to understand how to call the API, not see real credentials.

    Anonymize account identifiers, names, and unrelated financial details before anything enters model context. Reports should carry only the evidence needed for the analysis, never full raw records.

    Before declaring the project complete, verify at least:

    1. Imported results reconcile with the original trade confirmations;
    2. No unresolved ambiguities remain in security mappings;
    3. Market data coverage, gap causes, and price conventions are clear;
    4. Interrupted recovery produces no duplicate data;
    5. Fees, opening positions, and corporate actions are handled correctly;
    6. Report conclusions trace back to specific metrics and samples;
    7. No credentials or sensitive information leaked into code, logs, or reports.

    The real test of an LLM’s engineering capability is not how fast it scaffolds a project, but whether it can turn real data into a runnable, checkable, recoverable system under explicit constraints. For developers, the model accelerates understanding and implementation, deterministic code performs the calculations, tests verify the results, and humans confirm the boundaries. Only when these links form a closed loop does fluent answering translate into reliable engineering value.