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)
Best Answer
-
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 + putsThe 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)
df1
Answers
-
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.0 -
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?
0 -
pls let me know0
Categories
- All Categories
- 6 AHS
- 38 Alpha
- 161 App Studio
- 4 Block Chain
- 4 Bot Platform
- 16 Connected Risk APIs
- 47 Data Fusion
- 30 Data Model Discovery
- 608 Datastream
- 1.3K DSS
- 577 Eikon COM
- 4.9K Eikon Data APIs
- 7 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- Trading API
- 2.7K Elektron
- 1.3K EMA
- 236 ETA
- 519 WebSocket API
- 33 FX Venues
- 10 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 20 Messenger Bot
- 2 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 59 Open Calais
- 264 Open PermID
- 39 Entity Search
- 2 Org ID
- PAM
- PAM - Logging
- 8.4K Private Comments
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 20 RDMS
- 1.4K Refinitiv Data Platform
- 367 Refinitiv Data Platform Libraries
- 3 Refinitiv Due Diligence
- LSEG Due Diligence Portal API
- 3 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.1K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 10 World-Check Customer Risk Screener
- 990 World-Check One
- 44 World-Check One Zero Footprint
- 45 Side by Side Integration API
- Test Space
- 3 Thomson One Smart
- 1.2K TR Internal
- Global Hackathon 2015
- 2 Specialists Who Code
- 10 TR Knowledge Graph
- 150 Transactions
- 142 REDI API
- 1.7K TREP APIs
- 4 CAT
- 21 DACS Station
- 117 Open DACS
- 1.1K RFA
- 103 UPA
- 172 TREP Infrastructure
- 224 TRKD
- 886 TRTH
- 5 Velocity Analytics
- 5 Wealth Management Web Services
- 59 Workspace SDK
- 9 Element Framework
- 5 Grid
- 13 World-Check Data File
- Yield Book Analytics
- 46 中文论坛