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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials |  Articles

question

Upvotes
Accepted
1 0 0 3

ek.get_timeseriesで複数銘柄のデータ取得における、取得期間不足の問題

pythonにおいて、下記プログラムで日経225の構成銘柄のデータを期間2017-01-01 ~ 2021-02-18で同時に取得した所、期間2017-01-01 ~ 2021-02-01のデータが取得できませんでした。
この原因はなんでしょうか? また、どのように改善を行えばよろしいでしょうか?


app = ''

import eikon as ek

import numpy as np

import pandas as pd

from tqdm.auto import tqdm


ek.set_app_key(app)


target_data_code = ek.get_data(['0#' + '.N225'],fields = 'DSPLY_NMLL')

code = list(target_data_code[0]["Instrument"]); code.sort()


data=ek.get_timeseries(code,start_date = '2017-01-01', end_date = '2021-02-18')

キャプチャ.PNG

eikoneikon-data-apiworkspaceworkspace-data-apirefinitiv-data-platform-eikon
キャフチャ.png (18.5 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
Accepted
1.7k 2 4 7

hello @tomoya.suzuki.lab

There's a limit of the Eikon Data API, for more detail, please check Eikon Data API Usage and Limits Guideline. This case is about "Call-based Limits"

Datapoints returned per request - A datapoint is a 'cell', or a unique field value for a unique instrument on a unique time stamp. Datapoint limits vary by the content set being retrieved (for example, timeseries limits are different from news headline limits), but all are throttled on a per request basis and are not aggregated across all applications. Here are Datapoint limit examples per Eikon Data API function type 
get_timeseries: The current limit value (10-Oct-2019) is 3,000 data points (rows) for interday intervals and 50,000 data points for intraday intervals. This limit applies to the whole request, whatever the number of requested instrument.

the length of the list "code" from your code is 225 RICs, and there're 13 rows of the date in the output (mean there's 225 * 13 = 2925 rows returned)

qna-001.png


To get the data of all the dates, you may loop the request and merge the output datasets together later. Each loop can either loop through the RIC list or date list.

For example, to loop through the RIC list,

  • get the maximum number of RIC that can be called in a request 3000, divided by the number of dates you'd like to request the data
    • for 2017-01-01 and 2021-02-18, there are 1510 dates
    • 3000/1510 = 1 so only 1 RIC can be called per the request
  • below is an example code to get data and merge the output data frames of the first 3 RICs
df = ek.get_timeseries(code[0],start_date = '2017-01-01', end_date = '2021-02-18')
df = df.add_prefix(f'{code[0]}_')

for _ in code[1:3]:
    df_temp = ek.get_timeseries(_,start_date = '2017-01-01', end_date = '2021-02-18')
    df_temp = df_temp.add_prefix(f'{_}_')
    df = df.merge(df_temp, how='outer', on='Date')
display(df)

Hope this could help


qna-001.png (2.1 KiB)
qna-002.png (63.3 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
1 0 0 3

ご回答ありがとうございました。
参考にさせていただきます。

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
23k 22 9 14

Hello @tomoya.suzuki.lab and all,

Per Google translate "Thank you for your answer. I am going to use it as an example." I am marking answer by @raksina.samasiri as correct in answering the question.

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