Trading 212 API Agent Skills
Skill for the Trading 212 broker API: account summary, positions, orders and history export, with a demo environment on virtual money
- 142 ★ on the repository
- Last commit
- MIT
Broad access
Why this level
- The key and secret open trading on the account, and the agent can send an order with real money
- A model can misread a phrase and place the wrong order, and the author warns about this directly
- The key pair lives in environment variables and has to be revoked in the app if it leaks
Install
- Works in
In your terminal, with SkillFoxx CLI
npx skillfoxx add skills/trading-212-api-agent-skillsDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewBroad accessThe tool can change data, run commands or handle secrets.
- The key and secret open trading on the account, and the agent can send an order with real money
- A model can misread a phrase and place the wrong order, and the author warns about this directly
- The key pair lives in environment variables and has to be revoked in the app if it leaks
This is third-party code. Review the repository files before installing.
What it does
The trading212-api skill teaches an agent to work with the public Trading 212 broker API. It covers Basic authentication with a key and secret, the account summary with cash and investment figures, open positions with profit and loss, instrument search and exchange trading hours. The agent sends four kinds of orders: market, limit, stop and stop-limit. The sign of the quantity sets the direction: a positive number buys, a negative one sells. A pending order can be found by its ID and cancelled. From history the agent pulls filled orders, dividends and transactions and requests a CSV report. Before the first request the skill asks where to work: on a demo account with virtual money or on the live one. Trading 212 uses its own tickers, so the agent first looks the right one up in the instrument list and keeps that list cached for up to an hour, because the endpoint allows one request per 50 seconds.
Who it is for. Private investors with an Invest or Stocks ISA account at Trading 212 who want to review a portfolio and place orders by asking an agent in a terminal or editor.
Good fit when
- You need a portfolio summary: cash, open positions and their profit or loss
- A Trading 212 ticker differs from the exchange one and has to be found by company name
- You want to rehearse an order on a demo account where the money is virtual
- A year of dividends and transactions has to be exported to CSV for personal records
- A limit order is stuck and has to be found by ID and cancelled
Not a fit when
- You want algorithmic trading: the author cites MiFID II and prohibits using the plugin for it
- You want advice on what to buy: the plugin gives no financial recommendations and only relays your commands to the API
- Your account is another type, such as CFD: only Invest and Stocks ISA are supported
Example request
Show the summary of my Trading 212 demo account and the three most profitable positions, do not buy or sell anythingLimitations
The Trading 212 API is in beta and endpoint behavior may change. A key is created in one environment and works only there: a demo key does not fit the live account, so each needs its own pair. The limits are strict: the account summary once per 5 seconds, the instrument list once per 50 seconds, a limit order once per 2 seconds, and on a 429 response the agent has to wait for the reset. If you run Invest and Stocks ISA together, each account takes its own pair of variables.
How to disable. In Claude Code remove the plugin through the `/plugin` menu; in other agents delete the skill folder. Then drop T212_API_KEY and T212_API_SECRET from the environment and revoke the key in the Trading 212 app under Settings, then API.
FAQ
Where do I get a Trading 212 API key?
In the app open Settings, then API, and create a key ID and secret pair. Create it in the environment you will work in, demo or live. Then set T212_API_KEY and T212_API_SECRET; T212_ENV=demo switches the skill to the demo environment, and live is the default.
Can I try the skill without real money?
Yes, the demo environment at demo.trading212.com runs on virtual money. Its key is created separately in the app's demo mode, a live key will not work there and the server answers 401.
How do I connect Invest and Stocks ISA together?
Set two pairs of variables: T212_API_KEY_INVEST with T212_API_SECRET_INVEST and T212_API_KEY_STOCKS_ISA with T212_API_SECRET_STOCKS_ISA. If at least one account has a complete pair, the skill already treats access as configured and picks the pair that fits your request.
How do I install the skill in Cursor?
In Cursor Settings open Rules, Skills, Subagents, press Add Rule in the Rules block and choose adding from GitHub. Enter https://github.com/trading212-labs/agent-skills.git in the field.
Does the skill check the balance before an order?
Yes, the validation section of SKILL.md says to compare cash.availableToTrade before a buy and quantityAvailableForTrading before a sell. The API does not guard against duplicates: a repeated request creates a second order, and a single ticker is capped at 50 pending orders.
Discussion
No questions or reviews yet.
Related
SkillsA CLI and skill giving an agent access to a T-Investments account: portfolio, returns, bond screeners and confirmed orders
A set of skills for individual investors and traders: market review, stock screening, technical analysis, trade planning, journaling and post-trade review
Skills and an MCP server for options traders: quotes, technical analysis, Greeks, spreads, scanners and Interactive Brokers portfolio
68 skills for crypto and DeFi: market APIs, on-chain analysis, backtests, position sizing, liquidity pools and trade taxes
Day Trader skill
The Day Trader skill
11 skills for day trading: chart scanner, news, entry and exit, risk checks and a history replay before any order
The Trade It plugin connects brokerage accounts to Claude Code, Codex and Cursor: the agent reads positions and prepares orders for review
Comparison with similar tools
Cards that share the main search query, and how they differ.
| Tool | Official | Authentication | Repository stars | Main difference |
|---|---|---|---|---|
| Trading 212 API Agent Skills (this card) | yes | 142 | ||
| t-invest-skill | no | 48 | a skill and CLI for a T-Invest account with orders after confirmation, while this covers another broker's API with a demo environment | |
| tinvest-mcp | no | key is optional | 1 | an unofficial local MCP server for T-Invest, while this set comes from the broker itself and installs as a skill |
README in short
The README presents the project as an AgentSkills plugin for Claude Code, OpenClaw and other assistants. It goes on with a feature list, supported account types, install routes for five environments, environment variable setup and a section on key security. It closes with a disclaimer: the author calls the integration experimental and warns that an AI may misread a command and place an extra order.
README badge
Original SKILL.md
--- name: trading212-api description: 'This skill should be used when the user asks to "connect to Trading 212", "authenticate Trading 212 API", "place a trade", "buy stock", "sell shares", "place market order",, "place pending order", "place limit order", "cancel order", "check my balance", "view account summary", "get positions", "view portfolio", "check P&L", "find ticker symbol", "search instruments", "check trading hours", "view dividends", "get order history", "export transactions", "generate CSV report", or needs guidance on Trading 212 API authentication, order placement, position monitoring, account information, instrument lookup, or historical data retrieval.' license: MIT License metadata: author: Trading 212 version: 1.0.0 --- # Trading 212 API > **Note:** The Trading 212 API is currently in **beta** and under active development. Some endpoints or behaviors may change. ## Quick Reference ### Environments | Environment | Base URL | Purpose | | ----------- | ------------------------------------ | --------------------------------------- | | Demo | `https://demo.trading212.com/api/v0` | Paper trading - test without real funds | | Live | `https://live.trading212.com/api/v0` | Real money trading | ### Order Quantity Convention - **Positive quantity = BUY** (e.g., `10` buys 10 shares) - **Negative quantity = SELL** (e.g., `-10` sells 10 shares) ### Account Types Only **Invest** and **Stocks ISA** accounts are supported. ### Instrument Identifiers Trading 212 uses custom tickers as unique identifiers for instruments. Always search for the Trading 212 ticker before making instrument requests. --- ## Authentication HTTP Basic Auth with API Key (username) and API Secret (password). ### Check Existing Setup First Before guiding the user through authentication setup, check if credentials are already configured: **Semantic rule:** Credentials are configured when **at least one complete set** is present: a complete set is key + secret for the same account (e.g. `T212_API_KEY` + `T212_API_SECRET`, or `T212_API_KEY_INVEST` + `T212_API_SECRET_INVEST`, or `T212_API_KEY_STOCKS_ISA` + `T212_API_SECRET_STOCKS_ISA`). You do not need all four account-specific vars; having only the Invest pair or only the Stocks ISA pair is enough. Check for any combination that gives at least one usable key+secret pair. ```bash # Example: configured if any complete credential set exists if [ -n "$T212_AUTH_HEADER" ] && [ -n "$T212_BASE_URL" ]; then echo "Configured (derived vars)" elif [ -n "$T212_API_KEY" ] && [ -n "$T212_API_SECRET" ]; then echo "Configured (single account)" elif [ -n "$T212_API_KEY_INVEST" ] && [ -n "$T212_API_SECRET_INVEST" ]; then echo "Configured (Invest); Stocks ISA also if T212_API_KEY_STOCKS_ISA and T212_API_SECRET_STOCKS_ISA are set" elif [ -n "$T212_API_KEY_STOCKS_ISA" ] && [ -n "$T212_API_SECRET_STOCKS_ISA" ]; then echo "Configured (Stocks ISA); Invest also if T212_API_KEY_INVEST and T212_API_SECRET_INVEST are set"