arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2604.15151cs.CL
收藏

QuantCode-Bench: 一个用于评估大型语言模型生成可执行算法交易策略能力的基准

QuantCode-Bench: A Benchmark for Evaluating the Ability of Large Language Models to Generate Executable Algorithmic Trading Strategies

Lime

Alexey Khoroshilov, Alexey Chernysh, Orkhan Ekhtibarov, Nini Kamkia, Dmitry Zmitrovich

AI总结:

本文提出QuantCode-Bench,通过多阶段流程评估现代LLM生成Backtrader框架策略的能力,包含400个不同难度任务,分析模型在交易逻辑、API使用和任务语义方面的局限性。

摘要:

大型语言模型在通用编程任务中表现出色,但生成可执行的算法交易策略能力尚不明确。与标准代码基准不同,生成交易策略需要同时掌握领域特定的金融逻辑、熟悉专用API,并生成不仅语法正确还实际在历史数据上产生交易的代码。本文提出QuantCode-Bench,用于系统评估现代LLM生成Backtrader框架策略的能力。该基准包含从Reddit、TradingView、StackExchange、GitHub和合成来源收集的400个不同难度任务。评估通过多阶段流程进行,检查语法正确性、成功回测执行、交易存在性以及与任务描述的语义一致性。我们比较了最先进的模型在单次回合和代理多回合设置下的表现,分析了不同阶段的失败模式,发现当前模型的主要限制不在于语法,而在于正确操作交易逻辑、正确使用API和遵循任务语义。这些发现表明,生成交易策略是领域特定代码生成任务的一个独特类别,成功需要不仅技术正确性,还需要自然语言描述、金融逻辑和策略在数据上的可观察行为之间的对齐。

英文摘要:

Large language models have demonstrated strong performance on general-purpose programming tasks, yet their ability to generate executable algorithmic trading strategies remains underexplored. Unlike standard code benchmarks, trading-strategy generation requires simultaneous mastery of domain-specific financial logic, knowledge of a specialized API, and the ability to produce code that is not only syntactically correct but also leads to actual trades on historical data. In this work, we present QuantCode-Bench, a benchmark for the systematic evaluation of modern LLMs in generating strategies for the Backtrader framework from textual descriptions in English. The benchmark contains 400 tasks of varying difficulty collected from Reddit, TradingView, StackExchange, GitHub, and synthetic sources. Evaluation is conducted through a multi-stage pipeline that checks syntactic correctness, successful backtest execution, the presence of trades, and semantic alignment with the task description using an LLM judge. We compare state-of-the-art models in two settings: single-turn, where the strategy must be generated correctly on the first attempt, and agentic multi-turn, where the model receives iterative feedback and may repair its errors. We analyze the failure modes across different stages of the pipeline and show that the main limitations of current models are not related to syntax, but rather to the correct operationalization of trading logic, proper API usage, and adherence to task semantics. These findings suggest that trading strategy generation constitutes a distinct class of domain-specific code generation tasks in which success requires not only technical correctness, but also alignment between natural-language descriptions, financial logic, and the observable behavior of the strategy on data.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