Upgrade from Eikon -> Workspace. Learn about programming differences.

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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
1 0 0 1

Help on SEDOL to RIC Conversion

API - EIkon

Language - Python

Environment - Windows

I converted some 5000 stocks SEDOLS into RIC. I got all the RIC. Named it RIC1

ric1=pd.DataFrame(ek.get_symbology(sedols1, from_symbol_type='SEDOL', to_symbol_type=['RIC']))


Than I converted all the RIC into string by the function……. list3=ric1["RIC"].astype(str).tolist().

Print( list3)

All the RICs came on screen.


Than ran the function . & got the below error


ek.get_timeseries('list3',
fields='CLOSE',
start_date='2024-08-21',
end_date='2024-08-22')


image002-3.png

eikon-data-apipythonworkspace#technology
image002-3.png (52.6 KiB)
icon clock
10 |1500

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

Upvote
84.9k 289 53 77

@Sachin Murthy S K

Thank you for reaching out to us.

The code should be like this:

ek.get_timeseries(list3,
   fields='CLOSE',    start_date='2024-08-21',    end_date='2024-08-22')

The get_timeseries method has limitations. Please check the Eikon Data API Usage and Limits Guideline.

You can use the LSEG Data Library for Python instead. The examples are on GitHub.

icon clock
10 |1500

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

hello @Jirapongse

Thank you for your reply. The data is too large. how do I get API in batches?

What command can i use better. I used the below command it did not work.

1725365586242.png

just to add i am getting ' time series request failed' getting error eikon code -1


1725365810245.png

Upvotes
1 0 0 2

hello @Jirapongse

Thank you for your reply. The data is too large. how do I get API in batches?

What command can i use better. I used the below command it did not work.

1725365586242.png


1725365586242.png (8.4 KiB)
icon clock
10 |1500

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

Upvotes
1 0 0 2

just to add i am getting ' time series request failed' getting error eikon code -1


1725365810245.png


1725365810245.png (30.2 KiB)
icon clock
10 |1500

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

@rupa

You may need to break an array into chunks. Please check this website.

I suggest to use the LSEG Data Library for Python instead. The examples are on GitHub.

HI Jason,

will the below help to break

def batch(iterable:Iterable,max_batch_size:Int):

batch=[]

for element in iterable:

batch.append(element)

if len(batch)>=max_batch_size:

yield batch

batch =[]

if len(batch)>0:

yield batch

The code could be like this:

instruments = ['EQNR.OL' ,'DNB.OL' ,'NHY.OL' ,...]
 
def split_instruments(instruments, chunk_size=5):
    """Yield successive chunk_size chunks from instruments."""
    for i in range(0, len(instruments), chunk_size):
        yield instruments[i:i + chunk_size]
 
instrument_chunks = list(split_instruments(instruments))
for chunk in instrument_chunks:
     data = ek.get_timeseries(chunk, ...)

Upvotes
1 0 0 2

Hi Jason,


I was able to get output in those batches.. thank you v much.

Output is in a dataframe with close price of say day 25th & day 24th. 3200 stocks,

how would you calculate daily return of stocks from that data frame & get returns as an additional column?



Thanks

R



icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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