Market Data

The Go SDK provides a QuoteClient that wraps all market-data endpoints. Every method returns ([]byte, error) — the raw JSON response body — so you can unmarshal into your own structs or inspect the payload directly.

Quick Start

package main

import (
	"fmt"
	"log"

	"github.com/tigerfintech/openapi-sdks/go/client"
	"github.com/tigerfintech/openapi-sdks/go/config"
	"github.com/tigerfintech/openapi-sdks/go/quote"
)

func main() {
	cfg, err := config.NewClientConfig(
		config.WithPropertiesFile("tiger_openapi_config.properties"),
	)
	if err != nil {
		log.Fatal(err)
	}

	httpClient := client.NewHttpClient(cfg)
	qc := quote.NewQuoteClient(httpClient)

	// Get US market status
	states, err := qc.MarketState("US")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println("US market state:", string(states))

	// Get real-time quotes for two symbols
	briefs, _ := qc.QuoteRealTime([]string{"AAPL", "TSLA"})
	fmt.Println("Real-time quotes:", string(briefs))

	// Get daily candlestick data
	klines, _ := qc.Kline("AAPL", "day")
	fmt.Println("K-line data:", string(klines))
}

Basic Quotes

MarketState

func (qc *QuoteClient) MarketState(market string) ([]byte, error)

Returns the current trading session status for the specified market.

ParameterTypeRequiredDescription
marketstringYesMarket code: US, HK, CN, SG

Returns: JSON array of market state objects with fields market, status, openTime, closeTime.

states, err := qc.MarketState("US")
// states: [{"market":"US","status":"Trading","openTime":"09:30","closeTime":"16:00"}]

Data Example

Request parameters:

{ "market": "US" }

Response data:

[
  {
    "market": "US",
    "status": "trading",
    "openTime": 1735020600000,
    "closeTime": 1735044000000,
    "timezone": "America/New_York"
  }
]

QuoteRealTime

func (qc *QuoteClient) QuoteRealTime(symbols []string) ([]byte, error)

Returns real-time snapshot quotes (latest price, bid/ask, volume, change, etc.) for the given symbols.

ParameterTypeRequiredDescription
symbols[]stringYesList of stock symbols, e.g. ["AAPL", "TSLA"]

Returns: JSON array of quote objects.

briefs, err := qc.QuoteRealTime([]string{"AAPL", "TSLA"})

Data Example

Request parameters:

{ "symbols": ["AAPL", "TSLA"] }

Response data:

[
  {
    "symbol": "AAPL",
    "market": "US",
    "name": "Apple Inc.",
    "latestPrice": 227.52,
    "preClose": 225.01,
    "change": 2.51,
    "changePercentage": 1.115,
    "volume": 62345678,
    "amount": 14189233280.0,
    "open": 225.50,
    "high": 228.10,
    "low": 224.80,
    "timestamp": 1735042800000
  },
  {
    "symbol": "TSLA",
    "market": "US",
    "name": "Tesla Inc.",
    "latestPrice": 410.44,
    "preClose": 403.84,
    "change": 6.60,
    "changePercentage": 1.634,
    "volume": 98765432,
    "amount": 40542123456.0,
    "open": 405.00,
    "high": 415.20,
    "low": 402.30,
    "timestamp": 1735042800000
  }
]

Kline

func (qc *QuoteClient) Kline(symbol, period string) ([]byte, error)

Returns historical OHLCV candlestick data for the specified symbol and period.

ParameterTypeRequiredDescription
symbolstringYesStock symbol, e.g. "AAPL"
periodstringYesBar period: day, week, month, 1min, 5min, 15min, 30min, 60min

Returns: JSON array of OHLCV bar objects with time, open, high, low, close, volume.

// Daily bars
klines, err := qc.Kline("AAPL", "day")

// 5-minute intraday bars
klines5m, err := qc.Kline("AAPL", "5min")

Data Example

Request parameters:

{ "symbols": ["AAPL"], "period": "day" }

Response data:

{
  "symbol": "AAPL",
  "period": "day",
  "items": [
    {
      "time": 1734912000000,
      "open": 222.56,
      "high": 225.72,
      "low": 222.11,
      "close": 225.01,
      "volume": 55234100
    },
    {
      "time": 1734998400000,
      "open": 225.50,
      "high": 228.10,
      "low": 224.80,
      "close": 227.52,
      "volume": 62345678
    }
  ]
}

Timeline

func (qc *QuoteClient) Timeline(symbols []string) ([]byte, error)

Returns intraday minute-level price and volume timeline for today's session.

ParameterTypeRequiredDescription
symbols[]stringYesList of stock symbols
timeline, err := qc.Timeline([]string{"AAPL"})

