Skip to content

Market State

POST /api/v1.0/quote/market-state

Get the current market state (open / closed / pre-market / after-hours / overnight / closing auction, etc.) for a batch of symbols. Useful for determining quote availability and freshness.

Parameters

NameTypeInRequiredDescription
code_liststring[]bodyyesList of symbol codes in {market}.{code} format, e.g. ["HK.00700","US.AAPL","SH.600519"]. Market prefix is required. Max 400 per batch.
is_contain_baboolbodynoWhether to include US pre-market/after-hours sessions; true switches trade_section to the next trading day's schedule once pre/after-hours begins. Default false. Only affects US-related entries.
is_contain_overnightboolbodynoWhether to include US overnight session; true switches trade_section to the next trading day's schedule once overnight begins. Default false. Only affects US-related entries.
is_need_crypto_multi_brokerboolbodynoWhether to return multi-broker data for crypto market; true expands multiple records per market_id by broker. Default false. Only affects CC. prefix entries.

Request Example

bash
curl -X POST 'https://webapi.moomoo.com/api/v1.0/quote/market-state' \
  -H 'Content-Type: application/json' \
  -d '{"code_list":["HK.00700","US.AAPL","SH.600519","SZ.000001"]}' | jq

Response Fields

Returns data.market_state_list[], with elements as follows.

FieldTypeDescription
codestringSymbol code, e.g. HK.00700, echoed from the request
stock_namestringEnglish stock name (from local security cache); omitted for unsupported markets or unlisted securities.
sc_namestringSimplified Chinese name.
tc_namestringTraditional Chinese name.
market_statestringMarket state enum (string). See Naming Dictionary > market_state
time_datestringTrading date for the market, format YYYY-MM-DD HH:MM:SS (Beijing timezone). Omitted when not provided by backend
traded_secondsintSeconds already traded in current session. Omitted when not provided by backend
total_secondsintTotal seconds of current trading session. Omitted when not provided by backend
trade_sectionarrayTrading session slices for the day; elements contain trade_section_type (int, see Naming Dictionary > trade_section_type), begin_time / end_time (Beijing timezone HH:MM:SS). Omitted when not provided by backend
broker_idintOnly returned for crypto + is_need_crypto_multi_broker=true; identifies the broker for this record
broker_idsint[]Returned for crypto aggregated quotes; lists all broker IDs under that market_id

Supported Markets

  • Code must use a supported market prefix from the 11 markets listed below; otherwise returns invalid_symbol: HK (Hong Kong) / US (United States) / SH (Shanghai A-shares) / SZ (Shenzhen A-shares) / BJ (Beijing Stock Exchange) / SG (Singapore) / JP (Japan) / CA (Canada) / AU (Australia) / SH_FX (Shanghai-Shenzhen FX) / CC (Crypto).
  • Unsupported market prefixes (not limited to): DE Germany, FR France, GB UK, MY Malaysia, TH Thailand, ID Indonesia, VN Vietnam, NZ New Zealand, NL Netherlands, PT Portugal, IT Italy.
  • For unsupported markets: the corresponding entry retains the requested code, market_state returns "NONE", extended fields are omitted; does not affect other valid symbols in the same batch.
  • Max code_list length is 400; exceeding or empty array returns invalid_parameter.
  • Market prefix is required; missing prefix (e.g. "00700") triggers invalid_parameter.

Error Codes

ret_codeerror.codeTrigger ConditionRecommended Action
0Success, data.market_state_list length equals request code_list lengthIterate market_state_list, match by code to your requested symbols
-3invalid_parametercode_list missing / element type not string / list empty / length exceeds 400 / element missing market prefixFix request body, ensure {market}.{code} format
-5backend_biz_errorQTA backend returned non-zero business error (rare)Read error.message for details; may retry
-2 / -4 / -6internal_errorGateway routing / body construction / response conversion exceptionRetain x-trace-id and report to gateway team

Response Example

json
{
  "ret_code": 0,
  "ret_msg": "success",
  "data": {
    "market_state_list": [
      { "code": "HK.00700", "market_state": "AFTERNOON", "stock_name": "腾讯控股" },
      { "code": "US.AAPL", "market_state": "AFTER_HOURS_END", "stock_name": "苹果" },
      { "code": "SH.600519", "market_state": "AFTERNOON", "stock_name": "贵州茅台" },
      { "code": "SZ.000001", "market_state": "AFTERNOON", "stock_name": "平安银行" }
    ]
  }
}