# What AI assistants get wrong about broker APIs

Independent and unofficial. Not affiliated with or endorsed by any broker or platform named here. Educational only: nothing here is advice, and nothing here recommends a broker or a trade.

This is the markdown version of https://openbrokerapi.com/guides/ai-coding-traps, written from the same records as that page.

Risk warning: CFDs and spread bets are complex instruments and come with a high risk of losing money rapidly due to leverage. You can lose money on these products, and each provider publishes its own loss figure under FCA rules. You should consider whether you understand how they work and whether you can afford to take the high risk of losing your money. Automated and API trading can amplify losses through bugs, connectivity failures and runaway orders.

You asked an assistant to build it and it does not work. These are the nine reasons why, each one a fact about the API rather than a fault in your prompt.

- Last reviewed: 2026-09-19

Unverified in part: carried over from an earlier version of this site. The links below are the sources it was written from, but its statements have not been re-read at source since the date shown, so check anything you rely on.

## What goes wrong when an assistant writes the code

These are not bugs in your prompt. They are facts about the API that an assistant cannot know from the code alone, each one sourced to the page that states it. Read them before you let anything near an account.

- Which account am I connected to, practice or real? Print the full web address before every call.
- Read the broker's own list of error codes and handle those, not the ones you assume.
- Read my key from an environment variable, which is a setting on my computer rather than a line in the code, and never print it.
- Stop and show me the order before you send it.

- Never paste an API key, password or account number into a chat window.
- Never let generated code place an order on a real account until you have read that code line by line.
- Never let an assistant decide how big the position is.
- Never trust a number an assistant states without the broker page that says it.

