Skip to main content

Get Option Chain Expiry Date List

This API is used to obtain the the list of expiration dates of option chain

SDK Links

Python
longport.openapi.QuoteContext.option_chain_expiry_date_list
Rust
longport::quote::QuoteContext#option_chain_expiry_date_list
Go
QuoteContext.OptionChainExpiryDateList
Node.js
QuoteContext#optionChainExpiryDateList

Request

Parameters

NameTypeRequiredDescription
symbolstringYesSecurity code, in ticker.region format, for example:700.HK

Protobuf

message SecurityRequest {
string symbol = 1;
}

Request Example

# Get Option Chain Expiry Date List
# https://open.longportapp.com/docs/quote/pull/optionchain-date
# Before running, please visit the "Developers to ensure that the account has the correct quotes authority.
# If you do not have the quotes authority, you can enter "Me - My Quotes - Store" to purchase the authority through the "LongPort" mobile app.
from longport.openapi import QuoteContext, Config

config = Config.from_env()
ctx = QuoteContext(config)

resp = ctx.option_chain_expiry_date_list("AAPL.US")
print(resp)

Response

Response Properties

NameTypeDescription
expiry_datestring[]option chain expiry dates list,in YYMMDD format

Protobuf

message OptionChainDateListResponse {
repeated string expiry_date = 1;
}

Response JSON Example

{
"expiry_date": [
"20220422",
"20220429",
"20220506",
"20220513",
"20220520",
"20220527",
"20220603",
"20220617",
"20220715",
"20220819",
"20220916",
"20221021",
"20221118",
"20230120",
"20230317",
"20230616",
"20230915",
"20240119",
"20240621"
]
}

Error Code

Protocol Error CodeBusiness Error CodeDescriptionTroubleshooting Suggestions
3301600Invalid requestInvalid request parameters or unpacking request failed
3301606Request rate limitReduce the frequency of requests
7301602Server errorPlease try again or contact a technician to resolve the issue
7301600Symbol not foundCheck that the requested symbol is correct