Replies: 3 comments 7 replies
-
bit more info, the option root id should be 128. |
Beta Was this translation helpful? Give feedback.
0 replies
-
current workaround seems ok i guess import saxo_openapi.endpoints.referencedata as rd
def return_uic_option(OptionRootId, strike, put_call, expiration):
params = {
"ExpiryDates": expiration,
"OptionSpaceSegment": "SpecificDates",
}
r = rd.instruments.ContractoptionSpaces(
OptionRootId=OptionRootId,
params=params)
response = client.request(r)
for option_space in response.get('OptionSpace'):
if option_space['Expiry'] == expiration:
for specific_option in option_space.get('SpecificOptions'):
if specific_option['PutCall'] == put_call and specific_option['StrikePrice'] == strike:
return specific_option
OptionRootId = 128
strike = 5130
put_call = 'Put'
expiration = '2024-03-05'
return_uic_option(OptionRootId, strike, put_call, expiration)
# {'PutCall': 'Put',
# 'StrikePrice': 5130.0,
# 'TradingStatus': 'Tradable',
# 'Uic': 40381718,
# 'UnderlyingUic': 1909049} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
how do i provide the information to
InstrumentToUic
function to get the uic for an option, specifically the instrument information within the spec dictionary?or if there's a way to specify a strike, put/call and expiration to
ContractoptionSpaces
function that would work too i guess.As an example, I'd like to get the uic for the SPXW (note there's a difference between SPXW and SPX) option, asset type is "StockIndexOption", strike of 5130, Put, expiration date of March 5, 2024. The underlying uic is 1909049.
Any help is appreciated.
Beta Was this translation helpful? Give feedback.
All reactions