Skip to main navigation Skip to search Skip to main content

Designing Trading Strategies with LLMs: A DSL-Driven Framework Using In-Context Learning

  • University of Liverpool

Research output: Chapter in Book or Report/Conference proceedingConference Proceedingpeer-review

Abstract

Large Language Models (LLMs) offer a promising approach to enhancing traditional financial tools with intuitive interfaces. However, in financial trading, particularly in Exchange-Traded Fund (ETF) strategies, the need for precision, interpretability, and reliability limits their direct application due to challenges like inefficiencies and hallucinations. This study introduces a two-stage framework that uses a domain-specific language (DSL) as an intermediary. Natural language inputs are converted into DSL through in-context learning (ICL) and then translated into general-purpose programming languages. This method improves computational efficiency, reduces manual intervention, and ensures clear interpretability. Experiments show the framework achieves a 95.3% match rate in mapping trading logic to DSL. The study also explores the impact of DSL design and LLM selection, demonstrating the framework's applicability beyond finance. By integrating ICL and DSL, this framework offers a scalable, cost-effective solution for linking natural language processing with financial strategy execution, advancing automated trading systems.

Original languageEnglish
Title of host publicationAdvanced Intelligent Computing Technology and Applications - 21st International Conference, ICIC 2025, Proceedings
EditorsDe-Shuang Huang, Bo Li, Haiming Chen, Chuanlei Zhang
PublisherSpringer Science and Business Media Deutschland GmbH
Pages278-291
Number of pages14
ISBN (Electronic)9789819698912
ISBN (Print)9789819698905
DOIs
Publication statusPublished - 26 Jul 2025
Event21st International Conference on Intelligent Computing, ICIC 2025 - Ningbo, China
Duration: 26 Jul 202529 Jul 2025

Publication series

NameLecture Notes in Computer Science
Volume15852 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349

Conference

Conference21st International Conference on Intelligent Computing, ICIC 2025
Country/TerritoryChina
CityNingbo
Period26/07/2529/07/25

Cite this