Skip to content
Macit Giray Gökırmak edited this page Nov 13, 2026 · 16 revisions

Tapebasis

Tapebasis

Multiple tapes, one basis. An MCP server that serves TradingView, Finviz, Yahoo Finance, StockAnalysis and Bloomberg market data together, cross-checks every overlapping figure, and labels each response with the provider that actually produced it.

Basis is the finance term for the price difference between two markets quoting the same asset. Tape is the ticker tape. Tapebasis is the spread between multiple feeds, measured on every call.

The point is redundancy you can see. Every provider that could answer a field is asked, natively and in parallel. When several answer, the data is cross-checked. When only one answers, you get the data, clearly marked as single-source. When none answers, you get NONE instead of a plausible-looking number. And because every provider scrapes or calls an undocumented upstream, a background monitor probes every endpoint and reports API/schema drift inside ordinary tool responses.

Each leg is fetched natively: TradingView's own scanner and chart websocket, Finviz's HTML and JSON islands, Yahoo's chart API, StockAnalysis's quote API, Bloomberg's quote pages. A provider that quietly proxies another is worthless as a cross-check, so none does. Bloomberg and StockAnalysis are the other two legs, asked in parallel with the rest. Bloomberg's equity prints are exchange-delayed, so a pair that far apart is reported as not comparable with the delay named instead of being counted as disagreement. StockAnalysis covers US equities and ETFs only and serves the same consolidated tape Yahoo does, so that pair is weak corroboration. See Bloomberg and StockAnalysis.

No tool requires an API key. Every capability works out of the box; MARKETAUX_API_TOKEN only upgrades news and sentiment to a licensed feed.


Why this exists

One market-data source gives an agent a single number and no way to judge it. Asking several independent providers the same question and comparing the answers inverts the problem: the server asks them all, compares, and tells the agent what it is holding.

Situation What this server reports What a single-source feed cannot
Every asked provider answers, values agree ALL, comparisons[].match: true confirm the number against independent readings
They answer but diverge ALL + every value in comparisons + a warning show that a disagreement exists
One provider is down TRADINGVIEW/FINVIZ/YAHOO/SA + "not corroborated" say the figure is single-source
Only Bloomberg has it BLOOMBERG + cross_checked: false say what is uncorroborated and how stale
All down NONE, no value presented avoid a stale or invented number
Upstream markup changed degraded: true + a named warning avoid a silently empty or wrong response

Documentation map

Page What it covers
Getting Started Install, run over stdio or HTTP, first calls
Response Contract The envelope, every field, how to read it correctly
Tools Reference All 35 tools, providers, and what is compared
Architecture Module layout, data flow, why the pieces sit where they do
Health Monitor Probes, fingerprints, drift detection, baselines
Sentiment Token-free local scoring vs. licensed Marketaux
Configuration Every environment variable
Docker Standalone image, compose, volumes, healthcheck
Development Tests, layout, adding a tool
Releasing Version checks, package smoke tests, OIDC setup and gated publication
Troubleshooting Symptom → cause → fix
Design Decisions Non-obvious choices and the reasons behind them

The data_provider contract

Every tool result carries exactly one of eight values. It states coverage, never agreement:

Value Meaning
ALL Every provider that was asked answered.
PARTIAL More than one answered, but a provider that was asked produced nothing. Values are served; errors says why.
TRADINGVIEW Only TradingView answered. Served, but not corroborated.
FINVIZ Only Finviz answered. Served, but not corroborated.
YAHOO Only Yahoo Finance answered. Served, but not corroborated.
SA Only StockAnalysis answered. Served, but not corroborated; US equities and ETFs only.
BLOOMBERG Only Bloomberg answered. Served, but not corroborated; its quote can be delayed.
NONE No provider could supply it. No value is presented.

ALL says every provider asked answered, never that they agree, and a leg that was asked and failed downgrades the label to PARTIAL rather than hiding behind ALL.

