CFDs are complex instruments and carry a high risk of losing money rapidly due to leverage. Negative balance protection applies, so you cannot lose more than the funds in your account. Trade only with money you can afford to lose.
Home / Developers
For developers

Run your own bot on your own account.

The Trader API lets you connect a bot or script you write and run yourself — on your own machine or server — to your Seven Stags demo or live account. We don't host it, review it, or see your code. It's your bot, your decisions, and your risk.

Jump to the Python quick start
What it is

Your account, your code, your infrastructure

The Trader API is a REST API scoped to one trading account at a time. A token you generate identifies that account, so every request you send acts on it — reading balances and positions, placing and managing orders, and pulling your own trade history. There is no streaming; a bot built on it polls on whatever schedule makes sense for your strategy.

We don't run it

Nothing you write runs on our servers. Your bot lives on your own machine, server, or VPS, and calls the API from there.

We don't see your code

The API only ever receives the requests your bot sends — prices, balances, order instructions. Your strategy logic never touches us.

Your risk, your decisions

A bot you build and run is entirely your own responsibility — its logic, its uptime, and every trade it places. We provide the connection, not advice or a guarantee of any outcome.

Before you start

Build and test on demo first

Open a free demo account and point your bot at it before it ever sees a live account. Demo accounts use the same Trader API base URL as live, with virtual funds standing in for real money — it's the only way to find out how your bot actually behaves before any of your own money is on the line. Only move to a live account once you understand exactly what it does and why.

New to this account? Open a free demo account first — no deposit required to start testing.
Getting your token

Generate a Trader API token

