AI generates and runs code to explain financial candlestick charts
Code-Interactive Visual Reasoning for Financial Candlestick Understanding
Computer Vision and Pattern RecognitionMachine Learning
Summary
Understanding financial candlestick charts is tricky because it involves spotting patterns in the chart and doing calculations about stock prices over time. The authors created Fin-Thinker, a smart AI that writes and runs computer code step-by-step to find evidence on the charts and solve questions about them. They trained it on a large set of examples where code was verified and corrected to handle mistakes. Their tests show Fin-Thinker can answer questions more accurately than other AI models, and its answers come with clear evidence from the charts.
What this means in practice
- •For financial software developers: Build interactive AI features that explain candlestick charts by generating and running supporting code for better trust in financial analytics tools.
- •For business intelligence teams: Integrate AI-driven visual and numerical reasoning to provide evidence-backed insights on stock trends from candlestick charts in analytic dashboards.
Authors
Chenxi Zhang, Youwei Pang, Xiaoqi Zhao, Ziliang Gan, Rongjunchen Zhang, Shanshan Feng, Hao Wang
Abstract
Financial candlestick understanding requires locating visual elements, aligning them across trading dates and panels, and combining observations through numerical and financial reasoning. Answer accuracy alone does not reveal whether predictions are supported by chart evidence. We introduce Code-Interactive Financial Candlestick Reasoning and present Fin-Thinker, a model based on Qwen3.5-9B that generates and executes code to acquire evidence and perform computations. The model uses the returned observations to guide subsequent reasoning. To train these capabilities, we construct FinKLine-32K with 32,184 replay-verified code-observation trajectories collected through teacher-guided student exploration. These include successful solutions with and without error recovery. Our three-stage training framework combines foundational visual-code fine-tuning, financial process supervision of successful reasoning and corrective continuations, and execution-feedback reinforcement learning. For evaluation, we introduce FinKLineBench with 1,200 questions across 138 financial task types to assess answer correctness, code execution, and evidence grounding separately. On FinKLineBench, Fin-Thinker improves strict accuracy by 13.1 and 33.2 percentage points over the best-performing direct-answer baseline among those evaluated and its base model with sandbox access, respectively. Training-stage ablations further show that financial process supervision and execution-feedback reinforcement learning yield successive improvements in both answer accuracy and GPT-5.6-judged grounded accuracy.