# TickFeed API — Developer Guide

Read-only forex and precious-metals market data (live prices and OHLC candles) for trading bots, backtests and AI agents, over **REST** and **MCP**. No infrastructure to run on your side: you only need an API key and HTTP.

> Base URL: **`https://api.tickfeed.pro`**. Landing page and sign-up: `https://tickfeed.pro`.

## 1. Quickstart

From sign-up to your first request:

1. **Create an account** at `https://tickfeed.pro/signup` and **confirm your email** with the code we send. New
   accounts get free credit at that moment (the current amount and any end date are on the sign-up page), so no
   card or top-up is needed to start.
2. **Create an API key** in your dashboard (*API keys*). It is shown once: save it, e.g. as `TICKFEED_API_KEY`.
3. **Make a request** (below). Every authenticated response has an `X-Balance` header; `GET /v1/usage` (free)
   shows your balance and spend.
4. **Add funds** only when the balance runs low, or straight away if your account got no free credit. A request
   the balance can't cover returns `402 insufficient_balance`.

Turn on two-factor sign-in within 14 days of signing up. It doesn't block your first requests, but after that
deadline API and MCP access pause (`403 two_factor_required`) until it is on.

```bash
curl -H "X-API-Key: $TICKFEED_API_KEY" https://api.tickfeed.pro/v1/price/XAUUSD
```

```python
# pip install tickfeed               (standard library only)
from tickfeed import TickFeed

tf = TickFeed()                                          # reads TICKFEED_API_KEY
p = tf.price("XAUUSD")
print(p["bid"], p["ask"], p["freshness"])                # always check freshness
quotes = tf.prices(["EURUSD", "GBPUSD"])["prices"]      # several pairs, one request
bars = tf.candles("XAUUSD", "M5", limit=100)["candles"]  # oldest first
closed = [b for b in bars if b["complete"]]              # ignore the forming bar
```