{
  "data_provider": "ALL",
  "verification": "MULTI_SOURCE",          // MULTI_SOURCE | SINGLE_SOURCE | UNAVAILABLE
  "providers_answered": ["TRADINGVIEW", "FINVIZ", "YAHOO", "SA", "BLOOMBERG"],   // only those that answered
  "notice": "Every provider asked answered ...",   // sentence to relay to the user
  "data": { ... },                         // the reconciled payload, one value per field
  "fields": {                              // per-field provenance, never a joint label
    "price": { "source": "FINVIZ",
               "supplied": ["TRADINGVIEW", "FINVIZ", "YAHOO", "SA"],
               "compared": ["TRADINGVIEW", "FINVIZ", "YAHOO", "SA"],
               "agreement": true },
    "peers": { "source": "FINVIZ", "supplied": ["FINVIZ"], "compared": [], "agreement": null } },
  "freshness": {                           // why `data` holds the value it does
    "tradingview": "2026-11-04T00:59:53+00:00",
    "finviz": "2026-11-04T10:42:00+00:00",
    "yahoo": "2026-11-03T21:00:01+00:00",
    "sa": "2026-11-03T21:00:01+00:00",         // same consolidated tape as Yahoo
    "bloomberg": "2026-11-04T10:27:00+00:00",  // 15 min behind, so it cannot win
    "chosen": "FINVIZ",
    "decision": "newest",                  // newest | tie | no_timestamp
    "newest_print": "2026-11-04T10:42:00+00:00"
  },
  "comparisons": [                         // the actual side-by-side numbers
    { "field": "price",
      "values": { "TRADINGVIEW": 331.9, "FINVIZ": 332.33, "YAHOO": 331.9, "SA": 331.9, "BLOOMBERG": 332.1 },
      "match": true, "diff_pct": 0.1294, "tolerance_pct": 0.5 }
  ],
  "resolutions": { "TRADINGVIEW": { "symbol": "NASDAQ:AAPL" }, ... },
  "sources": { "TRADINGVIEW": "scanner.tradingview.com", "FINVIZ": "...", "YAHOO": "...", "SA": "...", "BLOOMBERG": "..." },
  "errors": [ { "provider": "FINVIZ", "code": "...", "message": "..." } ],
  "warnings": [ "..." ],
  "degraded": false,                       // true when the health monitor saw drift/downtime
  "generated_at": "2026-11-04T10:43:02+00:00"
}

One value per compared field, and it is the newest print. data holds a single price: the reading whose market print is newest. Ties are broken by the documented default order (FINVIZ, TRADINGVIEW, YAHOO, SA, BLOOMBERG); Bloomberg is last because its print can be structurally older, and StockAnalysis sits just before it because its coverage is the narrowest of the live feeds. Every original reading stays in comparisons.values, and freshness.decision states which rule applied.

ALL does not mean "the values agree". It means every provider asked answered. verification: MULTI_SOURCE is likewise a coverage label for multiple answered providers, not evidence that any field agreed. Agreement is a separate axis, reported per field in comparisons[].match and summarised in notice/warnings. A leg that was asked and failed makes the response PARTIAL, and providers_answered names which providers actually answered.

fields separates who answered from who was judged. supplied is every provider that returned a reading for the field; compared is every provider whose reading was actually judged against another one, which is narrower whenever a pair could not be compared. agreement describes only compared, so true never means "every supplier agreed".

Disagreements are never silently resolved. If the providers report different prices, all values stay in comparisons, the field is named in notice and warnings, and data_provider stays ALL. An agent reading it can see exactly how far apart they are.

A non-comparison is not a disagreement. A field with non-numeric or blank-symbol readings, or one the providers measure against different baselines, is reported as not_comparable, with the reason in pairs[].not_comparable, instead of being called a conflict or agreement. The positive agreement notice requires an actual agreeing pair. That covers a day change or volume whose prints belong to different sessions, a print past the staleness ceiling, a provider that exposes no print time at all, a declared feed delay (Bloomberg states 15 minutes on equities, so its pairs stop being comparable at that distance), and a field with no shared definition: spot FX has no single official previous close, so an FX day change is always reported from every provider and never judged.

Full detail: Response Contract.

A price is a print, and it belongs to a session

The obvious price field goes stale the moment the regular session ends, and a quote that does not say which session it came from reads as current when it is hours old. So each provider's live print is resolved before anything is compared, and the session travels with the number.

  • TradingView's scanner keeps close on the regular feed and streams the live extended print in premarket_close / postmarket_close, naming the window in current_session.
  • Yahoo's regularMarketPrice freezes at the regular close while fulldayPrice does not.
  • StockAnalysis keeps the regular close in price and the current extended print in extended_hours.
  • Finviz's Last Close header is already the live print, extended hours included.

stock_quote and stock_prices publish the resolved session (pre_market, regular, post_market or overnight) and measure the day change and previous close against the same session's baseline, so a row's own three numbers describe one observation. The session is read off the print that was served, not off a nominated leg: a delayed feed can be describing the previous window while another provider's newer print wins, and labelling the row from the delayed feed would name a session the number does not belong to. A provider that names no session keeps its old value rather than being credited with a print it did not send.

The overnight window (20:00-04:00 ET on Blue Ocean ATS) is read independently from TradingView's BOATS: quote socket and Yahoo's quote-header fields. The selected print and its source are explicit; comparison retains both observations but does not imply that two readers of BOATS are independent market venues. On the same overnight occurrence, normalized changes use Yahoo's reference_close while TradingView's original venue change remains separately labelled. A closed overnight print remains visible without claiming to be live. stock_quote does not carry an overnight block: use stock_extended_hours for it. Details: Design Decisions.


StockAnalysis: the leg that covers US equities and ETFs

