Planning an AI Trading Assistant: Data, Code and EU Rules

An AI trading assistant that watches stocks and prepares trade ideas with entry, exit and risks is a realistic project if the language model writes and explains, code computes every number and you make every decision. The hard parts are rarely the prompt. They are data sources and their licences, latency, deterministic calculations, explanations you can trace, complete logs and a measured error rate. This guide covers the planning in that order. It also marks where the regulatory line runs: while the assistant serves only your own decisions, it is a software project; once its ideas reach other people, EU rules on investment advice (MiFID II) and on investment recommendations (the Market Abuse Regulation, MAR) can apply. The legal part reflects November 2026 and is an overview with primary sources, not legal advice.

Note: This article describes the legal situation in general terms as of the date below. It is not legal or tax advice and does not replace a review of your specific case by a lawyer or tax advisor. All information without guarantee of completeness or timeliness.

What should an AI trading assistant do, and what not?

An AI trading assistant in this sense is a research tool. It watches a list of instruments, checks them against rules you have written down, and prepares a structured trade idea when a rule fires: instrument, direction, entry, stop, target, the risks, and the data the idea is based on. You read the idea, decide, and place any order yourself. The assistant has no order rights.

The design question is who does which job. A language model is good at reading and summarizing text such as news, filings or earnings call transcripts, and at turning computed facts into readable explanations. It is the wrong tool for prices, sizes and risk figures, and it should not decide.

ComponentJobDone by
Data feedPrices, corporate actions, news and filings, with timestampsCode
RulesDetect the setups you definedCode
CalculationsEntry, stop, target, position size, reward-to-riskCode, with tests
ContextSummarize relevant news and filingsLanguage model
ExplanationWrite the idea around computed factsLanguage model, checked by code
Decision and orderAccept or reject, size, send the orderYou
LogRecord inputs, versions, outputs and decisionsCode

Typical example: every 15 minutes during market hours, the assistant checks 40 stocks from a watchlist against three written rules. For each hit it produces a one-page idea with the rule that fired, entry, stop and target computed by code, the two or three headlines the model found relevant, and a short list of reasons why the idea could fail. Ideas older than one hour are marked stale.

Data sources and data rights

Start with a list of every data source, and for each one note what it delivers, how fresh it is, what it costs and what you are allowed to do with it. The last point matters as much as the first three. Market data comes with licence terms from exchanges and vendors, and those terms can differ for viewing data yourself, processing it in software and passing it on.

A concrete example from a broker API: IBKR’s TWS API download page reminds users that using the TWS API to disseminate information, including market data or any other licensed or copyrighted information, to third parties or non-registered IB customers is strictly prohibited without IBKR’s prior written approval. An assistant for your own account that reads quotes through your own API session is one thing. A service that shows those quotes, or ideas containing them, to other people usually needs a data licence that covers it.

  • Prices: real-time or delayed, which exchanges, which licence for display and redistribution.
  • News and filings: source, terms of use, and whether summaries may be shown to others.
  • Fundamentals and corporate actions: who adjusts for splits and dividends, and when.
  • Model provider: which data leaves your system, and under which terms.

If other people will use the assistant, personal data and data protection law join the list. That belongs in the plan from the start, not after the first users sign up.

Latency: how fresh does a trade idea have to be?

An idea is only as current as its oldest input. The chain has several links: the delay of the data feed, the processing in your code, the model call, and the time until you read the idea. Each link needs a number in the plan, measured rather than guessed.

The data feed sets the floor. IBKR’s API documentation, for example, describes its free delayed market data as 15 to 20 minutes delayed. That can be workable for research or for ideas on daily charts. For intraday entries it is unsuitable, because the entry price in the idea may already be history when the idea arrives.

Model calls add their own delay and can fail or time out. Two design rules follow. First, the code-side alert must not wait for the model: if the explanation is late or missing, the idea still arrives with its computed numbers, marked “without explanation”. Second, every idea carries the timestamp of its data and an expiry time, and the interface shows an expired idea as stale instead of hiding the problem.

Maths in code, words from the model

A language model generates text. It can produce numbers that look right and are wrong, and the next call may produce different ones. ESMA points to the same risk in its 2024 statement on AI in retail investment services: AI tools for natural language generation “are known to ‘hallucinate’” and can produce factually incorrect output that sounds accurate.

The robust pattern therefore separates the jobs strictly. Code computes all figures and passes them to the model as fixed values. The model writes the explanation around them. A validator then checks that every number in the text matches a computed value; if not, the idea is rejected and logged. The check below is deliberately strict: any number the code did not compute counts as an error, even a harmless one.