1. The code is fine and autotrading is switched off at the terminal[MetaTrader 5 (Python package and MQL5)](https://openbrokerapi.com/platforms/metatrader-5)In plain words: nothing is wrong with the code. MetaTrader has a switch that stops programs trading, and it is off.The most common MetaTrader 5 automation failure is retcode 10027, TRADE_RETCODE_CLIENT_DISABLES_AT: the terminal itself has algorithmic trading disabled. No amount of editing the script fixes it, and an assistant asked to debug the code will keep editing the code.What to doEnable algorithmic trading in the terminal, then re-run. Check the retcode before you change a line.[MQL5 forum: trade retcode 10027](https://www.mql5.com/en/forum/376255) checked 19 Sep 2026
2. MT5 Python code that can never run on your machine[MetaTrader 5 (Python package and MQL5)](https://openbrokerapi.com/platforms/metatrader-5)In plain words: MetaTrader's Python add-on only exists for Windows. On a Mac it cannot be installed at all.The MetaTrader5 Python package ships Windows x86-64 wheels only. Ask for MT5 Python code on a Mac or a Linux box and you will get code that imports a package that cannot be installed.What to doRun MT5 and the Python script on Windows, or in a Windows container. Decide this before you write anything.[PyPI: MetaTrader5](https://pypi.org/project/MetaTrader5/) checked 19 Sep 2026
3. One header short of working, and the error blames your logic[eToro](https://openbrokerapi.com/brokers/etoro)In plain words: eToro needs three tags sent with every request, two that identify you and one that is new each time. Miss one and it says you are not logged in, so you go looking in the wrong place.eToro requires three headers on every request, not two: x-api-key, x-user-key and a fresh x-request-id. Assistants routinely emit the first two and stop. Its own FAQ lists the common mistakes as the wrong headers, the wrong base URL and skipping validation against the API reference, and says a 401 comes from missing credentials or insufficient scopes rather than bad logic.What to doCheck all three headers and the base URL first, and generate a new x-request-id per call rather than reusing one. Treat a 401 as a credentials or scopes problem, not a code problem.[eToro Builder FAQ](https://builders.etoro.com/faq) checked 19 Sep 2026
4. Demo and live differ by one word in the path[eToro](https://openbrokerapi.com/brokers/etoro)In plain words: the practice account and the real account use almost the same web address. One missing word and you are on the real one.At eToro the demo execution path carries a /demo/ segment that the live path does not. It is exactly the kind of single token an assistant drops when it rewrites a URL, and the request still succeeds.What to doPrint the full URL your code is about to call, every time, and assert on the /demo/ segment until you mean to go live.[eToro Builder FAQ](https://builders.etoro.com/faq) checked 19 Sep 2026
5. Official sample code that has been broken for years[Capital.com](https://openbrokerapi.com/brokers/capital-com)In plain words: the broker's own example file has been broken since 2023 and nobody fixed it.Capital.com's own Postman collection repository has seven commits and an open issue titled "Importing postman collection gives error", open since 18 Jan 2023. An assistant pointed at the official sample reproduces the broken setup faithfully.What to doCheck the issues tab and the last commit date before you trust any official sample, including ours.[GitHub: capital-com-sv/capital-api-postman issues](https://github.com/capital-com-sv/capital-api-postman/issues) checked 19 Sep 2026
6. The assistant is reading a changelog that stopped five months ago[Interactive Brokers](https://openbrokerapi.com/brokers/ibkr)In plain words: there are three IBKR pages listing what changed, and the one an assistant usually finds stopped updating in April.Ask an assistant what changed recently in the IBKR Web API and it will most likely read the Campus mirror, which stops at 14 Apr 2026, rather than the Documentation changelog, which is current to 9 Sep 2026.What to doGive it the URL yourself: interactivebrokers.com/docs/web-api/changelog.[IBKR Documentation: Changelog](https://www.interactivebrokers.com/docs/web-api/changelog) checked 19 Sep 2026
7. Rate limits that are real but not in the docs[TradeLocker API](https://openbrokerapi.com/platforms/tradelocker)In plain words: there is a limit on how often you can ask, but it is not written down anywhere you can read before you start.TradeLocker publishes no rate limits in its documentation. They are only readable from the authenticated /trade/config endpoint, so an assistant writing a polling loop has nothing to size it against and will guess.What to doCall /trade/config first and read the limits out before you write the loop.[TradeLocker Public API](https://public-api.tradelocker.com/) checked 19 Sep 2026
8. The API it is writing against no longer exists[FXCM](https://openbrokerapi.com/brokers/fxcm)In plain words: FXCM switched off the connection older guides tell you to use, and never said so.FXCM's own page now lists only a FIX API, a Java API and ForexConnect. There is no REST API and no deprecation notice, but older guides still describe one, so an assistant trained or searching on those will confidently write FXCM REST calls.What to doOpen the broker's current API page yourself and check the API is listed before you start.[FXCM: API trading](https://www.fxcm.com/uk/algorithmic-trading/api-trading/) checked 19 Sep 2026
9. The connector says connected and no tools arrive[Interactive Brokers](https://openbrokerapi.com/brokers/ibkr)In plain words: the connector can look like it is working and still hand the assistant nothing to work with. Check what tools it can see, not what colour the badge is.An open community issue thread reports the Interactive Brokers MCP connector showing as connected on claude.ai web and Claude Desktop while surfacing zero tools, and separately a schema bug in which tools taking integer, boolean or array parameters were rejected with the message string found, type expected. A partial patch around 14 Jul 2026 fixed roughly seven tools, while the tool-surfacing failure was still being reported. Claude Code was reported as unaffected by the same reporters. These are community reports on an open issue, not confirmed by the vendor.What to doDo not treat a connector badge as a health check. List the tools the client can actually see before you write anything against them, and test the same grant on every surface you plan to use, because the same authorisation can behave differently on web, on desktop and in a terminal client. If a tool rejects typed parameters, check the tool schema before you rewrite your prompt.[Community issue thread: IBKR MCP connector](https://github.com/anthropics/claude-ai-mcp/issues/571) checked 19 Sep 2026

## Related pages

- [Getting started with API trading](https://openbrokerapi.com/guides/getting-started-with-api-trading): What an API is, what you need and how to make a first call safely.
- [All guides](https://openbrokerapi.com/guides): Step by step guides, each step with the page it was read on.
- [Brokers](https://openbrokerapi.com/brokers): The record for each broker: access, limits, endpoints and error codes.
- [Platform APIs](https://openbrokerapi.com/platforms): APIs that belong to trading software offered by many brokers.
- [Error codes](https://openbrokerapi.com/errors): What each error means, and the fix where the source gives one.
- [Compare two APIs](https://openbrokerapi.com/compare): The same fields from two records, side by side.
- [Learn to code](https://openbrokerapi.com/learn): A learning track from a first script to a demo account call.

## Licence and how to cite

The records behind this page are all rights reserved. This file is the page itself, at its own address, in another format. It is not part of the CC BY 4.0 downloads listed at https://openbrokerapi.com/data. Quote from it with a link to the page.

Cite as: What AI assistants get wrong about broker APIs. Broker API Hub, https://openbrokerapi.com/guides/ai-coding-traps, newest check 2026-09-19.

Where you rely on a single figure, cite the source and the checked date printed beside it as well. Where this page and a broker's own documentation differ, the documentation wins.
