Evaluating LLMs for Real-World Software Development: A Backtesting System Case Study

    A trading backtesting system provides a practical way to evaluate large language models beyond conversational fluency and plausible code. This article examines task decomposition, data validation, explicit engineering constraints, local storage, and iterative testing, showing how checkpoints and human review help turn model-generated work into reliable, auditable software.

    1. Why Conversational Quality Is Not Enough

    When testing a large language model (LLM) in isolation, we often focus on whether its answers are fluent, logically coherent, and factually accurate. Real software development, however, rarely consists of a single question and answer. It involves multiple steps, dependencies, and business constraints.

    Consider a trading backtesting system. The initial request sounds straightforward: combine personal trading history with historical market data to run a backtest and produce an objective analysis. In practice, the workflow includes several stages:

    Parse trade statements → extract stock symbols → obtain human confirmation → retrieve daily and intraday data → store data locally → implement backtesting logic → generate a report.

    Given all these requirements at once, a model may produce a seemingly complete solution while making mistakes in a data field, date range, or price-adjustment method. Those errors can undermine the final conclusions.

    Evaluating an LLM for real development therefore requires more than judging an impressive response. The question is whether it can deliver consistently under workflow controls, context-management requirements, error correction, and engineering constraints.

    2. Complete Data Parsing Matters More Than Speed

    The project begins with trade statements exported from a trading application. These are often spreadsheets containing multiple header rows, merged cells, inconsistent date formats, or hidden columns. Asking a model to read them directly can lead to omitted records, misaligned fields, and incorrect type inference.

    A more reliable approach is to convert the spreadsheet into a structured intermediate format, such as a Markdown table with explicit column names, before passing it to the model.

    Although this adds a step, it reduces the complexity of interpreting the original file. After conversion, ask the model to produce a field inventory and sample records, then have a person confirm them before proceeding.

    Do not take “I have read the entire file” as evidence of correct parsing. In financial workflows, a single misinterpreted date field can make the subsequent backtest unreliable.

    3. Replace One-Shot Prompts with a Stepwise Workflow

    Developers often describe an entire requirement and wait for the model to return finished code. This approach can become difficult to control in customized projects because the model fills in unspecified details with assumptions.

    For example, should the backtest use daily or intraday data? How should prices be adjusted for corporate actions? What happens when a stock is suspended from trading? Unless these questions are resolved at the appropriate stage, the model may simply guess.

    A better workflow is to proceed incrementally:

    1. Extract all stock symbols from the trading records and output a list.
    2. Have a person confirm the list.
    3. Retrieve historical market data.
    4. Design the database schema and import the data.
    5. Implement the backtesting logic.
    6. Generate a report and check the results.

    Each stage has a clear deliverable, and the user can intervene at any point. If one stage fails, only that stage needs to be repeated.

    A useful standing instruction is: After completing each step, pause and wait for confirmation before continuing. These explicit checkpoints reduce the likelihood of a long-running task drifting beyond the user’s control.

    4. Make Engineering Constraints Explicit in Prompts

    A market-data retrieval prompt should say more than “fetch the data.” It should specify the data source, authentication method, progress reporting, error handling, and storage requirements.

    The following illustrates the structure:

    1. Your task: Retrieve daily and intraday market data for the following list of stocks.
    2. Data source: Use the data-service API already configured on this machine.
    3. The API documentation is located at {path}.
    4. Read authentication credentials from environment variables.
    5. Requirements:
    6. 1. First, propose the database schema and explain each field.
    7. 2. Before the full retrieval, run a small test using three stocks
    8. and data from the past ten days.
    9. 3. Record success or failure for every stock. Do not silently skip
    10. failures; output a complete failure list at the end.
    11. 4. Report progress after each batch, for example, "Completed 30/50."
    12. 5. When writing to the local database, retain the original fields,
    13. the API response timestamp, and the import batch ID.
    14. 6. Never print authentication credentials.

    These constraints may appear separate from model intelligence, but they determine whether the task can be executed reliably.

    Progress visibility is particularly important. When a model-driven task produces no output for a long time, the user cannot easily tell whether it is processing, waiting for a network response, or stuck in a loop. Requiring status updates after each subtask is a basic engineering safeguard.

    5. Handle Data Retrieval and Local Storage Carefully

    API credentials require special attention. Do not paste secrets into prompts or allow generated code to expose them in logs.

    Provide the API documentation as context, but have the code retrieve credentials from local environment variables or a secrets-management service. Explicitly state that credentials may be read for authentication but must never be printed.

    For local storage, avoid placing everything in a single wide table. A more manageable structure separates:

    • Instruments
    • Daily market data
    • Intraday market data
    • Import logs

    Use common metadata, such as stock symbols, relevant dates, data sources, and import timestamps, where appropriate. This supports incremental updates and data traceability.

    Before deploying model-generated schema definitions and import code, review them manually. Pay particular attention to primary keys, indexes, data types, and null-handling logic.

    6. Build a Validation Loop Between Generation and Execution

    Financial data presents many opportunities for mistakes: missing records during trading suspensions, unhandled adjustment factors, price discontinuities after corporate actions, and inconsistent trading-volume units.

    Generated code can be syntactically correct yet wrong in its business logic. It should not be treated as trustworthy simply because it runs.

    A more reliable approach uses a generate–execute–review–revise loop:

    • Review the generated code first. Focus on date boundaries, filtering conditions, and null handling.
    • Run it on a minimal dataset. Validate the output structure before processing the full dataset.
    • Return actual errors and anomalous results to the model. Ask it to revise the code based on observed evidence.
    • Repeat sample validation after every revision. Continue until the checks pass.

    A persuasive explanation is not a substitute for testing. For analysis that may influence financial decisions, slower execution with documented human approvals is preferable to an unchecked result.

    7. Common Problems and Practical Responses

    Long Periods Without Output

    Large data-retrieval tasks may run for extended periods without visible progress. Split them into smaller batches—for example, ten stocks per batch—and persist completion status in a local file so completed batches can be skipped after a restart.

    Timeouts and retries can also prevent a stalled call from blocking the entire workflow.

    Earlier Instructions Lost in Long Contexts

    As context grows, a model may give more attention to recent instructions and overlook previously confirmed information.

    Use a rolling summary: after each stage, ask the model to produce a short summary, then supply that summary as context for the next stage. This preserves key decisions without allowing the context to grow indefinitely.

    Results That Are Difficult to Reproduce

    Record the prompts, invocation parameters, generated code, and outputs for each model call in local logs, while excluding secrets.

    Without these records, it becomes difficult to determine whether a problem originated in the data, the model, or the prompt.

    Data-Source Rate Limits

    External data APIs commonly impose request limits. Require generated code to include request spacing, retries, and exponential backoff to reduce the risk of requests being blocked.

    8. From Personal Scripts to Team Engineering

    The main lesson is that the practical limits of LLM-assisted development are shaped not only by the model but also by the workflow around it.

    When every stage produces an inspectable artifact, the model becomes more useful. When the only interface is a single “do everything” request, it can leave behind a collection of difficult-to-maintain fragments.

    For team use or more formal production environments, separate model calls, file parsing, data retrieval, database storage, and logging into independent services. General-purpose cloud components can support this structure:

    • Object storage for original files and generated results
    • Logging services for execution traces
    • Relational databases for structured data

    Where appropriate, model calls can also be handled through a cloud provider’s model services, such as those offered by Baidu AI Cloud, to reduce local configuration work and help address the stability of concurrent calls.

    This allows a one-off personal script to evolve gradually into a reusable, auditable, and scalable team tool.

    9. Conclusion

    An LLM’s usefulness in software development should not be judged solely by whether it writes polished code. A better measure is whether it helps developers reach decisions faster and reduce repetitive work without introducing uncontrolled errors.

    In a trading backtesting project, LLMs can assist with requirements analysis, code generation, API integration, and debugging. Those benefits depend on task decomposition, data validation, workflow controls, and human review.

    The model is a powerful tool. Engineering judgment and domain knowledge remain responsibilities that developers cannot outsource.