# Get Event Contract Category

get_event_contract_category(category=None)

  • Description

    Get the top-level categories of event contracts and their sub-tags. Optionally filter by a top-level category.

  • Parameters

    Parameter Type Description
    category str Top-level category identifier, optional, e.g. 'Sports'; if set, only that category is returned
  • Return

    Parameter Type Description
    ret RET_CODE API call result
    data pd.DataFrame If ret == RET_OK, the category list is returned
    str If ret != RET_OK, an error description is returned

    The DataFrame fields are as follows:

    Field Type Description
    category str Top-level category identifier (e.g. "Sports", "Elections")
    category_name str Localized name of the top-level category
    tags list List of sub-category identifier strings (e.g. ["Soccer", "Baseball", "Golf"])
  • Example

from moomoo import *

quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
# Get only the Sports category
ret, data = quote_ctx.get_event_contract_category('Sports')
if ret == RET_OK:
    print(data)
else:
    print('error:', data)
quote_ctx.close()
1
2
3
4
5
6
7
8
9
10
  • Output
  category category_name                                               tags
0  Sports          Sports  [Soccer, Baseball, Golf, Motorsport, Tennis, Basketball, Football, MMA, Esports, Cricket, Hockey, Boxing]
1
2

Interface Limitations

  • Up to 10 requests per 30 seconds for the event contract category interface