You start from the client portal, but the token itself is generated inside the Web Trader, per trading account.

  1. In the client portal, find the trading account you want your bot to use and click Trade on its account card. This opens the Web Trader, signed in automatically — no separate login.
  2. In the Web Trader, click your avatar in the top-right corner to open the profile menu, then choose API Access. This opens the API Access modal, with a tokens table and a Generate Token button.
  3. Click Generate Token. On General Information, name the token, optionally tick Used via MCP (AI assistant), choose the trading account (each token works on exactly one account, and this can't be changed later), and pick an expiry: 30 days (default), 90 days, 6 months, 1 year (maximum), or a custom date. Keep it short — the 30-day default is a good choice unless you need longer.
  4. On Access, choose the permissions the token gets — full access, read-only, or a custom selection per resource (account info, positions, orders, history, and so on). Grant only what your bot needs; start read-only.
  5. Copy the token immediately — it's shown once, at creation. After that, the tokens table only ever shows a masked version of it.
  6. Store it as an environment variable for your bot to read. Never paste it into your bot's code, a commit, a screenshot, or a support chat.

The same API Access modal also shows the Trader API base URL (https://trader-api.match-trader.com, with an API Documentation link next to it), an MCP server URL (https://mcp.match-trader.com/mcp, with a Copy configuration button) for AI assistants, and a table of your existing tokens, masked, where you can revoke any of them.

A token is tied to one trading account. If you trade more than one account, generate a separate token for each — several tokens can exist on the same account (for example, one for your bot and one for a dashboard), and they share that account's rate limit. API Access is available on every Seven Stags trading account, demo and live. If you don't see it in the profile menu, contact support.
Token hygiene

A few rules that save you a bad day

Start read-only

Generate a read-only token first and get your bot reading account data and prices correctly before you ever grant it the right to trade.

One token per bot

If you run more than one bot or script, give each its own token. It's easier to tell them apart later and to revoke just one without touching the others.

Keep it secret

Treat it like a password: environment variable only, never hardcoded, never committed, never shared in a screenshot or a support ticket.

Leaked? Revoke it

Revoke and generate a fresh one immediately in Web Trader's API Access view if a token is ever exposed. A revoked token stops working immediately.

We'll never ask

Seven Stags staff will never ask for your token by chat, email or phone. The only place on our side where you may enter a token is the Trader API token field in your client portal, if you use a portal feature that needs it, such as copy trading — for your own bot, keep the token on your own machine. Use a separate token for the portal than the one you give your own bot.

Respect 429s

Every account has a per-endpoint and an overall rate limit. Back off and retry using the Retry-After header instead of hammering a failing call.

Python quick start

Read your account and positions

The Trader API is plain REST over HTTPS — Authorization: Bearer <token> on every request, JSON in and out. Here's the shortest useful example: read your account summary and open positions.

import os
import requests

TOKEN = os.environ["TRADER_API_TOKEN"]  # never hardcode this
BASE_URL = os.environ.get("TRADER_API_BASE_URL", "https://trader-api.match-trader.com")
HEADERS = {"Authorization": f"Bearer {TOKEN}"}

account = requests.get(f"{BASE_URL}/v1/account", headers=HEADERS, timeout=10)
account.raise_for_status()
print(account.json())  # login, accountType (REAL/DEMO), currency, leverage, accessRight, ...

positions = requests.get(f"{BASE_URL}/v1/positions", headers=HEADERS, timeout=10)
positions.raise_for_status()
print(positions.json())  # open positions on this account, with live P&L

That's it for reading. Placing an order follows the same pattern with a POST and a JSON body — see the downloadable samples below for a complete, tested version with error handling and a demo-only safety guard.

What you can call

Account, market data, trading and history

AreaWhat it gives you
AccountProfile, currency, leverage and trading permission; live balance, equity, margin and free funds.
Market dataTradable instruments and their size/price rules, live bid/ask quotes, and historical OHLC candles.
PositionsOpen a position at market, read your open positions, adjust take-profit/stop-loss, close in full or in part.
Pending ordersPlace a limit or stop order, read/adjust/cancel it before it triggers.
HistoryClosed positions and account ledger entries (deposits, withdrawals, trade results) over a date range.

There are no deposit or withdrawal endpoints — a Trader API token can never move money in or out of your account, whatever permissions you grant it. Every request needs a valid, unexpired, unrevoked token with the right permission for that call, or it's rejected before anything happens.

Rate limits

Respect 429, and back off

Rate limits apply per trading account, shared across every token you've issued for it and any AI assistant session connected to it — not per token. There's a limit per endpoint (below) plus a separate overall pool for the account, over a rolling one-minute window; the overall pool size isn't published and is shown in Web Trader's API Access view once you've generated a token. A 401, 403 or 429 response doesn't count against your limit; other error responses do.

EndpointsLimit
Quotes, open/update/close position, create/update/cancel pending order60 / min
Positions, account summary, candles, pending orders list, closed positions, ledgers20 / min
Account, symbols, platform details, trading hours10 / min

The Trader API is REST only — there is no streaming, so your bot has to poll. A quote request roughly every 2–3 seconds per account leaves comfortable headroom under the 60/min quote limit; polling faster than that eats into the budget your order calls also share. Every response includes X-RateLimit-Remaining-Endpoint and X-RateLimit-Remaining-Global headers so your bot can see how much headroom is left. Go over either limit and you get 429 Too Many Requests with a Retry-After header telling you how many seconds to wait — have your bot sleep that long and retry, with a sane cap on total retries, rather than hammering the endpoint.

Using MCP?

Using the MCP server with an AI assistant (optional)

If you'd rather point an AI assistant at your account than write a bot yourself, the same API Access modal has an MCP server for it — this is just another way to reach the same Trader API, with the same account scope and rate limit, not a separate product.

  1. When generating the token, tick Used via MCP (AI assistant), choose minimal permissions (start read-only), a short expiry, and ideally a demo account.
  2. Use the Copy configuration button in the API Access modal to get the MCP server config (server URL https://mcp.match-trader.com/mcp) and add it to your AI assistant's MCP settings. The token itself isn't part of that config — supply it separately as an Authorization: Bearer <token> header, kept in the assistant's secret or environment store, never pasted into a chat prompt or a shared file.
  3. From there, the assistant can act on that one trading account, limited to the permissions you granted the token — and its calls share that account's rate limit with everything else using the token. Revoke the token in the API Access modal when you're done.
Download

Sample bots to get started

Small, tested Python scripts and a shared client module — read-only ones that print your account, positions and quotes, and a demo-only one that places a single small order with a stop-loss. MIT licensed, no warranty, your risk.

Download the zip

trader-api-python.zip — everything below, ready to run.

read_account.py

Read-only: account info, balance, and open positions. Included in the zip.

poll_quotes.py

Read-only: polls quotes for one symbol on a fixed interval, well inside the rate limit. No streaming exists, so this is a template, not a subscription. Included in the zip.

demo_order_with_sl.py

Places one small market order with a stop-loss. Refuses to run on anything but a confirmed demo account. Included in the zip.

Using MetaTrader 5 instead?

Copy your own MT5 account's trades in

If you'd rather keep running your strategy in MetaTrader 5 than write code against the Trader API, MT5 copy lets you copy your own MT5 account's trades into your Seven Stags account automatically.

Set up MT5 copy

Build it on demo. Trade it on live when you're ready.

Open a free demo account and start testing your own bot against real market data, with none of your own capital at risk.

Open a Free Demo Account