The List / Trading, Investment, and Portfolio Management / paper
From Natural Language to Executable Option Strategies via Large Language Models
Abstract
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.
In one sentence
Summary
The paper addresses the challenge of translating natural language trading intents into correct, executable option strategies, a task hindered by the high dimensionality of option chain data and the propensity of LLMs to hallucinate invalid constraints. It positions this work as a bridge between general LLM capabilities and the rigorous logic required for derivatives trading, proposing a neuro-symbolic approach that decouples semantic parsing from deterministic execution. The core innovation is the Option Query Language (OQL), a domain-specific intermediate representation that abstracts option markets into high-level primitives, allowing LLMs to function as reliable semantic parsers rather than free-form programmers. The methodology involves a two-stage pipeline: first, an LLM converts natural language intent into structured OQL queries, which are then validated and executed by a deterministic engine against real-time option chain data. The system uses role-based abstraction, scoped filtering, and soft-matching operators to handle linguistic ambiguity and financial constraints. The authors introduce a new benchmark dataset of 200 diverse option trading instructions across five underlying assets (SPY, NVDA, AAPL, GOOG, TSLA) in 2025, evaluating models on query validity, strategy match, and semantic accuracy. Experiments compare OQL against free-form leg generation, partial-chain grounding, and text-to-SQL baselines using various commercial and open-weight LLMs. Results demonstrate that OQL significantly improves execution accuracy and logical consistency, with specialized coding models like DeepSeek-Coder-6.7B outperforming larger general models in profitability and win rate. The neuro-symbolic pipeline reduces dangerous hallucinations and risk exposure, achieving a 60.9% win rate for DeepSeek-Chat compared to 52.8% for SQL. The study highlights that semantic accuracy is more predictive of downstream strategy performance than generation success alone. Limitations include the current reliance on predefined strategy templates and the need for future work to support free-form leg design and existing portfolio conditioning.
Research problem
The paper tackles the difficulty of converting natural language trading intents into executable, logically consistent option strategies. Direct LLM generation fails due to the high dimensionality of option chain data and the risk of hallucinating invalid constraints or tickers. The problem is to enable LLMs to reliably interpret complex financial concepts and constraints without overwhelming context limits or producing unexecutable code.
Core contributions
- Introduction of Option Query Language (OQL), a domain-specific intermediate representation that encodes derivatives logic into a token-efficient, execution-rigorous format.
- Development of a neuro-symbolic pipeline that decouples LLM-based semantic parsing from deterministic strategy execution, ensuring logical validity.
- Creation of the first benchmark dataset for natural language to option strategy translation, featuring 200 diverse instructions across five underlying assets.
- Demonstration that structured querying via OQL significantly improves execution accuracy, risk management, and profitability compared to direct code generation baselines.
- Extension of the Text-to-SQL paradigm to financial derivatives, showing that specialized coding models can outperform larger general models in this domain.
Method
- Role-based abstraction: Maps strategy roles to option contracts to enforce structural validity.
- Scoped filtering: Applies leg-level constraints in WHERE clauses and strategy-level constraints in HAVING clauses.
- Semantic soft-matching: Uses approximate matching operators to handle linguistic ambiguity in numerical conditions.
- Deterministic execution: Parses OQL into an AST, validates constraints, and executes vectorized filtering over option chain data.
- Combinatorial leg assembly: Constructs candidate strategies via Cartesian products and filters by aggregate constraints.
- LLM as semantic parser: Converts natural language intent into OQL queries, confining probabilistic reasoning to intent parsing.
Results & findings
- OQL achieves a Validity Rate exceeding 0.870 for all large models, confirming framework robustness.
- DeepSeek-Coder-6.7B outperforms GPT-4.1-Mini in profitability and win rate, highlighting the importance of domain-specific syntax reasoning.
- OQL reduces buyer-side Risk@90 to 18.6% for DeepSeek-Chat, compared to 46.1% with SQL, while achieving the highest Win Rate (60.9%).
- Semantic accuracy is more predictive of downstream strategy performance than generation success alone.
- OQL maintains a high cache hit rate of 88.5%, making it the most cost-effective framework for high-fidelity strategy retrieval.
- Specialized coding models often 'overfit' to syntax without encoding meaningful trading logic, leading to losses despite high validity.
- OQL enables models to adapt behavior to different market conditions, exposing model-specific strengths without amplifying failure modes.
Data & experiments
- Dataset of 200 natural language trading instructions curated by human experts, covering directional, volatility, and income/hedging strategies.
- Market data for five underlying assets (SPY, NVDA, AAPL, GOOG, TSLA) from 2025, partitioned into labeled regions based on movement styles.
- Evaluation metrics including Validity Rate, Strategy Match, Semantic Accuracy, Win Rate, Risk@90, Profit, and Return on Cost.
- Baselines: Free-Form Leg Generation (FFLG), Partial-Chain Grounded (PCG), and Text-to-SQL.
- Models tested: Gemini-2.5-Flash, DeepSeek-V3, GPT-4.1, GPT-4.1-Mini, LLaMA-3.1-8B, Qwen-3, and DeepSeek-Coder variants.
- Backtesting of generated strategies to assess profitability and risk exposure under various market conditions.
Limitations & caveats
- Current OQL relies on predefined strategy templates, limiting free-form leg design.
- The dataset is restricted to 2025 data, which may limit generalizability to other market regimes.
- The method does not yet support strategy queries conditioned on existing portfolio holdings.
- Smaller models may overfit to OQL syntax without encoding meaningful trading logic.
- The framework does not yet incorporate realistic trading frictions and risk controls.
- Evaluation is based on backtesting, which may not fully capture real-world execution risks.
Curator notes
Discovery status: institutional_trading_focus_promoted. Source links: large language models execution trading