Evaluating Large Language Models for Real Development: A Local Trading Backtesting Project

    This article argues that judging a large language model by a single answer is unreliable; its real value should be measured by complete task delivery. Using a local trading backtesting and analysis system as a representative project, it covers requirement understanding, task decomposition, data standardization, staged prompting, database design, robust data fetching, backtesting assumptions, meaningful analysis reports, and the areas that still need human review. Readers will get a practical framework for assessing whether a model can help build a data pipeline that is traceable, explainable, verifiable, recoverable, and extensible.

    As each new generation of large models is released, people tend to focus first on parameter counts, leaderboard rankings, and advertised general capabilities. For developers, however, the questions that matter are usually more concrete: Can the model accurately understand the requirement? Can it reliably call external interfaces? Can it keep modifying code without breaking existing functionality? Can it deliver a runnable, verifiable, and maintainable system when data is incomplete and the task is complex?

    Instead of debating whether a model is “strong,” it is better to test it with a real project. This article picks a representative scenario: combining personal trading records with historical market data to build a local trading backtesting and analysis system. The project touches file parsing, data cleaning, API calls, database modeling, metric calculation, strategy backtesting, result presentation, and exception handling, so it exposes both the strengths and the weaknesses of a large model in engineering practice fairly comprehensively.

    1. Evaluating a Model Takes More Than One Answer

    A large model’s capability is usually made up of several layers.

    The first is requirement understanding. Can the model identify the problem the user actually wants to solve, rather than just generating code from a surface description? For example, “analyze my trading records” is not the same as simply tallying profit and loss; it may also involve holding period, win rate, average return, maximum drawdown, trading frequency, sector distribution, buy/sell timing, and strategy consistency.

    The second is task decomposition. A complex project is not suited to a single one-shot instruction. The model needs to split the work into stages such as data reading, ticker identification, market data fetching, data storage, backtest calculation, and report generation, and to define the input, output, and acceptance criteria for each stage.

    The third is tool coordination. Whether the model can correctly use local files, data interfaces, databases, and the runtime environment often matters more than whether it can write elegant code. In real development, code is only part of the system; data formats, permissions, dependencies, network conditions, and run logs all determine whether the project succeeds.

    The fourth is stability and recoverability. Generating correct code once in a while is not hard; what is hard is locating the problem after a failure, preserving existing work, and continuing. A model that frequently stalls, repeats edits, overwrites files, or cannot explain error causes is hard to use for serious development.

    For this reason, model evaluation should extend from “answer quality” to “complete task delivery capability.”

    2. Define Project Boundaries Before Involving the Model

    The first step in this practice was not to ask the model to generate a full system, but to define the project goals and constraints.

    The goals can be stated as:

    1. Read personal trading records;
    2. Extract the securities involved;
    3. Fetch the corresponding historical market data;
    4. Save the raw data to a local database;
    5. Perform return and risk analysis based on real buy/sell records;
    6. Output a structured analysis report;
    7. Keep enough logs to verify each step.

    To reduce complexity, several boundaries should be set in advance. For example, the first phase handles only daily data and does not add minute-level data yet; the first phase implements only basic return statistics and does not build a complex machine learning predictor; the first phase completes the data pipeline before considering visualization and strategy optimization.

    The clearer the boundaries, the more controllable the model’s output. Conversely, if you demand all at once that it “auto-detect the file, fetch all data, complete the backtest, generate a web page, and add a prediction model,” the model will likely produce a large amount of tightly coupled code that is hard to debug and impossible to trace back to the source of an error.

    3. Standardize the Raw Trading File First

    Files exported by many trading applications look like tables but actually contain many format differences, for example:

    • The date field may contain both date and time;
    • Buys and sells may use different text markers;
    • Quantity, price, and amount fields may contain nulls or special characters;
    • The same security may appear as a short name, a code, and an internal ID;
    • The calculation basis for fees, taxes, and turnover may differ;
    • The file may contain title rows, total rows, or explanatory text.

    If you hand the raw file directly to the model, it may read only part of the rows or mistake a total row for a trade record. It is therefore advisable to complete structured preprocessing first.

    A reasonable data cleaning flow is:

    1. Raw file
    2. ↓
    3. Identify header and valid data region
    4. ↓
    5. Unify field names
    6. ↓
    7. Convert date, price, quantity, amount types
    8. ↓
    9. Remove total rows and empty records
    10. ↓
    11. Validate buy/sell direction and value ranges
    12. ↓
    13. Output standardized trade table

    The standardized trade table should contain at least:

    • Trade date;
    • Security identifier;
    • Security name;
    • Trade direction;
    • Trade price;
    • Trade quantity;
    • Trade amount;
    • Commission;
    • Other fees;
    • Data source or raw file identifier.

    The key principle here is: never overwrite the raw data, and save the cleaning result separately. That way, even if the model mishandles the data later, you can restart from the raw file.

    4. Staged Prompting Is More Reliable Than One Big Request

    In practice, the most common mistake is telling the model everything at once and then expecting a complete system in return. This looks efficient but easily leads to requirements getting out of control.

    A more reasonable approach is staged collaboration.

    Phase 1: Have the Model Understand the Data

    Ask the model to only analyze the file and not write business code. It should answer:

    • What fields does the file contain;
    • Which rows are valid trade records;
    • Whether duplicate records exist;
    • Which fields may affect later calculations;
    • What gaps and ambiguities the current data has.

    The developer then manually confirms the identification result.

    Phase 2: Generate the Data Cleaning Module

    After the fields are confirmed, have the model write the cleaning program and require it to output:

    • Input file format;
    • Output file format;
    • Each cleaning rule;
    • How abnormal data is handled;
    • Record counts before and after cleaning.

    Phase 3: Build the Data Fetching Module

    Only now ask the model to read the list of securities, call the data interface to fetch historical market data, and write the results to the local database. Emphasize rate limiting, retries, resumable transfer, and progress display.

    Phase 4: Implement Analysis and Backtesting

    Only after the data is stored and passes sampling checks should you enter the return calculation and strategy analysis phase. This avoids the situation where “the data is wrong but the code appears to run.”

    5. Local Database Design Determines Whether the System Can Scale

    For a one-off analysis, several spreadsheet files may be enough; but as soon as multiple updates, multiple tickers, and different data periods are involved, you should use a structured database.

    Consider these core tables:

    1. Trade Records Table

    Stores the user’s actual buy/sell actions, including trade date, ticker, direction, quantity, price, fees, and the original record ID.

    2. Daily Market Data Table

    Stores each traded security’s open, high, low, close, volume, and other fields for different dates.

    3. Minute Market Data Table

    If you need finer analysis of execution timing, store minute-level data separately; it must not be mixed into the same table as daily data.

    4. Data Task Table

    Records each data-fetch task’s start time, end time, target tickers, success count, failure count, and error reasons.

    5. Backtest Results Table

    Stores analysis results under different strategies, time ranges, and parameters for later comparison.

    When designing tables, add unique constraints. For example, a given ticker on a given trading day should usually have only one daily record. Using an “insert or update” strategy when writing data prevents duplicate data from repeated program runs.

    6. The Data Fetching Module Must Do More Than “Run”

    When having the model call an external data interface, the most common mistake is focusing only on whether the request succeeds while ignoring data quality and task recoverability.

    A qualified data fetching module should have at least these capabilities:

    1. Task splitting: fetch in batches by ticker or time range;
    2. Progress display: show the current item, completed count, and remaining tasks;
    3. Failure retries: retry a limited number of times for temporary network errors;
    4. Resumable transfer: continue from the last successful position after an interruption;
    5. Result validation: check whether returned data is empty, dates are continuous, and fields are complete;
    6. Request throttling: avoid sending too many requests in a short time;
    7. Logging: save request parameters, failure reasons, and results.

    For example, a successful request for a ticker does not mean the data is correct. You still need to check whether the date range matches expectations, whether the close price is empty, whether prices show obvious anomalies, and whether different adjustment bases make results impossible to compare directly.

    The model can generate the basic code for these features, but the developer must review its exception-handling logic and must not assume the data is trustworthy just because the program did not error out.

    7. Backtesting Must Separate Facts From Assumptions

    The most overlooked issue in trading analysis is the “backtesting basis.” Different assumptions directly change the results.

    At minimum, clarify these questions:

    • Value positions at trade price or close price;
    • Whether to include commissions and taxes;
    • Whether to consider slippage;
    • How to handle dividends and splits;
    • How to value positions during trading halts;
    • Whether same-day buying allows same-day selling;
    • How to handle insufficient funds;
    • How to calculate holding cost after multiple buys;
    • Whether unsold positions count toward final assets.

    For example, if you calculate returns using only buy and sell prices while ignoring trading fees, a high-frequency strategy’s results are usually overstated. If you use backward-adjusted data to analyze real trades, you may create a mismatch between historical prices and actual execution prices.

    Therefore, a backtest report should present both the “calculation basis” and the “result values,” not just a single return figure.

    8. An Analysis Report Should Do More Than State Profit or Loss

    A valuable report should help users understand their own trading behavior, not simply tell them whether they made or lost money.

    Include at least these metrics:

    Return Metrics

    • Total capital invested;
    • Total capital recovered;
    • Realized return;
    • Unrealized return;
    • Overall return rate;
    • Return changes by month or quarter.

    Risk Metrics

    • Maximum drawdown;
    • Largest single-trade loss;
    • Number of consecutive losses;
    • Return volatility;
    • Position concentration;
    • Contribution of a single ticker to total return.

    Behavior Metrics

    • Number of trades;
    • Average holding period;
    • Win rate of profitable trades;
    • Average return of profitable trades;
    • Average loss of losing trades;
    • Profit/loss ratio;
    • Share of positions sold shortly after buying.

    Combined, these metrics answer more valuable questions: does the return come mainly from a few trades or is it stable overall? Are losses concentrated in a certain behavior? Did frequent trading actually improve results? Were the trading rules applied consistently?

    9. Where a Large Model Most Needs Human Review

    In practice, a large model can usually generate basic code quickly, but the following areas must be confirmed by a human:

    1. Field mapping: the model may misread the trade direction or amount fields;
    2. Date handling: it may confuse calendar days, trading days, and timestamps;
    3. Fee calculation: rules differ across markets and accounts and must not be guessed;
    4. Data basis: raw quotes, adjusted quotes, and valuation prices must not be mixed;
    5. Boundary conditions: empty positions, partial fills, duplicate fills, and cross-day holdings are error-prone;
    6. Security: access credentials must not be written directly into code or committed to a public repository;
    7. Result interpretation: statistical correlation must not be read as causation.

    In particular, be wary of “plausible-looking” results produced by the model. The most effective approach is to prepare a few small samples that can be calculated by hand and use them to validate each core function. For example, design just two buy/sell records, compute the return manually, and compare it item by item with the program’s output.

    10. How to Judge Whether a Model Practice Succeeded

    Do not judge only by whether the model wrote code; assess it across these dimensions:

    • Whether requirement decomposition is clear;
    • Whether the code runs independently;
    • Whether logging and exception handling exist;
    • Whether the data is complete and traceable;
    • Whether changes break existing functionality;
    • Whether results pass validation against manual samples;
    • Whether the project is easy to extend later;
    • Whether the model can accurately explain its own implementation.

    If the model occasionally becomes unresponsive, stalls, or produces incomplete output, do not simply conclude that it is “completely unusable.” This may relate to overly long tasks, too much context, blocked external interfaces, runtime limits, or concurrent requests. A better approach is to shorten tasks, split steps, preserve intermediate results, and ask the model to explain its plan before modifying files.

    Conclusion

    The most reliable way to evaluate a new model is not to repeat marketing material but to place it in a real, complex, and verifiable engineering task. Personal trading data analysis is just one example; the same method applies to report automation, log analysis, data cleaning, business backtesting, and internal tool development.

    What ultimately matters is not whether the model can generate a piece of code, but whether it can help developers build a reliable data pipeline: input that is traceable, processing that is explainable, results that are verifiable, failures that are recoverable, and a system that is extensible.

    If you treat a large model as a “programmer that automatically does all the work,” you will easily lose control of the results; if you treat it as a collaboration tool that takes part in requirement analysis, coding, debugging, and documentation, and pair it with clear phase divisions and human acceptance checks, you are far more likely to gain stable, reusable engineering value.