Skip to content

API Reference · Namespace Map

v2 refactors v1's flat sdk.getXxx() into domain-organized namespaces. Every data-fetching capability lives under sdk.<namespace>.<method>(); pure-computation capabilities (indicators, signals, symbol parsing) are exported via subpaths, imported on demand and tree-shaking friendly.

ts
import { StockSDK } from 'stock-sdk'

const sdk = new StockSDK()

const quotes = await sdk.quotes.cn(['600519', '000001']) // namespaced call
const kline = await sdk.kline.cn('600519', { period: 'daily' })
const k = await sdk.options.etf.dailyKline('10004336') // nested namespace

A string symbol is a first-class input: 'sh600519' / '600519' / '00700' / 'AAPL' all work, resolved leniently by normalizeSymbol. When you need object hints, use normalizeSymbol from stock-sdk/symbols first. See Symbols & Codes.

Quotes & Batch

NamespacePurposeDocs
sdk.quotesReal-time quotes: A-share full/simple, HK, US, fund, fund flow (simple), large orders, intraday timelinequotes
sdk.codesCode lists per market: CN / US / HK / fundcodes
sdk.batchWhole-market batch quotes: CN / HK / US / by-codes / rawbatch

K-line & Boards

NamespacePurposeDocs
sdk.klineA/HK/US history K-line, minute K-line, K-line with indicatorskline
sdk.board.industry · sdk.board.conceptIndustry / concept boards: list, spot, constituents, kline, minuteboard

Derivatives

NamespacePurposeDocs
sdk.optionsOptions: index (index) / ETF (etf) / commodity (commodity) / CFFEX (cffex) + options LHB (lhb)options
sdk.futuresFutures: domestic/global K-line, inventory symbols and inventory datafutures

Capital Flow

NamespacePurposeDocs
sdk.fundFlowFund flow (deep): individual / market / rank / sector rank / sector historyfundFlow
sdk.northboundStock Connect / northbound: minute / summary / holding rank / history / individualnorthbound
sdk.marketEventMarket events: limit-up pool / stock changes / board changesmarketEvent
sdk.dragonTigerDragon-Tiger list: detail / stock stats / institution / branch rank / seat detaildragonTiger
sdk.blockTradeBlock trades: market stat / detail / daily statblockTrade
sdk.marginMargin trading: account info / target listmargin

Funds & Utilities

NamespacePurposeDocs
sdk.fundMutual fund extensions: dividend list / NAV history / estimate / rank historyfund
sdk.calendarTrading calendar: is-trading-day / next / prev / market statuscalendar
sdk.referenceReference data: dividend detail / A-share trading calendarreference
sdk.search(keyword)Stock search (top-level shortcut)search

Pure computation · subpath exports

Indicators, signals and symbol parsing are pure functions, zero network, with no dependency on a StockSDK instance. Import them from their own subpaths:

ts
import { calcMACD, addIndicators } from 'stock-sdk/indicators'
import { calcSignals } from 'stock-sdk/signals'
import { normalizeSymbol } from 'stock-sdk/symbols'
ModuleImport pathPurposeDocs
Indicatorsstock-sdk/indicators14 indicators: calcMA / calcMACD / calcBOLL / calcKDJ / calcRSI / calcWR / calcBIAS / calcCCI / calcATR / calcOBV / calcROC / calcDMI / calcSAR / calcKC + addIndicatorsindicators
Signalsstock-sdk/signalscalcSignals: golden / death cross, overbought / oversold, etc.signals
Symbolsstock-sdk/symbolsnormalizeSymbol, SymbolRef type: lenient symbol parsingSymbols & Codes

Conventions

  • Method table → call example → return notes is the shared layout of every API page.
  • Return values follow the v2 unified data contract: base fields symbol / market / assetType / exchange / currency / timestamp / tz / source; the raw field is removed; timestamp is number | null (null when unparseable); percentages are percentage numbers (e.g. 5.2). Amount / price / volume have unified target units, but in the current beta runtime values still follow each provider's raw convention. See Migrate from v1.
  • The v2 SDK is still being implemented: namespaces and method names are stable, but exact parameters / return fields are subject to the final implementation.