# idea_check.py: every number in a model-written explanation must match a value
# computed in code; anything else rejects the idea. Standard library only.
import re

NUMBER = re.compile(r"(?<![\w.])-?\d+(?:\.\d+)?")


def compute_long_idea(entry, stop, target):
    """All figures of a long idea, computed in code and never by the model."""
    if not stop < entry < target:
        raise ValueError("a long idea needs stop < entry < target")
    risk = entry - stop
    return {"entry": entry, "stop": stop, "target": target,
            "risk_per_share": round(risk, 2),
            "reward_to_risk": round((target - entry) / risk, 2)}


def unknown_numbers(text, idea, tolerance=0.005):
    """Numbers in the text that match none of the computed values."""
    allowed = [float(v) for v in idea.values()]
    found = [float(x) for x in NUMBER.findall(text)]
    return [x for x in found if all(abs(x - a) > tolerance for a in allowed)]


if __name__ == "__main__":
    idea = compute_long_idea(entry=100.0, stop=95.0, target=112.5)
    good = ("Entry 100.0, stop 95.0, target 112.5: the risk is 5.0 per share "
            "and the reward-to-risk ratio is 2.5.")
    bad = "Entry 100.0, stop 95.0, target 115 for a reward-to-risk ratio of 3."
    print(idea)
    print("good text, unknown numbers:", unknown_numbers(good, idea))
    print("bad text, unknown numbers:", unknown_numbers(bad, idea))

Tested with Python 3.9 and 3.12, standard library only. The demo prints an empty list for the correct text and [115.0, 3.0] for the text with an invented target and ratio. In a real assistant the same principle covers tickers, dates and percentages: the template inserts them from code, and the model never retypes them.

Explainability, logging and error rates

An idea you cannot trace back is worthless when it fails. Every idea should show three layers separately: the facts (prices, computed levels, data timestamps), the rule that fired, and the model’s interpretation. That separation is good engineering, and it matches what EU rules require for published investment recommendations: facts clearly distinguished from interpretations, sources indicated, projections labelled as such, and the date and time of production shown.

The log is the assistant’s memory. ESMA expects investment firms to keep records on their use of AI, covering decision-making processes, data sources, algorithms and modifications over time. For a private tool this is not an obligation, but it is a good template. Per idea, store:

  • the data snapshot or references to it, with timestamps
  • rule version, code version and configuration
  • prompt version, model name and model version
  • the raw model output and the validator result
  • your decision, with a one-line reason

With that log, error rates become measurable. Define the error classes first: data errors (stale or missing data), calculation errors (which should be zero, because tests catch them), text errors (numbers that do not match, invented facts, the wrong instrument) and rule errors (ideas that violate your own rules). Then count. The validator counts text errors automatically; a weekly manual review of a fixed sample, for example 20 ideas, finds the rest. Set thresholds in advance that pause the assistant, such as any calculation error or a text error rate above a level you choose.

Keep process quality separate from market outcome. A correct, well-documented idea can lose money, and a sloppy one can win. Judging the assistant by the profit of its ideas mixes both and invites tuning to noise.

Where does the regulatory line run in the EU?

This section is an overview, not legal advice. As long as the assistant only supports your own decisions for your own account, it is a software project. MiFID II, the EU directive on markets in financial instruments, defines investment advice as the provision of personal recommendations to a client in respect of transactions in financial instruments (Article 4(1)(4)). It lists investment advice as an investment service in Annex I, and providing investment services as a regular occupation or business on a professional basis requires prior authorisation (Article 5(1)).

The picture changes when other people receive the ideas. Three situations need to be distinguished:

SituationRules that can applyWhat to clarify
Ideas tailored to individual users, for example based on their portfolio or risk profilePersonal recommendations, and therefore investment advice under MiFID II, which requires authorisation when provided as a businessWhether the service is advice, and who would need a licence
The same ideas sent to many users or publishedInvestment recommendations under MAR: objective presentation, identity of the producer, disclosure of interests and conflictsWhich disclosures each idea needs, and whether you count as an expert
The assistant sends orders for other peopleFurther investment services listed in MiFID II, such as portfolio management or the reception and transmission of orders, which as a rule require authorisationNo longer a side project: get specialised legal advice first

The line between the first two rows comes from Article 9 of Delegated Regulation (EU) 2017/565: a recommendation made to a person as an investor or potential investor, for example to buy, sell or hold a particular financial instrument, is personal if it is presented as suitable for that person or based on a consideration of their circumstances, and it is not a personal recommendation if it is issued exclusively to the public. Ideas for the public do not escape regulation, though. MAR defines investment recommendations as information recommending or suggesting an investment strategy, including opinions on the present or future value or price of instruments, intended for distribution channels or for the public (Article 3(1), points 34 and 35). Article 20 requires those who produce or disseminate them to take reasonable care that they are presented objectively, and to disclose their interests or indicate conflicts of interest.

