For a deeper look into our Eikon Data API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 2 1 4

Eikon api server error

hi, this code is failing with this error:

2021-07-29 17:44:48,859 P[10512] [MainThread 1676] UDF Core request failed. Gateway Time-out
2021-07-29 17:44:48,861 P[10512] [MainThread 1676] HTTP request failed: EikonError-UDF Core request failed. Gateway Time-out


from this code snippet

rics = ["0#SPXW*.U"]
fields = ['BID','ASK','TIMACT',"CF_LAST","PRIMACT_1"]
results = list()
temprics = rics
errors = 0
while rics:
    try:
        temp,e = ek.get_data(temprics[-1],fields)
        results.append(temp)
        print("probably succeeded:  " + str(temprics[-1]) )
        temprics.pop()
    except:
        print("certainly failed:  " + str(temprics[-1]) )
        errors += 1
        if errors >=2:
            temprics.pop()
            errors = 0
            print("gave up on that last one")
res = pd.concat(results)   
eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-dataplatform-eikon
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvote
Accepted
39.2k 75 11 27

@opsp

Thank you for describing your use case. For your purposes I would recommend using RDP Search service to retrieve the list of options RICs, break the list of RICs into chunks, and retrieve snapshot market data for each chunk in a loop.
RDP Search service is a lot faster than traversing the chain, and it offers a lot of flexibility over what you can retrieve. E.g. if you don't need the whole SPXW chain, and you're only interested in weeklies, you can get them by adding "PeriodicityCode eq "W"' to the search filter. For more info about RDP Search see the article titled Building Search into your Application Workflow. The max number of results you can retrieve from RDP Search in a single query is 10K. To retrieve the whole SPXW chain, in the following example I break the retrieval into two requests: one for calls and one for puts to ensure that the result set for each query is under 10K.

today_str = dt.datetime.today().strftime('%Y-%m-%d')
df = rdp.search(view=rdp.SearchViews.EquityDerivativeQuote
          filter = f"OptionStub eq 'SPXW.U' and ExpiryDate ge {today_str} and CallPutOption eq 'Call'",
          select = "RIC",
          top = 10000)
calls = df['RIC'].tolist()
df = rdp.search(view=rdp.SearchViews.EquityDerivativeQuote
          filter = f"OptionStub eq 'SPXW.U' and ExpiryDate ge {today_str} and CallPutOption eq 'Put'",
          select = "RIC",
          top = 10000)
puts = df['RIC'].tolist()
options = calls + puts

The length of the returned options list today is 13,640 - exactly the number of constituents in 0#SPWX*.U chain.
Now that I have the list of RICs, I can retrieve snapshot market data. In the example below I do it in chunks of 500 RICs.

fields = ['BID','ASK','TIMACT',"CF_LAST"]
df = pd.DataFrame(columns = ['Instrument'] + fields)
chunk_size = 500
for x in range(0,len(options),chunk_size):
    tmp_df, err = ek.get_data(options[x:x+chunk_size], fields)
    df = df.append(tmp_df)
df.reset_index(drop=True, inplace=True)
df
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Upvotes
39.2k 75 11 27

0#SPXW*.U is an exceptionally long chain with some 13.4K constituents. The Web service that provides snapshot market data to Eikon Data APIs times out this request. If you need to retrieve this chain once-off, I may suggest retrieving the chain constituents into Excel, and then retrieving market data for the constituents using Eikon Data APIs. I don't think you'll be able to retrieve market data for all 13.4K constituents in one request. Most likely you'll need to break the list into chunks and retrieve the data one chunk at a time.
If you need to be able to retrieve chain constituents for 0#SPXW*.U repeatedly, I can think of a workaround you could implement using StreamingPrices interface.

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

pls let me know
Upvotes
1 2 1 4

sadly I need to retrieve the chain regularly. my workflow is quite simple :

1. download an options surface (SPXW options for example)
2. run a few simple calculations
3. trade some of the options.

that I need to use a work-around using a StreamingPrices interface is definitely concerning.

*BUT* as long as it will certainly & comfortably work (and not sometimes work)..,then fine. please propose.

even more concerning is that this has worked every other day I've tried it and then suddenly stopped working today. what's the point of the chain RIC if we can't access it? how do other people get a list of SPX weekly options? am I missing something here?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Click below to post an Idea Post Idea