Interactive reference: `https://api.tickfeed.pro/docs` (OpenAPI). Python client, examples and MCP configs:
[github.com/TickFeedAPI/tickfeed](https://github.com/TickFeedAPI/tickfeed) (`pip install tickfeed`).

## 2. Authentication

* **Getting a key:** create an account at `/signup`, confirm your email, then create a key in your dashboard (`/dashboard/keys`). Confirming the email adds the free credit, so the key works at once; accounts without credit need to add funds before billable requests succeed. Each key is shown **once**; copy it then. You can have up to 10 active keys and revoke any of them. All keys of an account share its balance and its rate limit (§8).
* **Sending it:** put it in **`X-API-Key: mdp_…`** (REST and MCP). The MCP endpoint also accepts **`Authorization: Bearer mdp_…`**, or a sign-in token from apps that connect with "Sign in with TickFeed" (see §9).
* **Storage:** only a hash of each key is stored. Keep yours out of source control and logs; if one leaks, revoke it in your dashboard and create a new one.
* **User-Agent:** send a descriptive `User-Agent` header (e.g. `mybot/1.0`). The edge's bot protection rejects some generic library defaults, such as Python `urllib`'s, with HTTP 403. The official Python client sets one for you; curl and `requests` work as they are.
* **No key needed** for `/`, `/status`, `/health`, `/pricing`, `/docs` and `/developer-guide`.

## 3. Symbols

TickFeed covers 60 forex pairs and 11 metals. Symbols are six letters, base currency then quote currency
(`USDJPY` is yen per US dollar).

| Group | Symbols | Session schedule |
|---|---|---|
| Metals | XAUUSD, XAGUSD, XPTUSD, XPDUSD, XAUEUR, XAUGBP, XAUAUD, XAUCHF, XAUJPY, XAGEUR, XAGAUD | `metals`: Sun 18:00 → Fri 17:00 New York, daily break 17:00–18:00 NY |
| Majors | EURUSD, GBPUSD, USDJPY, USDCHF, USDCAD, AUDUSD, NZDUSD | `forex`: Sun 17:00 → Fri 17:00 New York; quiet around the 17:00 rollover |
| Crosses | EURGBP, EURJPY, EURCHF, EURAUD, EURCAD, EURNZD, GBPJPY, GBPCHF, GBPAUD, GBPCAD, GBPNZD, AUDJPY, AUDCHF, AUDCAD, AUDNZD, NZDJPY, NZDCHF, NZDCAD, CADJPY, CADCHF, CHFJPY | `forex` |
| Exotics | USDSGD, USDHKD, USDCNH, USDTHB, USDMXN, USDZAR, USDTRY, USDPLN, USDCZK, USDHUF, USDNOK, USDSEK, USDDKK, EURSGD, EURHKD, EURNOK, EURSEK, EURDKK, EURPLN, EURTRY, EURZAR, GBPSGD, GBPNOK, GBPSEK, GBPDKK, GBPTRY, AUDSGD, CHFSGD, SGDJPY, NOKJPY, SEKJPY, NOKSEK | `forex` |

* Precision varies by symbol: gold has 2 decimals (point 0.01), EURUSD 5 (point 0.00001), yen pairs 3. Read `digits` and `point` from `/v1/symbols`.
* Thinly traded exotics (the TRY, ZAR, MXN and NOK pairs, NOKSEK and EURDKK) can go several minutes without a quote while their market is open. Their freshness threshold is longer: each price response's `stale_after_seconds` gives the value for that symbol.
* Use the symbol in paths (case-insensitive), e.g. `XAUUSD`.
* `GET /v1/symbols` (free) is the source of truth for what is available, with `category` (metal, major, minor, exotic), a readable `name`, precision (`digits`, `point`) and currencies.
* Exchange holidays are not modelled yet.

## 4. Timeframes and candles

Timeframes: `S1 S5 S15 S30 M1 M5 M15 M30 H1 H4 D1`.

The seconds timeframes (`S1`–`S30`) are built from tick history when you ask for them, so they cover the same
window as ticks (about the last six months, rolling; see §4a). They use bid prices like every other timeframe,
`tick_volume` counts bid changes in the bar exactly as the minute and longer bars do, and `spread_points` is the
narrowest spread in it. Grouped into minutes, they match `M1` bar for bar. A second with no
quote has no candle. They are live-only (`source=stored` returns `422`) and have no gap report.

`GET /v1/candles/{symbol}?timeframe=H1&limit=100[&start_time=…][&end_time=…][&source=live|stored]`

| Behaviour | Detail |
|---|---|
| Order | Always chronological, oldest first |
| `time` | Bar **open** time, UTC, ISO 8601 (`2026-10-12T22:00:00Z`) |
| `complete` | `false` = the bar's period hadn't ended when captured; values can still change. Usually only the newest bar. |
| Gaps | Never filled, interpolated or forward-filled. Weekends, daily breaks and holidays produce gaps. `GET /v1/candles/{symbol}/gaps` classifies them (`expected: true` = scheduled closure). |
| History depth | Varies by symbol **and** timeframe: daily and four-hour series reach back furthest, one-minute history is much shorter, and `S1`–`S30` cover about six months (rolling). `GET /v1/symbols` (free) returns `history_from` for every symbol: the oldest stored bar per timeframe. Check it before planning a long backtest |
| D1 / H4 alignment | Bars align to the forex trading day, which starts at 17:00 New York (21:00 UTC in summer, 22:00 UTC in winter). A D1 bar's `time` is therefore 21:00 or 22:00 UTC. |
| `limit` | 1–5000 per request (MCP: 1–1000) |
| Without `start_time` | The latest `limit` bars up to `end_time` (default now) |
| With `start_time` | The first `limit` bars from `start_time`. If more exist: `truncated: true` and `next_start_time` = the `start_time` for the next page (the Python client's `iter_candles()` follows this for you) |
| Paging | Any start date works; each page returns at most `limit` bars and costs the same however far back it starts |
| Naive times | Treated as UTC |
| `spread_points` | Narrowest spread in the bar, in points, on the history basis (see §5a: live quotes are wider) |
| `source` | `live` (default) = real-time feed; `stored` = TickFeed's stored history |
| Empty range | `200` with `count: 0`, not an error |

## 4a. Tick history

`GET /v1/ticks/{symbol}?limit=1000[&start_time=…][&end_time=…]` returns every bid/ask change, oldest first:

```json
{"symbol": "XAUUSD", "count": 2, "truncated": true, "next_start_time": "2026-10-30T12:00:00.412Z",
 "ticks": [{"time": "2026-10-30T12:00:00.105Z", "bid": 4120.33, "ask": 4120.42},
           {"time": "2026-10-30T12:00:00.287Z", "bid": 4120.35, "ask": 4120.44}],
 "notes": ["Tick history for XAUUSD is available from 2026-04-21 00:00:05 UTC (about the last six months, rolling)."]}
```

| Behaviour | Detail |
|---|---|
| `time` | Quote time, UTC, ISO 8601 with milliseconds |
| `limit` | 1–10,000 per request (MCP: 1–5,000) |
| Without `start_time` | The latest `limit` ticks up to `end_time` (default now) |
| With `start_time` | The first `limit` ticks from `start_time`. If more exist: `truncated: true` and `next_start_time` for the next page. Pages end on a whole millisecond, so no tick is repeated or skipped |
| History depth | About the last six months, rolling. `notes` gives the exact start for the symbol; earlier `start_time`s begin there |
| Volume | A busy hour of gold is around 25,000 ticks; most forex pairs 3,000–8,000 |

## 5. Prices and freshness

`GET /v1/price/{symbol}` → `bid`, `ask`, `spread` (price units), `spread_points` (points), `point`, `tick_time` (UTC), `age_seconds`, `freshness`, `market_open`, `stale_after_seconds`, `source`.

`GET /v1/prices?symbols=EURUSD,GBPUSD,XAUUSD` → `{"prices": [...]}` with the same fields for up to 30 symbols in one request. Use it whenever a bot watches more than one pair: it is faster and counts once against your rate limit (cost is still 1 unit per symbol).

| `freshness` | Meaning | What your bot should do |
|---|---|---|
| `fresh` | Tick ≤ 120 s old | Use it |
| `market_closed` | Older, but the market is outside its schedule (or within 5 min after an open / 2 min before a close) | Don't treat it as live; wait for the session |
| `stale` | Older **while the market should be trading**: a feed problem | Pause trading decisions; check `/health` |

The last known price is always returned, labelled, and never presented as live when it isn't.

`source` is `live` normally. During a short interruption to our upstream data connection (usually a minute or two), you get the last real quote instead of an error, with `source: "cache"`, its real `tick_time` and `age_seconds`, and `freshness: "stale"` while the market is open. If there is no last quote for a symbol, you get an error: we never fill in a price. Check `freshness` (or `source`) before acting on a value.

## 5a. Spreads: live quotes vs history

TickFeed serves two price bases from the same upstream, and they differ by a fixed amount:

| Basis | Endpoints | Spread |
|---|---|---|
| **Live quote** | `/v1/price`, `/v1/prices`, MCP `get_price` / `get_prices` | Wider: history bid minus *m* points, history ask plus *m* points |
| **History** | `/v1/ticks`, every candle timeframe (`S1`–`D1`, their OHLC and `spread_points`), MCP `get_ticks` / `get_candles` | Narrower: the upstream's recorded quote |

The mid price is the same on both. Measured on 6 November 2026 on all 71 symbols (284 paired observations, no
exceptions): *m* = **4 points per side** for EURUSD, GBPUSD, USDJPY, USDCHF, USDCAD and AUDUSD, and **5 points per
side** for every other symbol. So a live spread is 8 or 10 points wider than the history spread for the same quote
(e.g. XAUUSD: 15 points live vs 5 in history; EURUSD: 8 vs 0). Because candles are built from history bids, a bar's
close is also *m* points above the live bid at the same moment. These figures are measurements, not a contractual
constant; to check them yourself, request `/v1/ticks/{symbol}` around a price's `tick_time` and compare.

**Modelling spreads in a backtest:**

* Your real trading cost is set by the venue you execute with, not by TickFeed. Use its spread and commission if you
  know them.
* If you use TickFeed data as the cost model, history spreads (`spread_points` on candles, or ticks) are a **lower
  bound**: they are the narrowest quotes. Add 2 × *m* points (8 or 10) to match what your bot will see from
  `/v1/price` when it goes live, and test with wider spreads around the 17:00 New York rollover, where spreads widen.
* Compare like with like: thresholds tuned on candle closes (history bid) are offset by *m* points from live bids.
  Either shift them by *m*, or base live decisions on the mid price, which is identical on both bases.

## 6. Health

`GET /health` → `status` (`ok` | `degraded` | `down`), `reasons`, per-symbol `feeds` (freshness, `market_open`), and collector status. `down` returns HTTP 503. Poll it (no key needed) to decide whether to trust the data. A closed market is `ok`, not `degraded`.

## 7. Errors

All errors use one shape:

```json
{"error": {"code": "unsupported_symbol", "message": "Symbol 'BTCUSD' is not supported. Supported: XAUUSD, XAGUSD, ..."}}
```

| HTTP | `code` | Retry? | Typical cause |
|---|---|---|---|
| 401 | `unauthorized` | No | Missing, wrong or revoked key |
| 402 | `insufficient_balance` | After adding funds | Your balance does not cover the request |
| 403 | `account_inactive` | No | Account suspended (contact support) |
| 403 | `two_factor_required` | After turning on two-factor sign-in | The 14-day deadline to turn on two-factor sign-in has passed |
| 429 | `ip_rate_limited` | Yes, after `Retry-After` | Too many requests from one address |
| 404 | `unsupported_symbol` | No | Symbol not offered |
| 422 | `invalid_parameters`, `invalid_range` | No (fix the request) | Bad timeframe/limit/time, start after end |
| 429 | `rate_limited` | Yes, after `Retry-After` seconds | Over your per-minute limit |
| 503 | `upstream_unavailable` | Yes, with backoff | Feed temporarily disconnected |
| 503 | `data_unavailable` | Yes, with backoff | Feed connected but no tick/history yet |
| 503 | `upstream_symbol_missing` | No (contact us) | Service-side symbol misconfiguration |
| 503 | `busy` | Yes, after `Retry-After` | Too many large (>1,000-bar) history pages queued at once; small requests are never affected |

The Python client raises `TickFeedError` (`.status`, `.code`; subclasses `RateLimitedError` and `UnavailableError`). It also retries 429 (honouring `Retry-After`), 503 and connection errors with exponential backoff (`max_retries`, default 3).

## 8. Pricing, balance and rate limits

TickFeed is pay as you go by default (monthly plans are optional, see below): you add funds to a prepaid balance (in USD, GBP or EUR,
chosen when you sign up) and each billable request is charged to it. Prices are per **unit**; one unit is
**$0.002** (or £0.002 / €0.002). Current prices are always at `GET /pricing`.

| Request | REST | MCP tool | Cost |
|---|---|---|---|
| Latest price | `GET /v1/price/{symbol}` | `get_price` | 1 unit |
| Several prices | `GET /v1/prices?symbols=...` | `get_prices` | 1 unit per symbol |
| Candles | `GET /v1/candles/{symbol}` | `get_candles` | 1 unit per started 100 bars **returned** (1–100 bars = 1 unit, 101–200 = 2, …) |
| Ticks | `GET /v1/ticks/{symbol}` | `get_ticks` | 1 unit per started 1,000 ticks **returned** |
| Gap report | `GET /v1/candles/{symbol}/gaps` | `find_gaps` | 1 unit |
| Symbols, usage, health | `/v1/symbols`, `/v1/usage`, `/health`, `/status` | `list_symbols`, `get_feed_health` | free |

* **Only successful requests are charged.** Errors (4xx/5xx, or an MCP tool error) cost nothing.
* **Empty balance:** billable requests return `402 insufficient_balance` (MCP: a tool error starting with
  `insufficient_balance:`). Balances never go negative. Free endpoints keep working.
* **Headers** on every authenticated response: `X-Balance` (e.g. `12.498 USD`), and on charged requests
  `X-Request-Cost` (e.g. `0.002 USD`). Also `X-RateLimit-Limit` / `X-RateLimit-Remaining`.
* **Top-ups:** in your dashboard, $5, $10, $25, $50, $100 or any whole amount from 5 to 1,000 (minimum 5), paid through Stripe.
  Funds never expire.
* **Rate limit:** 120 requests per minute per account (a sliding 60-second window across all your keys:
  extra keys don't add capacity); over it you get `429 rate_limited` with `Retry-After`. A `/v1/prices` call for
  up to 30 symbols uses one slot and is billed per symbol returned. Separately, the edge allows 300 requests per
  minute from one IP address (`429 ip_rate_limited`).
* **`GET /v1/usage`:** your balance, the unit price, and spend per day for the last 30 days.
* **Bots:** poll at the cadence of the bars you trade (e.g. every 30 s for M5), not in a tight loop. Fetching
  100 bars costs the same as fetching 1, so ask for what you need in one call.

### Monthly plans (optional)

Pay as you go stays the default. If you make requests every month, you can choose a monthly plan instead:

| Plan | Price | Included each monthly billing period |
|---|---|---|
| Developer | £29 / $29 / €29 a month | 50,000 billing units |
| Pro | £149 / $149 / €149 a month | 375,000 billing units |

- The allowance uses the same units as pay as you go. Requests use the allowance before your prepaid balance.
- The allowance is not credit. It has no cash value, and unused units don't carry over to the next period.
- **After the allowance:** by default, billable requests return `402 allowance_exhausted` until the next period starts. Free endpoints keep working. Turn on **PAYG fallback** in the dashboard (Plan page) to keep going from your prepaid balance, up to a spending cap you set per billing period (`402 fallback_cap_reached` at the cap). Your card is never charged for extra usage.
- **Limits:** every plan has the same 120 requests per minute and large-request limits as pay as you go.
- **Headers:** responses add `X-Allowance-Units-Used` and `X-Allowance-Remaining`. `X-Request-Cost` is still the money taken from your balance (0 when the allowance covered the request).
- **`GET /v1/usage`** adds a `subscription` object: plan, status, period dates, units included, used and remaining, next payment, and fallback settings.
- **Changes and cancelling:** plan changes start at your next renewal. Cancelling stops the next renewal, and your allowance stays until the end of the period you've paid for. A failed plan payment never affects your API keys or prepaid balance.

## 9. MCP (for AI agents)

Endpoint: **`POST https://api.tickfeed.pro/mcp`**, MCP over Streamable HTTP (stateless, JSON responses). It uses the same service as REST, so results are identical. All tools are read-only (`readOnlyHint: true`) and return structured output.

| Tool | Arguments | Returns |
|---|---|---|
| `list_symbols` | – | Symbols, sessions, precision, timeframes |
| `get_price` | `symbol` | Same as `/v1/price` |
| `get_prices` | `symbols` (list, up to 30) | Same as `/v1/prices` |
| `get_candles` | `symbol`, `timeframe` (default M5), `limit` (≤1000), `start_time?`, `end_time?` | Same as `/v1/candles` |
| `get_ticks` | `symbol`, `limit` (≤5000), `start_time?`, `end_time?` | Same as `/v1/ticks` |
| `get_feed_health` | – | Same as `/health` |
| `find_gaps` | `symbol`, `timeframe`, `start_time?`, `end_time?` | Same as `/v1/candles/{symbol}/gaps` |

The server's `instructions` tell the model how to read freshness, incomplete bars and gaps. Failures come back as tool errors (`isError: true`) with the same `code` names as REST.

**Claude app (web, desktop, mobile), ChatGPT and other apps with MCP sign-in:** add a custom connector with the URL
`https://api.tickfeed.pro/mcp`, then sign in with your TickFeed account and approve. No key needed. Under the hood
this is standard MCP authorization (OAuth 2.1 with PKCE and dynamic client registration; discovery at
`/.well-known/oauth-protected-resource/mcp`). Each connected app appears as a key in your dashboard, billed and
revocable like any key.

**Claude Code:**

```bash
claude mcp add --transport http tickfeed https://api.tickfeed.pro/mcp --header "Authorization: Bearer mdp_your_key"
```

**Any MCP client / Python SDK:** see `examples/mcp_client.py` (official `mcp` ≥ 2 SDK, Bearer header).

**Claude via the API without MCP:** see `examples/claude_agent.py` in the GitHub repo. It uses the Anthropic SDK tool runner with tools that call the REST API.

MCP only gives an agent standard access to the data. It doesn't add trading skill; your strategy and risk controls remain yours.

## 10. Python client reference (`pip install tickfeed`)

Source: [github.com/TickFeedAPI/tickfeed](https://github.com/TickFeedAPI/tickfeed). Standard library only; MIT licensed.

| Method | Notes |
|---|---|
| `TickFeed(api_key=None, base_url="https://api.tickfeed.pro", timeout=15, max_retries=3)` | `api_key` defaults to `TICKFEED_API_KEY` |
| `.price(symbol)` | dict as in §5 |
| `.prices(symbols)` | Up to 30 symbols in one request: `{"prices": [...]}` |
| `.candles(symbol, timeframe="M5", limit=100, start_time=None, end_time=None, source="live")` | One page; datetimes or ISO strings. `S1`–`S30` need client **0.2.0** (see below) |
| `.iter_candles(symbol, timeframe, start_time, end_time=None, page_size=5000)` | Yields every bar in the range across pages |
| `.candles_df(..., completed_only=True)` | pandas DataFrame indexed by UTC time (`pip install tickfeed[pandas]`) |
| `.ticks(symbol, limit=1000, start_time=None, end_time=None)` | **0.2.0.** One page of raw ticks, as in §4a |
| `.iter_ticks(symbol, start_time, end_time=None, page_size=10000)` | **0.2.0.** Every tick in the range, following `next_start_time` |
| `.gaps(...)`, `.symbols()`, `.usage()`, `.health()` | `health()` returns the body even when `down` |
| `parse_time(s)` | API timestamp → aware UTC `datetime` |

**Client versions.** `pip install tickfeed` currently installs **0.1.0**, which rejects `S1`, `S5`, `S15` and `S30`
with `ValueError` before sending a request and has no `ticks()`. Version **0.2.0** adds both, but it has not been
released yet. Until it is on PyPI, use the REST API for seconds candles and ticks:

```bash
curl -H "X-API-Key: $TICKFEED_API_KEY" "https://api.tickfeed.pro/v1/candles/XAUUSD?timeframe=S1&limit=60"
curl -H "X-API-Key: $TICKFEED_API_KEY" "https://api.tickfeed.pro/v1/ticks/XAUUSD?limit=100"
```

`python -c "import tickfeed; print(tickfeed.__version__)"` shows which client version you have installed.

## 11. Examples ([`examples/`](https://github.com/TickFeedAPI/tickfeed/tree/main/examples) on GitHub)

| File | Shows | Install |
|---|---|---|
| `quickstart.py` | Price with freshness label, a batch of quotes, last 10 candles | `pip install tickfeed` |
| `sma_signal_bot.py` | Bot skeleton: decides only on completed bars, only when fresh, once per bar. Prints signals and **places no orders** | `pip install tickfeed` |
| `download_history.py` | Paginated history to CSV for backtesting, completed bars only, gaps reported (not filled) | `pip install tickfeed` |
| `mcp_client.py` | Direct MCP calls with the official SDK | `pip install "mcp>=2"` |
| `claude_agent.py` | Claude agent (Anthropic SDK tool runner) analysing live data | `pip install tickfeed anthropic` |

Each script's docstring repeats its install command and the environment variables it reads.

## 12. What is not guaranteed (yet)

* Uptime and coverage are being measured, not promised. There is a single upstream feed with no redundancy.
* Tick history (and so `S1`–`S30`) covers about the last six months and rolls forward; older ticks are not kept.
* Holidays and early closes are not modelled in the freshness or gap classification.
* The upstream can revise closed bars (e.g. the spread or tick volume, occasionally prices). Stored history
  converges to the upstream within ~10 minutes for the last 72 h; older revisions are not applied automatically, so
  for older bars `source=stored` can differ from `source=live` (which always reads the upstream as it is now).
