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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
16 0 0 1

I'm trying to download Price close of MSCI europe index and MSCI quality index


I cannot post the screenshot. There are missing data from 2002 in MSCI Europe Index(.dMIEU00000PUS) but I checked and there are prices from 2001. Moreover, I downloaded and I saw that the price is fixed at 1317 in 2002,why?



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.

Upvotes
Accepted
6.7k 8 6 7

@damiano.amendola the reason you are seeing this is that there is an API call limit of 3000 interday rows for the Timeseries API. When the API hits this limit it silently fails and returns a max of 3000 most recent rows. So you can get around this limitation using iteration with the following code i wrote:

from dateutil import parser
from datetime import timedelta
from datetime import datetime
import math
import time
def date_range(start, end, intv):
    start = datetime.strptime(start,"%Y-%m-%d")
    end = datetime.strptime(end,"%Y-%m-%d")
    diff = (end  - start ) / intv
    for i in range(intv):
        yield (start + diff * i).strftime("%Y-%m-%d")
    yield end.strftime("%Y-%m-%d")
def get_daily(rics,fields,start,end):
    for ric in rics:        
        interval = math.ceil((parser.parse(end) - parser.parse(start)).days / 3000)
        l = list(date_range(start,end,interval))
        df1 = pd.DataFrame()
        df = pd.DataFrame()
        for i in range(interval):
            ts = ek.get_timeseries(rics=ric,fields=fields, start_date=l[0+i],end_date=l[1+i], interval='daily')
            df = df.append(ts)
            time.sleep(0.4)


    return df

So now we have our function defined we can simply call it with your RIC:

rics = ['.dMIEU00000PUS'] # Just for one ric at the moment I will extend this for multi-ric
fields = ['OPEN', 'HIGH', 'LOW', 'CLOSE']
start = '1999-01-02'
end = '2018-06-04'
df = get_daily(rics,fields,start,end)
df


1624961413243.png


I hope this can help.


1624961413243.png (92.0 KiB)
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
38.1k 69 35 53

@damiano.amendola

I have tested with the below code.

df, err = ek.get_data(
instruments=['.dMIEU00000PUS'],
fields=[
"TR.CLOSEPRICE","TR.CLOSEPRICE.Date"
],
parameters={'SDate': '2001-01-01', 'EDate': '2002-12-31'},
)
df

The output is:

1624960064844.png

I assume that you are using the TR.PriceClose field.

I got the same result as yours via Eikon Excel.

1624960405235.png

You need to contact the Eikon Excel support team via MyRefinitiv to verify the problem.


1624960064844.png (31.5 KiB)
1624960405235.png (89.4 KiB)
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
16 0 0 1

Thank you so much, it was really useful.

Yes, I was using TR.PriceClose.

Have a nice day

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
16 0 0 1

Thank you so much for your collaboration. You helped me a lot

Have a nice day

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