Data Example

Request parameters:

{ "symbols": ["AAPL"] }

Response data:

{
  "symbol": "AAPL",
  "items": [
    {
      "time": 1735020600000,
      "price": 225.50,
      "volume": 3021456,
      "avgPrice": 225.48
    },
    {
      "time": 1735020660000,
      "price": 225.80,
      "volume": 1234567,
      "avgPrice": 225.55
    }
  ]
}

TradeTick

func (qc *QuoteClient) TradeTick(symbols []string) ([]byte, error)

Returns the most recent trade ticks (price, size, timestamp, direction) for the given symbols.

ParameterTypeRequiredDescription
symbols[]stringYesList of stock symbols
ticks, err := qc.TradeTick([]string{"AAPL"})

Data Example

Request parameters:

{ "symbols": ["AAPL"] }

Response data:

{
  "symbol": "AAPL",
  "items": [
    {
      "time": 1735042780000,
      "price": 227.52,
      "volume": 100,
      "direction": "BUY"
    },
    {
      "time": 1735042781000,
      "price": 227.50,
      "volume": 200,
      "direction": "SELL"
    }
  ]
}

QuoteDepth

func (qc *QuoteClient) QuoteDepth(symbol string) ([]byte, error)

Returns Level 2 order book (up to 10 levels of bids and asks) for the specified symbol.

ParameterTypeRequiredDescription
symbolstringYesStock symbol
depth, err := qc.QuoteDepth("AAPL")

Data Example

Request parameters:

{ "symbol": "AAPL" }

Response data:

{
  "symbol": "AAPL",
  "askList": [
    { "price": 227.53, "volume": 300, "orderCount": 2 },
    { "price": 227.55, "volume": 500, "orderCount": 4 },
    { "price": 227.58, "volume": 200, "orderCount": 1 },
    { "price": 227.60, "volume": 800, "orderCount": 6 },
    { "price": 227.65, "volume": 1200, "orderCount": 8 }
  ],
  "bidList": [
    { "price": 227.52, "volume": 400, "orderCount": 3 },
    { "price": 227.50, "volume": 600, "orderCount": 5 },
    { "price": 227.48, "volume": 300, "orderCount": 2 },
    { "price": 227.45, "volume": 700, "orderCount": 5 },
    { "price": 227.40, "volume": 1000, "orderCount": 7 }
  ]
}

Option Quotes

OptionExpiration

func (qc *QuoteClient) OptionExpiration(symbol string) ([]byte, error)

Returns all available option expiration dates for the underlying symbol.

ParameterTypeRequiredDescription
symbolstringYesUnderlying symbol, e.g. "AAPL"
expDates, err := qc.OptionExpiration("AAPL")
// expDates: ["2025-01-17","2025-02-21","2025-03-21",...]

Data Example

Request parameters:

{ "symbols": ["AAPL"] }

Response data:

["2025-01-17", "2025-02-21", "2025-03-21", "2025-06-20", "2025-09-19", "2025-12-19", "2026-01-16"]

OptionChain

func (qc *QuoteClient) OptionChain(symbol, expiry string) ([]byte, error)

Returns the full option chain (all strikes, both calls and puts) for a given expiration date.

ParameterTypeRequiredDescription
symbolstringYesUnderlying symbol
expirystringYesExpiration date in YYYY-MM-DD format
chain, err := qc.OptionChain("AAPL", "2025-01-17")

Data Example

Request parameters:

{ "symbol": "AAPL", "expiry": "2025-01-17" }

Response data:

[
  {
    "strike": 220.0,
    "callSymbol": "AAPL  250117C00220000",
    "putSymbol": "AAPL  250117P00220000",
    "callLatestPrice": 9.50,
    "putLatestPrice": 2.10,
    "callImpliedVolatility": 0.285,
    "putImpliedVolatility": 0.312
  },
  {
    "strike": 225.0,
    "callSymbol": "AAPL  250117C00225000",
    "putSymbol": "AAPL  250117P00225000",
    "callLatestPrice": 6.20,
    "putLatestPrice": 3.80,
    "callImpliedVolatility": 0.278,
    "putImpliedVolatility": 0.299
  }
]

OptionBrief

func (qc *QuoteClient) OptionBrief(identifiers []string) ([]byte, error)

Returns real-time quotes for specific option contracts identified by their OCC-style identifiers.

ParameterTypeRequiredDescription
identifiers[]stringYesOption identifiers, e.g. ["AAPL 250117C00150000"]
optBriefs, err := qc.OptionBrief([]string{"AAPL  250117C00150000"})

Data Example

Request parameters:

{ "identifiers": ["AAPL  250117C00220000"] }

Response data:

