Skip to content
All projects
Open sourceAgents

CFD trading bot

An LLM suggests the trade. Plain code decides whether it is allowed.

  • Python
  • LLM agents
  • Finance

Mission

Risk Manager

Survive 60 seconds of a made-up market. A model proposes trades. You set the rules that approve or veto them.

Pick a level

Best: not set yet

Skip to the write-up

Everything in the game is made-up data. Press Escape any time to pause.

Why I made it

I wanted to see whether a language model could make sensible trading calls from the same inputs a person would use, while ordinary code kept hold of the safety rules. The model gets to be clever. It does not get to be in charge of risk.

How it works

Each cycle the bot pulls recent headlines, computes indicators from price history, reads the account state, and asks the model for a structured decision: buy, sell, close or hold. A separate risk layer then checks that decision against per-trade sizing, a daily loss cap and a maximum holding time before anything reaches the broker.

Everything dangerous is opt-in. It starts in demo mode with dry-run on, live trading needs an explicit flag, and shorting is off by default. CFDs are high risk, and one of the broker libraries I use is unofficial, so I treat the whole thing as an experiment.

How I look after it

I do not watch it all day. An AI assistant reviews the bot journal, proposes numbered fixes, and I approve the ones I agree with. Recent examples were a position-sizing bug on one instrument and a new check that blocks orders larger than the budget allows.