Connectors
The data sources KLineChartQuant ships with, how to run them on your machine, and how kcq.nebutra.com hosts them.
A connector is a small backend that speaks to an upstream feed and answers the chart in the market-data-v1 protocol. The chart ships a provider for each one, so once a connector is running, its instruments show up in search with no extra code.
At a glance
| Source id | Connector | Covers | Local port |
|---|---|---|---|
gotdx | GoTDX-Connector (services/tdx-api) | Tongdaxin quotes: A-shares, futures and other markets | 8080 |
binance | Binance-Connector | Spot bars, real trades, trade archives and depth | 8091 |
baostock | Baostock-Tradingview-Connector | BaoStock A-share daily, weekly, monthly and minute K-lines | 8000 |
tradingview | Baostock-Tradingview-Connector | TradingView global instruments | 8000 |
finshare | Baostock-Tradingview-Connector | China futures through the FinShare SDK | 8000 |
mt5 | KCQ-MT5-connector | MT5 (Exness) terminal: forex, metals and crypto CFDs, with live bars | 8090 |
ths | KCQ-THS-connector | THS daily bars for China stocks, indices, ETFs, futures and options; API key required | 8092 |
mock | none | MOCK-100 and MOCK-10000, generated in the browser | — |
The default base URLs come from dataSourceRegistry in the core. Any of them can be overridden at runtime with marketDataProviderRegistry.setConfig(id, { baseUrl }).
Run them locally
The connectors live in their own repositories, cloned next to the chart repository rather than inside it. You need git, the Go version required by each connector's go.mod (Binance requires Go 1.24 or later), and uv with Python 3.12; dependencies download on first run.
Clone the backends
pnpm setup:backendsThis clones GoTDX-Connector, Binance-Connector, Baostock-Tradingview-Connector, KCQ-MT5-connector and KCQ-THS-connector into the parent directory. It is idempotent: existing directories are skipped.
Start the chart with connectors
pnpm dev -c all # dev server + gotdx, binance, baostock (mt5/ths excluded)
pnpm dev -c gotdx baostock # dev server + the ones you name
pnpm dev -c mt5 # MT5 must be named explicitly
pnpm dev -c ths # THS must be named explicitly; API key requiredAliases work too: tdx or g for gotdx, bnb for binance, b for baostock, m for mt5. Shorthands exist for the common cases: pnpm dev:all, pnpm dev:g, pnpm dev:b, pnpm dev:bnb, pnpm dev:mt5. Add --lan to bind the dev server to 0.0.0.0.
Or run only the backends
pnpm connector # gotdx + binance + baostock
pnpm connector baostock # just oneLogs from every process share one terminal, prefixed [vite], [gotdx], [binance], [baostock] and [mt5]. The dev server proxies /api/public to port 8080 and /api/stock to port 8000.
Each source
GOTDX
gotdx reads Tongdaxin quotes through GoTDX-Connector. Start it with pnpm connector gotdx (it runs go run ./services/tdx-api).
TradingView and BaoStock
Baostock-Tradingview-Connector is one FastAPI service (uv run python ./server.py) behind three source ids: tradingview for global historical bars, baostock for A-share K-lines from BaoStock, and finshare for China futures. Start it with pnpm connector baostock.
Binance
Binance-Connector is a separate read-only spot service, started with pnpm connector binance (go run ./cmd/binance-connector). Its binance provider exposes V1 bars and live bars, real trades, historical trade ranges and NDJSON archives. The chart's canonical trade source supplies the footprint display mode. Depth uses /api/v1/market-data/sources/binance/depth and /depth/stream; the former /api/binance routes are retired.
THS
KCQ-THS-connector provides daily bars only. Start it explicitly with pnpm connector ths, after configuring THS_API_KEY or ths.api_key in the connector's config. Minute bars are unsupported, and all does not start it.
MT5
KCQ-MT5-connector reads from a logged-in MT5 (Exness) terminal, so it only runs on Windows. That is why all leaves it out. Its instruments trade around the clock and use a UTC session.
Mock
mock needs no backend and is always online. It offers two daily instruments, MOCK-100 and MOCK-10000, and a generated live stream. Use it for rendering tests and demos.
Setup notes for GoTDX-Connector, BaoStock/TradingView and MT5 are kept in their original Chinese: GoTDX-Connector, BaoStock / TradingView, MT5.
How kcq.nebutra.com runs them
The hosted workstation at kcq.nebutra.com/app runs GOTDX, TradingView and Binance Spot inside the same isolated runtime namespace as the static site on Xiaojiyun. A small supervisor starts nginx and the three connectors, restarts each one on its own with capped backoff, and prefixes their logs. If nginx itself cannot stay up, systemd restarts the unit.
| Public path | Process | Loopback port |
|---|---|---|
/market/tdx/api/v1/market-data/… | GOTDX (gotdx) | 8081 |
/market/python/api/v1/market-data/… | TradingView (tradingview) | 8083 |
/market/binance/api/v1/market-data/… | Binance (binance) | 8082 |
nginx forwards the allowed V1 endpoints and live-bars streams, plus Binance trade ranges, trade streams, trade archives and depth. Everything else under the connector paths is a 404. Requests are rate-limited and connection-capped per client. SSE and archives are unbuffered and uncached. GOTDX runs in the Asia/Shanghai time zone so upstream timestamps keep their meaning. Connectors receive no account or trading secrets.
Connector revisions are pinned in apps/kcq/connector-sources.json in the Nebutra-Sailor repository: 363045841/GoTDX-Connector, TsekaLuk/Baostock-Tradingview-Connector and TsekaLuk/Binance-Connector (BINANCE_MARKETS=spot), each at a fixed commit. One image is built from those pins, and the deploy is verified with real search, recent bars, Binance depth and real trade frames.
GOTDX, TradingView and Binance appear in the hosted source catalog. BaoStock is withheld until its upstream login succeeds, FinShare while its continuous-contract history is stale, MT5 because it needs a Windows host, and THS because its API key is not provisioned.