The details are in Delegated Regulation (EU) 2016/958: the identity of the producer, facts clearly distinguished from interpretations, material sources indicated, projections labelled together with their assumptions, and the date and time of production. People who repeatedly propose investment decisions and present themselves as having financial expertise or experience, or come across that way, count as experts and have additional duties. ESMA’s 2021 statement on social media makes clear that individuals who post such ideas for a wide audience can fall under these rules. For licensed firms, ESMA’s 2024 statement on AI adds that decisions remain the responsibility of the management body, whether people or AI tools make them.

National rules, exemptions and the situation outside the EU differ. Before ideas from your assistant reach anyone else, have the specific setup checked by a lawyer who knows financial regulation.

Limits and risks

  • No edge from AI alone: an assistant applies your rules faster and documents them better. It does not make the rules profitable, and its ideas can lose money, up to a total loss with leveraged products.
  • Over-reliance: ESMA lists over-reliance on AI, at the expense of human judgment, among the risks of AI in investment services. A steady stream of well-written ideas makes it tempting to stop checking them.
  • Model changes: providers update models, and the same prompt can behave differently afterwards. Pin model versions where possible and repeat your evaluation after every change.
  • Untrusted text: news, filings and web pages are data, not instructions. Text that tries to steer the model must not be able to change rules, numbers or permissions, which is one more reason the assistant has no order rights.
  • Legal overview only: this article describes the EU framework in general terms. It does not assess any specific service.

Next steps: a planning checklist

  1. Write down the rules the assistant checks, precisely enough that code can test them.
  2. List every data source with latency, cost and licence, including what you may show to others.
  3. Define the idea format: fields, data timestamp, expiry, and which parts the model may write.
  4. Build the calculations in code with unit tests before connecting any model.
  5. Add the validator and the log, then run the assistant for several weeks without acting on its ideas.
  6. Measure the error classes and set the thresholds that pause it.
  7. Decide about third parties only after legal advice on investment advice and investment recommendations.

The broker side, including AI tools that connect directly to an IBKR account, is covered in IBKR MCP with Claude or ChatGPT. If you want a plan like this reviewed before anything is built, a feasibility check looks at data sources, architecture, risks and effort.

Frequently asked questions

Can ChatGPT or Claude be used as a trading assistant?

As one component, yes. A language model can summarize news, explain setups that code has computed and draft trade ideas in a fixed format. It should not compute prices, sizes or risk figures, and it should not send orders. ESMA notes that AI text generators can produce incorrect output that sounds accurate, so numbers belong in tested code and every decision stays with you.

Is an AI that suggests trades giving investment advice?

That depends on who receives the suggestions and how. Under MiFID II, investment advice means personal recommendations to a client, for example ideas presented as suitable for that person or based on their circumstances, and providing it as a business requires authorisation. Suggestions issued exclusively to the public are not personal recommendations, but they can be investment recommendations under the Market Abuse Regulation. Have your specific setup checked by a lawyer.

Do I need a licence to share AI trade ideas in a group or channel?

Ideas issued exclusively to the public are not personal recommendations, so they are usually not investment advice under MiFID II. They can still be investment recommendations under the EU Market Abuse Regulation: present them objectively, state who produced them and disclose interests or conflicts, with extra duties if you count as an expert. ESMA has stated that this can apply to individuals on social media. Whether a closed group still counts as the public, and whether a licence is needed, depends on the details, so get legal advice first.

How do I stop an AI trading assistant from making up numbers?

Do not let it produce numbers. Compute entries, stops, targets, sizes and reward-to-risk ratios in code, pass them to the model as fixed values and let it write only the explanation. Then check the text automatically: every number must match a computed value, or the idea is rejected and logged. A weekly review of a sample of ideas catches the errors the check cannot see.

What should an AI trading assistant log?

For every idea: the data snapshot with timestamps, the rule and code version, the prompt and model version, the raw model output, the validation result and your decision with a short reason. ESMA expects investment firms to keep records on their use of AI, including data sources, algorithms and changes over time. The same structure helps a private user find out why an idea was wrong.

Sources and status

As of November 2026. Third-party rules, prices and APIs may have changed since; the providers' current documentation and the official texts are authoritative.

This article is also available in German: KI-Trading-Assistent planen: Technik und Grenze zur Beratung.

Planning an AI trading assistant and want the design checked before you build it? Get in touch — a free intro call clarifies data sources, architecture, tests and logging, and which questions belong with a lawyer. More: Trading system code review and audit.