Skip to content
Protocolzone Protocolzone

Data to Data · Financial & Insurance

Multi-agent quant trading with LangGraph

Our trading logic is spread across scripts, a model and a spreadsheet, and when a trade goes wrong nobody can say which step made the decision.

This is a financial & insurance problem we approach through our Data to Data service line.

The problem

A trading desk’s logic rarely lives in one place. Market data is cleaned in one job, signals come from a model, strategy choice is a mix of code and judgement, adjustments are tracked in a spreadsheet, and the risk check is a separate service that runs after the fact.

Each piece works. The trouble starts when a trade goes wrong and you need to know which step decided what, from which data, under which version of the rules.

Adding an AI agent to that mix usually makes it worse: one more opaque step that can propose a trade nobody can explain.

Why it’s hard

A trade is several decisions with different owners and different tolerances for error. Signal generation can be probabilistic. Risk limits cannot. Adjustments to an options position have to stay linked to the position they change, or the book stops making sense. And the whole sequence has to be recorded well enough to satisfy a regulator who asks how an algorithm reached a decision.

A single large agent cannot give you that separation. A set of separate services can, but the coordination between them becomes the system nobody designed.

How we approach it

We build the decision layer as a LangGraph graph. Each role is a node or a small subgraph, and all of them read and write one shared state:

  1. Data processing. Market data, positions and the option chain, cleaned and time stamped into a snapshot that every later step works from.
  2. Decision making. Whether a setup is worth acting on. Usually it is not.
  3. Strategy ordering. Which strategy, and in what order its legs go on.
  4. Adjustment linking. Each roll, added leg or partial close linked to the position and strategy it changes.
  5. Risk limits. Plain code. A proposal that breaks a limit is sent back to strategy ordering, not forced through.
  6. Trade placement. The order placed and the broker’s response recorded against the state that produced it.
  7. Hedging. The hedge rebalanced as the position moves.

Results flow back into the next run, so the desk learns from its own fills. Checkpoints mean every run can be resumed after a failure and replayed for review. Anything new or unusual pauses for a trader through an interrupt.

What we would not do: let a model set or relax its own limits, put a language model in the path of order execution, or skip backtesting because the agents look convincing.

What it takes

  • A clean, point in time market data feed and position source. If you do not have one, that is the first piece of work.
  • The rules your desk already applies, written down: limits, approval thresholds, which strategies are allowed.
  • A small first graph, often data, decision and risk only, running in simulation before it touches an order.
  • Tests per node, a set of past cases for the whole graph, and monitoring of every run.

Where this has been done

This is our own product work, not a client reference. AnkEDGE, our options trading platform, already has strategy definitions, a decision engine and a historical backtesting service, and its agent layer is being built on LangGraph now. The foundations it rests on, backtesting and simulation and real-time market data processing, are delivered engineering. See Agentic AI and LangGraph for the same pattern in other industries.

Position on this page

Evidence

Our product

Industry

Financial & Insurance

Written for

Head of Trading, CTO, Head of Engineering

Outcome

One agent graph where each step of the trade has an owner, risk limits sit in code no model can override, and every decision can be replayed from its checkpoint.

Regulators

  • ESMA
  • ASIC

Questions we get asked

Straight answers.

What is LangGraph?
An open source library, from the team behind LangChain, for building applications as a graph of steps that share one state. Nodes are functions or model calls, edges decide what runs next, cycles let the graph loop back, checkpoints save the state after every step, and interrupts pause a run for a person. It is available for Python and JavaScript.
Does a language model place the trades?
Not in our design. Language models are useful for reading and reasoning. Risk limits are plain code that no prompt can override, and placement and hedging run on code and fast models outside the time-critical path of a language model. A kill switch outside the graph stops new orders.
Does an agent graph replace backtesting?
No. A strategy still passes walk forward replay against point in time data and a live simulation stage before it trades with real money. The graph organises live decisions; backtesting decides which strategies are allowed into it.
Is this investment advice?
No. This page describes software engineering: how decisions are organised, checked and recorded. It makes no claim about returns.

Read next

Related work.

Other use cases

Platforms involved

Is this your problem?

Bring the constraint that makes your version harder than this one. That is the part worth an hour.