StockAnalysis is in PROVIDER_ORDER, is asked in parallel by stock_quote, stock_prices and stock_extended_hours, and contributes to ALL / providers_answered. Three properties keep that honest instead of inflated:

  • it is a US feed: the quote API serves US-listed equities and ETFs and answers 404 for indices, FX, crypto and foreign listings, so anything else resolves to not carried and is recorded as NOT_ATTEMPTED, never as an error;
  • its price, previous close, session range and 52-week range are the same consolidated tape Yahoo serves, so agreement between those two is one tape read twice, not two witnesses;
  • ts is epoch milliseconds, converted to ISO in the access layer so a print is never dated to a century no market trades in.

What it adds is the session open/high/low Finviz does not publish and the extended-hours block from the same request (stockanalysis_extended_hours). It is paced at 0.5 s, so a stock_prices batch needs no cap for it.

Bloomberg: the leg that states its delay

Bloomberg is in PROVIDER_ORDER, is asked in parallel by stock_quote and stock_prices, and contributes to ALL / providers_answered. Its reading sits in comparisons[].values with the rest. Three properties keep that honest instead of inflated:

  • its equity and index prints are delayed (exchangeDelay reads 15 Minutes), so a pair a delay length apart is reported as not_comparable with the delay named, not as a disagreement;
  • it is last in the tie-break order, so a delayed page can never outrank a live print that shares the same instant;
  • its static fields are penny-identical to Yahoo's, so agreement between those two is one consolidated close read twice. Its ratios (pe_ratio, eps) are computed independently.

lastUpdate is a session sentinel, not a print time (2026-11-05T01:00:00.000Z on a page whose real print was 2026-11-04T20:58:00Z), so print_time is taken from the last intraday point and print_time_missing_reason explains a mismatch. stock_quote bounds the leg with a deadline, so a blocked page becomes a stated TIMEOUT / UPSTREAM_BLOCKED error while the other readings still go out.

bloomberg_quote and bloomberg_markets are the single-source case: those tools ask Bloomberg and nobody else, so they return cross_checked: false and reconciliation_leg: false. The board is also the only source here of the government benchmark yield curve, and it carries no per-instrument print time, which the response says.

Access needs curl_cffi: bloomberg.com gates plain HTTP clients on the TLS fingerprint, so httpx gets a 403 robot page. That is also why the health monitor does not probe this provider; the tool response is the availability signal. Details: Design Decisions.


Symbols are resolved per provider

XAUUSD is OANDA:XAUUSD on TradingView, ^GSPC-style aliasing for indices, a suffix for Yahoo FX, XAUUSD:CUR on Bloomberg and simply not carried by Yahoo, Finviz or StockAnalysis. Indices and commodities live in one instrument registry in symbols.py (one row per instrument, one column per provider), so WTI reaches TradingView as FX:USOIL and never as NYSE:WTI (an equity whose ticker happens to match) and CL1! reaches Yahoo as CL=F. The module resolves each query per provider, caches the result for an hour, and records the derivation in resolutions. A ticker is only returned if the provider can actually quote it, and a missing instrument becomes NOT_ATTEMPTED: a structural fact, not an error.


Quick start

git clone https://github.com/giraygokirmak/tapebasis.git
cd tapebasis
python -m venv .venv && source .venv/bin/activate
pip install -e .
// Claude Desktop / any stdio MCP client
{
  "mcpServers": {
    "tapebasis": {
      "command": "/path/to/.venv/bin/tapebasis"
    }
  }
}
# HTTP
tapebasis streamable-http --host 0.0.0.0 --port 8000
curl -s localhost:8000/health
# Docker (prebuilt image from GHCR)
docker run -d --name tapebasis -p 6013:8000 \
  -v tapebasis-state:/home/mcpuser/.tapebasis \
  ghcr.io/giraygokirmak/tapebasis:latest
curl -s localhost:6013/health

Or build from the checkout with docker compose up -d --build.

Details: Getting Started · Docker.


Note on labelling

Every provider is asked for its own data: TradingView from scanner.tradingview.com and its chart websocket, Finviz from finviz.com HTML and JSON islands, Yahoo from query1.finance.yahoo.com, StockAnalysis from stockanalysis.com/api/quotes, Bloomberg from bloomberg.com quote pages and its market board. Nothing is proxied through another provider, and sources records the upstream each leg used.

Where a capability exists on only some providers, that is stated, not simulated: options chains come from Finviz and Yahoo (TradingView contributes only the underlying price), backtests run twice on TradingView and Yahoo OHLCV, and Finviz and StockAnalysis are never asked for crypto, FX or commodity quotes because neither carries them.


Disclaimer

Market data is provided as-is for research and automation. It is not investment advice, and scraped data can be delayed, incomplete or wrong. Cross-verification reduces the chance of a bad number reaching you; it does not eliminate it. Sentiment scores are a deterministic summary of headline tone, not a prediction, and not a trading signal.

License

MIT. See LICENSE.

Clone this wiki locally