Large Language Models (LLMs) excel at general code generation, yet translating natural-language trading intents into correct option strategies remains challenging. Real-world option design requires reasoning over massive, multi-dimensional option chain data with strict constraints, which often overwhelms direct generation methods. We introduce the Option Query Language (OQL), a domain-specific intermediate representation that abstracts option markets into high-level primitives under grammatical rules, enabling LLMs to function as reliable semantic parsers rather than free-form programmers. OQL queries are then validated and executed deterministically by an engine to instantiate executable strategies. We also present a new dataset for this task and demonstrate that our neuro-symbolic pipeline significantly improves execution accuracy and logical consistency over direct baselines.
翻译:大语言模型(LLMs)在通用代码生成方面表现优异,但将自然语言交易意图准确转化为正确的期权策略仍具挑战性。实际期权设计需要对海量、多维度的期权链数据进行严格约束下的推理,这往往使直接生成方法难以应对。我们提出期权查询语言(OQL),这是一种领域特定的中间表示方法,它将期权市场抽象为语法规则下的高层原语,使大语言模型能够充当可靠的语义解析器而非自由形式的编程器。OQL查询随后由执行引擎进行确定性验证与执行,从而实例化为可执行策略。我们还为此任务构建了一个新数据集,并证明我们的神经符号混合流程相较于直接基线方法,在执行准确性与逻辑一致性方面均有显著提升。