I looked up a similar question to mine on the developer community, and the best solution proposed was dividing the list of symbols into 100. Is there a more efficient way to get rid of this error?
I am trying to use "get_symbology" to get RIC codes based on a list of 9200 ISINs.
My code and the full error below:
RICs, err= ek.get_symbology(list(ISIN_List), from_symbol_type="ISIN", to_symbol_type= "RIC")
EikonError: Error code 413 | Client Error: <!DOCTYPE html><html><head><title></title><link rel="stylesheet" href="/stylesheets/style.css"></head><body><h1>request entity too large</h1><h2>413</h2><pre>Error at readStream (/Applications/Eikon API Proxy.app/Contents/Resources/app.asar/node_modules/raw-body/index.js:196:17) at getRawBody (/Applications/Eikon API Proxy.app/Contents/Resources/app.asar/node_modules/raw-body/index.js:106:12) at read (/Applications/Eikon API Proxy.app/Contents/Resources/app.asar/node_modules/body-parser/lib/read.js:76:3) at jsonParser (/Applications/Eikon API Proxy.app/Contents/Resources/app.asar/node_modules/body-parser/lib/types/json.js:127:5) at Layer.handle [as handle_request] (/Applications/Eikon API Proxy.app/Contents/Resources/app.asar/node_modules/express/lib/router/layer.js:95:5) at trim_prefix (/Applications/Eikon API Proxy.app/Contents/Resources/app.asar/node_modules/express/lib/router/index.js:317:13) at /Applications/Eikon API Proxy.app/Contents/Resources/app.asar/node_modules/express/lib/router/index.js:284:7 at Function.process_params (/Applications/Eikon API Proxy.app/Contents/Resources/app.asar/node_modules/express/lib/router/index.js:335:12) at next (/Applications/Eikon API Proxy.app/Contents/Resources/app.asar/node_modules/express/lib/router/index.js:275:10) at logger (/Applications/Eikon API Proxy.app/Contents/Resources/app.asar/node_modules/morgan/index.js:144:5)</pre></body></html>
Hi @Erik77 - thanks for your question. Yes an instrument list of 9200 ISINs will be too large for the API to handle at once. Please be aware of the data limits of the APIs by looking at the document here. You can try chunking the list into smaller pieces (lets say 100 ISINs) and presenting each chunk to the API. You need to pip install pydash first. You can chunk your list using:
from pydash.arrays import chunk chunklist = chunk(ISIN_list, 100) chunklist
and then present each chunk of 100 ISINs to the API.
I hope this can help
Thanks @jason.ramchandi . The code you shared seems to work. But I am still not getting the desired results. See below:
RICs, err= ek.get_symbology(chunklist, from_symbol_type="ISIN", to_symbol_type= "RIC")
Any suggestions as to why it returns the string 'RIC', as opposed to a DF with the RIC's for the 100 ISIN's on the list?
@Erik77 you need to drop the err on your api call (that is only used in get_data api call) - see code below:
RICs = ek.get_symbology(['GB00BH4HKS39','US88160R1014'], from_symbol_type="ISIN", to_symbol_type= "RIC") RICs
I hope this can help.