[
  {
    "identifier": "AAPL  250117C00220000",
    "latestPrice": 9.50,
    "preClose": 9.10,
    "change": 0.40,
    "impliedVolatility": 0.285,
    "delta": 0.612,
    "gamma": 0.028,
    "theta": -0.085,
    "vega": 0.156,
    "openInterest": 12540,
    "volume": 3820
  }
]

OptionKline

func (qc *QuoteClient) OptionKline(identifier, period string) ([]byte, error)

Returns historical candlestick data for a specific option contract.

ParameterTypeRequiredDescription
identifierstringYesOCC-style option identifier
periodstringYesBar period (same values as Kline)
optKline, err := qc.OptionKline("AAPL  250117C00150000", "day")

Data Example

Request parameters:

{ "identifier": "AAPL  250117C00220000", "period": "day" }

Response data:

{
  "identifier": "AAPL  250117C00220000",
  "period": "day",
  "items": [
    {
      "time": 1734912000000,
      "open": 8.80,
      "high": 9.60,
      "low": 8.70,
      "close": 9.10,
      "volume": 2100
    },
    {
      "time": 1734998400000,
      "open": 9.10,
      "high": 9.80,
      "low": 9.00,
      "close": 9.50,
      "volume": 3820
    }
  ]
}

Futures Quotes

FutureExchange

func (qc *QuoteClient) FutureExchange() ([]byte, error)

Returns the list of supported futures exchanges.

exchanges, err := qc.FutureExchange()
// exchanges: [{"code":"CME","name":"Chicago Mercantile Exchange"},...]

Data Example

Response data:

[
  { "exchange": "CME", "name": "Chicago Mercantile Exchange" },
  { "exchange": "CBOT", "name": "Chicago Board of Trade" },
  { "exchange": "NYMEX", "name": "New York Mercantile Exchange" },
  { "exchange": "HKEX", "name": "Hong Kong Exchanges and Clearing" }
]

FutureContracts

func (qc *QuoteClient) FutureContracts(exchange string) ([]byte, error)

Returns available futures contracts on the specified exchange.

ParameterTypeRequiredDescription
exchangestringYesExchange code, e.g. "CME", "CBOT"
contracts, err := qc.FutureContracts("CME")

Data Example

Request parameters:

{ "exchange": "CME" }

Response data:

[
  {
    "symbol": "ES",
    "name": "E-mini S&P 500",
    "contractMultiplier": 50,
    "currency": "USD",
    "minTick": 0.25,
    "exchange": "CME"
  },
  {
    "symbol": "NQ",
    "name": "E-mini NASDAQ-100",
    "contractMultiplier": 20,
    "currency": "USD",
    "minTick": 0.25,
    "exchange": "CME"
  }
]

FutureRealTimeQuote

func (qc *QuoteClient) FutureRealTimeQuote(symbols []string) ([]byte, error)

Returns real-time quotes for the specified futures contracts.

ParameterTypeRequiredDescription
symbols[]stringYesFutures contract symbols, e.g. ["ES2506"]
futQuotes, err := qc.FutureRealTimeQuote([]string{"ES2506", "NQ2506"})

Data Example

Request parameters:

{ "symbols": ["ES2506", "NQ2506"] }

Response data:

[
  {
    "symbol": "ES2506",
    "latestPrice": 5920.50,
    "preClose": 5895.25,
    "change": 25.25,
    "changePercentage": 0.428,
    "volume": 1234567,
    "openInterest": 2345678,
    "open": 5900.00,
    "high": 5935.00,
    "low": 5895.00,
    "timestamp": 1735042800000
  }
]

FutureKline

func (qc *QuoteClient) FutureKline(symbol, period string) ([]byte, error)

Returns historical candlestick data for a futures contract.

ParameterTypeRequiredDescription
symbolstringYesFutures contract symbol, e.g. "ES2506"
periodstringYesBar period
futKline, err := qc.FutureKline("ES2506", "day")

Data Example

Request parameters:

{ "symbol": "ES2506", "period": "day" }

Response data:

{
  "symbol": "ES2506",
  "period": "day",
  "items": [
    {
      "time": 1734912000000,
      "open": 5870.00,
      "high": 5900.00,
      "low": 5860.00,
      "close": 5895.25,
      "volume": 1023456
    },
    {
      "time": 1734998400000,
      "open": 5900.00,
      "high": 5935.00,
      "low": 5895.00,
      "close": 5920.50,
      "volume": 1234567
    }
  ]
}

Fundamental Data

FinancialDaily

func (qc *QuoteClient) FinancialDaily(symbol string) ([]byte, error)

Returns daily fundamental metrics (P/E ratio, market cap, EPS, etc.) for the specified stock.

