LLM Evaluation, Reimagined: A Backtesting Workflow Based on Trade Execution Records

    This article presents a practical framework for evaluating large language models (LLMs) through a backtesting workflow built on personal trade execution records. Instead of asking a model to "analyze and summarize" semi-structured statements in a single prompt, the approach converts exported spreadsheets into normalized, structured text, stores them in a local database, and breaks the request into verifiable steps: entity extraction, data retrieval, metric calculation, and conclusion generation. It also covers engineering countermeasures for common issues such as long-task stalls and hallucinated API interfaces, criteria for validating backtesting results, and how the same methodology transfers to log attribution, cost anomaly analysis, and report reconciliation.

    1. Starting Point: Why Hand Trading Records to a Model

    Most individual investors who suffer long-term account losses fall into a cycle of “adjusting positions based on gut feeling.” The only reliable way to break this cycle is to review historical trade execution records and turn subjective memory into statistically analyzable behavioral samples. However, a trade execution statement is typically semi-structured data: field meanings are inconsistent, buy/sell direction markers are messy, and fee items are split arbitrarily. Handing such a file to a model with a “take a look and summarize” request usually produces conclusions that cannot be reproduced.

    The core premise of this article is therefore not “let the model trade for me,” but how to decompose a one-off, colloquial request into an engineering pipeline in which the model handles only the verifiable parts.

    2. Data Preparation: Turning Unstructured Files into Model-Readable Input

    2.1 From Spreadsheets to Structured Text

    Trading software usually exports results as spreadsheets. Passing a spreadsheet file directly to a model commonly fails in predictable ways: rows and columns get misaligned, numeric precision is lost, and empty cells are silently skipped, which distorts the final statistical basis. A safer approach is to perform a format conversion first, turning the spreadsheet into well-structured marked text so that every record becomes an independent, addressable unit.

    After conversion, add a layer of field normalization: unify date formats, map the direction field to enumerated values, and convert amounts to a single unit such as cents:

    1. | date | code | side | price | volume | fee |
    2. |------------|----------|------|-------|--------|-----|
    3. | 2025-02-11 | 6XXXXXXX | BUY | 12.34 | 1000 | 5.2 |
    4. | 2025-02-14 | 6XXXXXXX | SELL | 13.10 | 1000 | 5.6 |

    The value of this step is that all subsequent statistics rest on a deterministic field contract: the model is responsible for logic, not for guessing data.

    2.2 Building Extensible Local Storage

    The analysis phase requires repeated queries, so it is better to persist data in a database than to reread files. The table design follows three principles: the raw records table is append-only and never modified; derived metric tables are generated by scripts and can be rebuilt at any time; and a metadata table records data sources and retrieval timestamps for reproducibility.

    3. Task Orchestration: Splitting a One-Sentence Request into Acceptable Steps

    Handing all requirements to the model at once is the main reason long workflows spiral out of control. A more reliable approach is to establish the process first and dispatch work step by step:

    1. Step one, entity extraction only: extract the list of instruments involved in the statement, and confirm it manually before proceeding;
    2. Step two, data retrieval only: pull daily and intraday data for the confirmed list, with visible progress output required;
    3. Step three, metric calculation only: return rate, turnover rate, holding period, and profit/loss distribution;
    4. Step four, conclusion generation only: require every conclusion to include supporting data and sample size.

    Each step’s prompt should contain four elements: objective, input paths, constraints, and acceptance criteria. An example:

    1. Objective: Build a feature to pull daily data for the instruments
    2. Input: The confirmed instrument list from the previous step, and the API documentation file
    3. Constraints: Prefer authorized data interfaces; the database schema must be well-designed and extensible; control request frequency
    4. Acceptance: Print progress in real time in the terminal (completed/total, retry count for failures), with failed items summarized separately

    This decomposition yields two direct benefits: errors are confined to a single step, making rollback extremely cheap; and the output of every step can be reviewed manually, avoiding “conclusions that look reasonable but cannot be traced.”

    4. Real Limitations of Current Models and Engineering Countermeasures

    A commonly observed phenomenon in practice is long-task stalling: the process produces no output and no error, and simply hangs for a long time. This is usually not a model capability issue, but rather a scheduling and timeout behavior that appears when long contexts and multiple rounds of tool calls stack up. Engineering practice can mitigate it from four angles:

    • Execute in segments, keeping each single-step task within an observable duration;
    • Set a timeout and retry limit for every tool call, interrupting and redispatching on timeout;
    • Enforce progress output, turning “silence” into a judgeable state;
    • Persist key artifacts to disk, so a failure at any step never forces a restart from scratch.

    Another frequent problem is the “hallucinated interface”: the model may generate parameters or fields that look plausible but do not exist. The countermeasure is to fix the interface contract in the prompt context as documentation, and require all calls to print their parameters before execution.

    5. Result Validation: Making Conclusions Falsifiable

    The credibility of a backtesting report depends on three points: consistent basis (whether fees are included and whether the adjustment method is unified), sufficient sample (statistics are meaningless when the number of trades is too small), and a clear benchmark (comparison against a benchmark over the same period rather than absolute returns). The output should always include sample size, maximum drawdown, profit/loss ratio, and a list of failure cases. If the model’s judgment conflicts with the data, the data wins: position the model as the party proposing hypotheses, not as the judge.

    6. Transferring the Methodology

    This workflow transfers to scenarios such as log attribution, cost anomaly analysis, and report reconciliation: first structure the dirty data, then split the task into acceptable steps, and finally use deterministic scripts as a validation backstop. If data volume or concurrency grows further, general-purpose cloud capabilities can carry the load—for example, object storage to hold raw export files, a message queue to smooth out traffic spikes, a container platform to run retrieval tasks, and log services with monitoring and alerting to track task status—turning a one-off manual experiment into a sustainable data pipeline.

    The real conclusion is not that the model decides where you are heading, but that once the process is decomposed, the data is normalized, and the conclusions are validated, the analysis becomes objective for the first time.