# Get global market status

get_global_state()

  • Description

    Get global status

  • Return

    Field Type Description
    ret RET_CODE Interface result.
    data dict If ret == RET_OK, global status is returned.
    str If ret != RET_OK, error description is returned.
    • Global status format as follows:
      Field Type Description
      market_sz MarketState Shenzhen market state.
      market_sh MarketState Shanghai market state.
      market_hk MarketState Hong Kong market status.
      market_hkfuture MarketState Hong Kong futures market status.
      market_usfuture MarketState US futures market status.
      market_us MarketState United States market state.
      market_sgfuture MarketState Singapore futures market status.
      market_jpfuture MarketState Japanese futures market status.
      server_ver str OpenD version number.
      trd_logined bool True: Logged into the trading server, False: Not logged into the trading server.
      qot_logined bool True: logged into the market server, False: Not logged into the market server.
      timestamp str Current Greenwich timestamp.
      local_timestamp float Local timestamp for OpenD.
      program_status_type ProgramStatusType Current status.
      program_status_desc str Additional description.
  • Example

from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
print(quote_ctx.get_global_state())
quote_ctx.close() # After using the connection, remember to close it to prevent the number of connections from running out
1
2
3
4
  • Output
(0, {'market_sz': 'REST', 'market_us': 'AFTER_HOURS_END', 'market_sh': 'REST', 'market_hk': 'MORNING', 'market_hkfuture': 'FUTURE_DAY_OPEN', 'market_usfuture': 'FUTURE_OPEN', 'market_sgfuture': 'FUTURE_DAY_OPEN', 'market_jpfuture': 'FUTURE_DAY_OPEN', 'server_ver': '504', 'trd_logined': True, 'timestamp': '1620963064', 'qot_logined': True, 'local_timestamp': 1620963064.124152, 'program_status_type': 'READY', 'program_status_desc': ''})
1