ChatGPT trading bot with the IG API, the safe way
ChatGPT can write IG API code for you, but it should never see your key or password, and nothing should trade until you arm it. Build read-first on a demo account, with a human confirming every order.
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.
Steps
Use a demo account and a demo key
IG demo API access needs a demo account opened with the same email as your live account, and demo has its own key. See our IG demo API key guide.
labs.ig.comchecked
Keys in environment variables, never in the chat
Ask ChatGPT for code that reads the key, username and password from environment variables, then set them on your own machine. Do not paste them into the conversation.
raw.githubusercontent.comchecked
Read first
Start with calls that only read: accounts, positions, prices. The IG demo host is https://demo-api.ig.com/gateway/deal.
raw.githubusercontent.comchecked
Trading off until armed
Keep order code behind a switch that is off by default, and ask for typed confirmation before each order. The MCP specification says there should always be a human in the loop who can deny tool calls; the same rule suits a plain script.
modelcontextprotocol.iochecked
Respect IG's allowances
Ask ChatGPT to add a limiter: IG allows 60 non-trading requests per minute per app and 100 trading and 30 non-trading per account, and will not raise them.
labs.ig.comchecked
Spread bet or CFD
Tell ChatGPT which account you use. Spread bets need expiry DFB and CFDs expiry "-", according to trading-ig.
trading-ig.readthedocs.iochecked
Official IG assistant: Australia only
IG Australia's assistant works in ChatGPT, is read only and cannot place, amend or close trades, and uses OAuth so your IG password is never shared with the AI. It needs an IG Australia CFD account; we found no UK version.
ig.comchecked
Community IG MCP server trades by default
The community ig-trading-mcp server reads IG_API_KEY, IG_IDENTIFIER, IG_PASSWORD and IG_DEMO and exposes trading tools as soon as it starts. It is listed in our AI and MCP guide, not tested or endorsed.
github.comchecked
Sources
- IG Labs FAQchecked
- trading-ig rest.py (community source)checked
- trading-ig FAQ (community source)checked
- MCP specification 2025-06-18: Toolschecked
- IG AU: AI assistantchecked
- GitHub: kea0811/ig-trading-mcp (community)checked