daily, err := qc.FinancialDaily("AAPL")

Data Example

Request parameters:

{ "symbol": "AAPL" }

Response data:

[
  {
    "date": "2024-12-24",
    "pe": 38.5,
    "pb": 58.2,
    "eps": 6.52,
    "dividendYield": 0.0044,
    "marketCap": 3420000000000
  }
]

FinancialReport

func (qc *QuoteClient) FinancialReport(symbol string) ([]byte, error)

Returns quarterly and annual financial report data (income statement, balance sheet, cash flow).

report, err := qc.FinancialReport("AAPL")

Data Example

Request parameters:

{ "symbol": "AAPL" }

Response data:

[
  {
    "period": "2024Q4",
    "periodType": "quarterly",
    "revenue": 124300000000,
    "netIncome": 36330000000,
    "totalAssets": 352583000000,
    "totalLiabilities": 308030000000,
    "cashFlow": 29943000000,
    "eps": 2.40
  }
]

CorporateAction

func (qc *QuoteClient) CorporateAction(symbol string) ([]byte, error)

Returns historical corporate actions including dividends, stock splits, and rights offerings.

actions, err := qc.CorporateAction("AAPL")

Data Example

Request parameters:

{ "symbol": "AAPL" }

Response data:

[
  {
    "actionType": "dividend",
    "exDate": "2024-11-08",
    "payDate": "2024-11-14",
    "amount": 0.25,
    "currency": "USD"
  },
  {
    "actionType": "split",
    "exDate": "2020-08-31",
    "ratio": 4.0,
    "description": "4:1 stock split"
  }
]

Capital Flow

CapitalFlow

func (qc *QuoteClient) CapitalFlow(symbol string) ([]byte, error)

Returns net capital inflow/outflow data segmented by trade size (retail vs. institutional).

flow, err := qc.CapitalFlow("AAPL")

Data Example

Request parameters:

{ "symbol": "AAPL" }

Response data:

{
  "symbol": "AAPL",
  "inflow": 8234567890,
  "outflow": 7123456789,
  "netInflow": 1111111101,
  "largeOrderInflow": 5123456789,
  "largeOrderOutflow": 4012345678,
  "mediumOrderInflow": 2012345678,
  "smallOrderInflow": 1098765432,
  "timestamp": 1735042800000
}

CapitalDistribution

func (qc *QuoteClient) CapitalDistribution(symbol string) ([]byte, error)

Returns the distribution of buy/sell orders across different order-size tiers.

dist, err := qc.CapitalDistribution("AAPL")

Data Example

Request parameters:

{ "symbol": "AAPL" }

Response data:

{
  "symbol": "AAPL",
  "retailBuyRatio": 0.18,
  "retailSellRatio": 0.15,
  "institutionBuyRatio": 0.42,
  "institutionSellRatio": 0.38,
  "largeholderBuyRatio": 0.40,
  "largeholderSellRatio": 0.47,
  "timestamp": 1735042800000
}

Market Scanner

MarketScanner

func (qc *QuoteClient) MarketScanner(params map[string]interface{}) ([]byte, error)

Scans the market and returns stocks matching the given filter criteria.

ParameterTypeRequiredDescription
paramsmap[string]interfaceYesFilter criteria including market and filter array

Common filter fields: marketCap, volume, changeRatio, pe, eps, dividend.

scanResult, err := qc.MarketScanner(map[string]interface{}{
	"market": "US",
	"filter": []map[string]interface{}{
		{"fieldName": "marketCap", "filterMin": 1000000000},
		{"fieldName": "volume", "filterMin": 500000},
	},
	"sortFieldName": "marketCap",
	"sortDir":       "desc",
})

Data Example

Request parameters:

{
  "market": "US",
  "filter": [
    { "fieldName": "marketCap", "filterMin": 1000000000 },
    { "fieldName": "changePercentage", "filterMin": 2.0 }
  ]
}

Response data:

[
  {
    "symbol": "AAPL",
    "name": "Apple Inc.",
    "latestPrice": 227.52,
    "changePercentage": 1.115,
    "marketCap": 3420000000000,
    "volume": 62345678
  },
  {
    "symbol": "NVDA",
    "name": "NVIDIA Corporation",
    "latestPrice": 138.85,
    "changePercentage": 3.240,
    "marketCap": 3390000000000,
    "volume": 185432100
  }
]

GrabQuotePermission

func (qc *QuoteClient) GrabQuotePermission() ([]byte, error)

Returns the current account's market data subscription permissions and the list of authorized markets/data types.

perm, err := qc.GrabQuotePermission()

Data Example

Response data:

["US_BASIC", "HK_BASIC", "US_REALTIME"]