Alpaca, Databento and MetaTrader 5 work out of the box. Any other vendor with a REST API for historical bars works through a spec: a short JSON file that describes the vendor's endpoint. Your agent writes the spec and tests it, then downloads bars with it like any other source.
Ask in the chat, for example "fetch a month of ETHUSDT 1-hour bars from Bybit". The agent then:
- reads the vendor's API docs with
web_fetch, and the app asks you before each page it reads; - writes
sources/<id>.jsonin your workspace; - runs
test_source, which fetches one symbol and checks every bar, then fixes the spec until every check passes; - runs
fetch_bars, which writesdata/<symbol>_<timeframe>_<start>_<end>.csv, one CSV per symbol, ready to backtest.
The range runs from the start up to, not including, the end. The CSV has Date, Time (UTC), Open, High, Low, Close and Volume, plus Notional and Tick_count when the vendor supplies them.
What a spec says
A spec names the URL and its query parameters, where the bars sit in the
reply, and which field holds each value. It also gives the time format and
timezone, the vendor's names for each timeframe, how the vendor pages long
ranges, and its rate limit. Your agent reads the full format from the
source_spec tool. Here is a spec for an endpoint with no key:
{
"spec": 1,
"name": "Binance public market data",
"url": "https://data-api.binance.vision/api/v3/klines",
"params": {"symbol": "{symbol}", "interval": "{timeframe}",
"startTime": "{start}", "endTime": "{end}", "limit": "1000"},
"time_param": "unix_ms",
"timeframes": {"1m": "1m", "5m": "5m", "1h": "1h", "1d": "1d"},
"rows": "",
"layout": "arrays",
"fields": {"time": 0, "open": 1, "high": 2, "low": 3, "close": 4, "volume": 5},
"time_format": "unix_ms",
"timezone": "UTC",
"bar_time": "open",
"pages": {"type": "window", "size": 1000},
"per_minute": 600
}
A spec is data, never code. It cannot run anything, add a key or loosen any of the rules below.
The checks
test_source fetches a short recent range, or the range you give it, and
checks:
- the request and the reply, including errors the vendor reports inside a normal reply, and that bars came back;
- prices are positive, and high and low contain open and close;
- volume is never negative;
- no conflicting duplicate times;
- spacing matches the timeframe, and times sit on its grid;
- no bars in the future.
A failed check says what to fix, and shows the shape of the reply so the
agent can correct the paths. Once every check passes, the app records the
spec as verified. fetch_bars takes only verified specs, and any edit to a
spec means it has to pass the test again. Every download checks each bar
again.
Keys and requests
- Requests are GET only, over HTTPS, with no redirects.
- Add the key in Data sources at the top of the app. It is saved in your system keychain, bound to the host the spec named when you saved it. If the spec later points at another host, the key is not sent until you save it again.
- Your agent never sees the key. It never goes into a spec or the chat, and any reply text that repeats it is masked.
- Each download makes at most 100 requests. Change the cap in Data sources, up to 2000. A spec can lower the cap but never raise it.
Reading web pages
web_fetch reads one public web page as text, usually a vendor's API docs.
The app asks you before every page in every permission mode, including
Run without asking. Each allow covers that one URL once.
- The request has no cookies, keys or saved logins.
- It goes to public addresses only, so a page cannot reach the app or your local network.
- It follows redirects only to HTTPS on the same host. A move to another site goes back to the agent, and reading the new page asks you again.
- Your agent is told to treat page text as data and never to follow instructions written in a page.
Claude Code's own web search asks the same way. The app turns off Gemini
CLI's built-in web tools, so Gemini reads pages only through web_fetch.
From an MCP client
The MCP server 0.5.1 has the same source_spec,
test_source and fetch_bars tools, with the same checks and rules. They
read and write sources/ and data/ in the directory the client starts
the server in. Set the key in the server's environment, together with the
one host it may be sent to. <ID> is the spec's id in capitals:
"env": {
"REAMER_SOURCE_POLYGON_KEY": "your key",
"REAMER_SOURCE_POLYGON_HOST": "api.polygon.io"
}
REAMER_SOURCE_MAX_REQUESTS sets the request cap (default 100, up to
2000). A key saved in Data sources in the app also works when keyring is
installed beside the server.