Skill-Details

trading212-api

Supports brokerage account access and trade order workflows.

ÜbereinstimmungDirektGeprüft für trading
Quelletrading212-labs/agent-skillsExterne Quelle
Gemeldete Installationen363Nur Popularitätssignal

Vor Nutzung prüfen

Die automatische Prüfung bewertet Relevanz, nicht Sicherheit oder Empfehlung. Lies vor der Nutzung die Quellanweisungen.

Gespeicherte Quellvorschau

SKILL.md

Dieser Auszug wurde bei der Prüfung gespeichert. Die externe Quelle enthält die vollständige und aktuelle Version.

---
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"
else
  echo "No complete credential set found"
fi
```

If any complete set is present, skip the full setup and proceed with API calls; when making requests, use the resolution order in "Making Requests" below (pick the pair that matches the user's account context when multiple sets exist). Do not ask the user to run derivation one-liners or merge keys into a header. Only guide users through the full setup process below when no complete credential set exists.

> **Important:** Before making any API calls, always ask the user which environment they want to use: **LIVE** (real money) or **DEMO** (paper trading). Do not assume the environment.

### API Keys Are Environment-Specific

**API keys are tied to a specific environment and cannot be used across environments.**

| API Key Created In | Works With            | Does NOT Work With    |
| ------------------ | --------------------- | -----------
Vollständige Quelle auf GitHub lesen (öffnet externe Seite)
Kontext

Verwandte Arbeit