# Get Option Expiration Date

get_option_expiration_date(code, index_option_type=IndexOptionType.NORMAL)

  • Description

    Query all expiration dates of option chains through the underlying stock. To obtain the complete option chain, please use it in combination with Get Option Chain.

  • Parameters

    Parameter Type Description
    code str Stock code.
    index_option_type IndexOptionType Index option type.
  • Return

    Field Type Description
    ret RET_CODE Interface result.
    data pd.DataFrame If ret == RET_OK, option expiration date data is returned.
    str If ret != RET_OK, error description is returned.
    • Option expiration date data format as follows:
      Field Type Description
      strike_time str Exercise date.
      option_expiry_date_distance int The number of days from the expiry date.
      expiration_cycle ExpirationCycle Expiration cycle.
  • Example

from moomoo import *
quote_ctx = OpenQuoteContext(host='127.0.0.1', port=11111)
ret, data = quote_ctx.get_option_expiration_date(code='HK.00700')
if ret == RET_OK:
    print(data)
    print(data['strike_time'].values.tolist())  # Convert to list
else:
    print('error:', data)
quote_ctx.close()  # After using the connection, remember to close it to prevent the number of connections from running out
1
2
3
4
5
6
7
8
9
  • Output
  strike_time  option_expiry_date_distance expiration_cycle
0  2021-04-29                            4              N/A
1  2021-05-28                           33              N/A
2  2021-06-29                           65              N/A
3  2021-07-29                           95              N/A
4  2021-09-29                          157              N/A
5  2021-12-30                          249              N/A
6  2022-03-30                          339              N/A
['2021-04-29', '2021-05-28', '2021-06-29', '2021-07-29', '2021-09-29', '2021-12-30', '2022-03-30']
1
2
3
4
5
6
7
8
9

Interface Limitations

  • A maximum of 60 requests per 30 seconds