{"id":"03020a49-aa82-4eab-af62-aa1882132c1c","slug":"market-data-examples","kind":"mcp","name":"market-data-examples","summary":"Examples for the Adona Robot market-data API and its MCP server","owner":"Adona-Robot","repoUrl":"https://github.com/Adona-Robot/market-data-examples","license":"MIT","licenseTier":"permissive","trust":"community","stars":0,"match":null,"fewStars":true,"format":"mcp","createdAt":"2026-10-04T09:05:00.000Z","addedAt":"2026-10-13T22:01:19.951Z","logoUrl":"https://avatars.githubusercontent.com/u/194780914?v=4","linkOnly":false,"collection":null,"skillPath":null,"categories":["data-analytics","cloud-infra"],"tags":["api","examples","forex","fx","market-data","metals"],"runtime":"remote","local":false,"cloudCapable":false,"cloudCapability":"unknown","cloudReadyOnPlatform":false,"needsApiKey":false,"reviewed":false,"syncedAt":"2026-10-17T04:55:23.681Z","sample":false,"url":"https://conduits.dev/tools/market-data-examples","language":"Jupyter Notebook","transports":["http"],"install":{"remoteUrl":"https://api.adona-robot.com/mcp"},"requirements":{"env":[],"upstreamMayCharge":false},"tools":null,"readme":"# Adona Robot market data: examples and MCP server\n\nRunnable examples for the [Adona Robot](https://adona-robot.com/en) market-data API, and the\nconfiguration to connect an AI agent to its MCP server.\n\nAdona Robot sells **one-second OHLC candles and a live bid/ask quote stream for 46 FX pairs and\n5 spot metals**, over REST and WebSocket. It is priced by capacity: the month's peak of\nsimultaneous connections and slices of 1000 bars, not per seat. **Redistribution is allowed on\nevery paid plan**: show the data in your product, relay it to your own clients, keep what you receive.\nA symbol you follow live for more than 80% of its open hours in a month adds CHF 150 to that\nmonth's invoice, on top of the plan.\n\n*Facts as of 2026-10-03. The current ones are always on [adona-robot.com](https://adona-robot.com/en)\nand, machine-readable, in [spec.json](https://adona-robot.com/spec.json) and\n[symbols.json](https://adona-robot.com/symbols.json).*\n\n| Plan | CHF a month, before VAT | Sized for (simultaneous connections) | Slices of 1000 bars a month |\n|---|---|---|---|\n| Trial, 7 days, free | 0 | 3 | 2 500 a day |\n| Starter | 500 | 30 | 750 000 |\n| Growth | 1 200 | 100 | 2 500 000 |\n| Scale | 2 400 | 300 | 7 500 000 |\n| Enterprise | 5 000 | 1 000 | 25 000 000 |\n\nThe trial carries EURUSD and XAUUSD with 7 days of history; every paid plan carries all 51\nsymbols. A paid plan never refuses a connection: the month's reading sets the next invoice's\nplan. Above Enterprise: sales@adona-robot.com.\n\n## 1. Get a key\n\n1. [Open an account](https://adona-robot.com/en/signup) with your company email address (one\n   trial per company).\n2. Confirm the address, sign in, and create the key on your account page. It is shown once:\n   keep it on your server, never in a web page or a repository.\n3. Export it for the examples:\n\n   ```sh\n   export ADONA_API_KEY=YOUR_API_KEY\n   ```\n\nThe [quickstart](https://adona-robot.com/en/quickstart) walks through the same steps on the site.\n\n## 2. How a call works\n\n- Your **API key** stays on your server. It is exchanged at `POST /v1/tokens` for a\n  **twelve-hour token** per end user of yours (`end_user_id`).\n- **History**: `GET /v1/candles?symbol=EURUSD&timeframe=S1`, timeframes `S1`, `M1`, `M5`, `M15`,\n  `H1`, `H4`, `D1`, up to 5000 bars a page, oldest first, prices as strings. `next_before` is the\n  cursor to the page before (null when there is nothing older). On `S1` a page covers one day,\n  so an empty page with a cursor is an empty day (a weekend): continue with the cursor.\n- **Live**: `POST /v1/ws-ticket` with the token gives a single-use ticket. Open\n  `wss://api.adona-robot.com/v1/stream` offering two subprotocols, `adona.data.v1` and\n  `ticket.<ticket>` (never in the URL), then send a `subscribe` frame with channels such as\n  `quote:EURUSD` and `candle:EURUSD:M1`.\n- A refusal answers `{\"detail\": \"CODE\"}`: branch on the code. Every code and what to do about\n  it is in the [API reference](https://adona-robot.com/en/reference), and the contract is\n  machine-readable at [openapi.json](https://api.adona-robot.com/v1/openapi.json).\n\n## 3. Examples\n\nThe Python and JavaScript history examples and the Python stream are the code of the\n[quickstart](https://adona-robot.com/en/quickstart)'s tabs, unchanged.\n\n| | History | Live stream |\n|---|---|---|\n| curl | [`curl/history.sh`](curl/history.sh) | [`curl/stream-ticket.sh`](curl/stream-ticket.sh) (the ticket; a WebSocket client opens the stream) |\n| Python 3.9+ | [`python/history.py`](python/history.py) | [`python/stream.py`](python/stream.py) |\n| JavaScript | [`javascript/history.mjs`](javascript/history.mjs), Node 18+ | [`javascript/stream.mjs`](javascript/stream.mjs), Node 22+ (global `WebSocket`); the same frames as the quickstart's browser snippet |\n\nThe Python examples need two packages, once: `pip install requests websockets`.\n\n```sh\n./curl/history.sh                   # the latest 1000 EURUSD one-minute bars\npython python/history.py            # the latest 1000 EURUSD one-minute bars\npython python/stream.py             # quotes and one-minute bars, until Ctrl-C\nnode javascript/history.mjs\nnode javascript/stream.mjs quote:XAUUSD candle:XAUUSD:M1\n```\n\nEach one prints `refused:` with the status and the API's answer, and stops, when the API says\nno (a wrong key answers `INVALID_CUSTOMER_KEY`). For a browser, keep the key on your server and hand the page a token:\nthe site publishes a [token server](https://adona-robot.com/examples/token-server.ts) and a\n[browser client](https://adona-robot.com/examples/browser.ts) with reconnection, and\n[history.py](https://adona-robot.com/examples/history.py) keeps a local store of the bars it\nhas fetched, so closed history is paid for once.\n\nThe [`guides/`](guides) folder holds the code of the guides on the site, the same files:\n[one-minute history, paged back](https://adona-robot.com/en/use/forex-1-minute-history-api)\n(`guides/history_m1.py`), [the live stream](https://adona-robot.com/en/use/forex-websocket-price-stream)\n(`guides/stream.mjs`) and [the MCP server for an agent](https://adona-robot.com/en/use/market-data-mcp-server-ai-agent)\n(`guides/mcp.sh`). The [Python guide](https://adona-robot.com/en/use/forex-data-api-python) shows\n`python/history.py` and `python/stream.py`.\n\n[`check/run.sh`](check/run.sh) runs every example once against production and prints OK or KO\nfor each.\n\n### Notebooks and the Python client\n\nThree notebooks open in Google Colab, with the API key taken from Colab's secrets\n(`ADONA_API_KEY`) or typed, never written into the notebook:\n\n| Notebook | What it does |\n|---|---|\n| [`notebooks/eurusd_1s.ipynb`](notebooks/eurusd_1s.ipynb) [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Adona-Robot/market-data-examples/blob/main/notebooks/eurusd_1s.ipynb) | The last hour of EURUSD at one second, as a pandas DataFrame, and its price updates per minute |\n| [`notebooks/gold_live.ipynb`](notebooks/gold_live.ipynb) [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Adona-Robot/market-data-examples/blob/main/notebooks/gold_live.ipynb) | Thirty seconds of XAUUSD's live bid and ask, and its one-second bars as they close |\n| [`notebooks/mcp.ipynb`](notebooks/mcp.ipynb) [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/Adona-Robot/market-data-examples/blob/main/notebooks/mcp.ipynb) | The MCP server called by hand: the offer and a month's price without a key, candles with one |\n\nThe first two use [`adona-market-data`](https://github.com/Adona-Robot/market-data-python), the\nPython client (`pip install \"adona-market-data[all]\"`): candles paged back into pandas, the live\nstream with reconnection, and refusals with their code.\n\n## 4. Symbols\n\n46 FX pairs and 5 metals (XAUUSD, XAGUSD, XAUEUR, XPTUSD, XPDUSD). The list, with each symbol's\nhistory dates, is on [adona-robot.com/en/symbols](https://adona-robot.com/en/symbols) and in\n[symbols.json](https://adona-robot.com/symbols.json); every symbol has its own page, for example\n[EURUSD](https://adona-robot.com/en/symbols/eurusd).\n\n## 5. Connect an AI agent (MCP)\n\nThe MCP server is at `https://api.adona-robot.com/mcp` (streamable HTTP, stateless). Four tools:\n\n| Tool | What it answers | Key |\n|---|---|---|\n| `get_offer` | The plans, prices, limits, trial, continuous feed and links | No |\n| `list_symbols` | Every symbol a paid plan carries, with its name and class | No |\n| `quote_price_for` | The plan and the CHF total, before VAT, for a month of usage | No |\n| `get_candles` | Candle history for one symbol, one page, oldest first | Yes, billed like `GET /v1/candles` |\n\nThe key, when you want `get_candles`, travels on every call in the `Authorization: Bearer`\nheader, or in an `X-API-Key` header for a client or gateway that keeps `Authorization` for\nitself (`X-API-Key: YOUR_API_KEY`, no `Bearer`). Send one key: two different keys in the two\nheaders, or two different `X-API-Key` values, are refused as `CONFLICTING_API_KEYS`. Keep the\nkey in an environment variable, not in a file you commit.\n\n**Claude Code**: put [`mcp/claude-code.mcp.json`](mcp/claude-code.mcp.json) in your project as\n`.mcp.json` (it reads `ADONA_API_KEY` from your environment; unset, the keyless tools still\nwork), or add it from the command line:\n\n```sh\nclaude mcp add --transport http adona-robot https://api.adona-robot.com/mcp \\\n  --header \"Authorization: Bearer $ADONA_API_KEY\"\n```\n\n**Cursor**: put [`mcp/cursor.mcp.json`](mcp/cursor.mcp.json) in `.cursor/mcp.json` (project) or\n`~/.cursor/mcp.json` (global); it reads `${env:ADONA_API_KEY}`.\n\n**Claude Desktop and claude.ai**: Customize, then Connectors, then Add custom connector, with\nthe URL `https://api.adona-robot.com/mcp` and the authentication \"No sign-in\" (on Team and\nEnterprise, an owner adds it under Organization settings, then Connectors). The three keyless\ntools work as is. For `get_candles`, add the request header `Authorization` with the value\n`Bearer YOUR_API_KEY`, or `X-API-Key` with the value `YOUR_API_KEY`, where your account offers\nrequest headers (a beta, not yet open to every account).\n\nThen ask, for example: \"What would 40 simultaneous users cost on Adona Robot?\"\n\nWithout a client, the server answers plain JSON-RPC: see [`curl/mcp.sh`](curl/mcp.sh).\n\n## Support\n\nsupport@adona-robot.com, by email on business days. Security reports:\n[adona-robot.com/en/security](https://adona-robot.com/en/security).\n\nThe code in this repository is under the [MIT License](LICENSE). The data you read with it is\ngoverned by the [terms of service](https://adona-robot.com/en/terms).\n"}