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
Accepted
3 0 0 0

using variables in get_data

Hello developer community,

i have been looking for the answer to the question on this site and other places, but was not successful and need your help.

this is my question. I have an ISIN code and need TR.FundNAV.

ek_data, err = ek.get_data('LU1725405200' , ['TR.FundNAV.Date','TR.FundNAV'], \

{'Frq':'D', 'SDate': '2021-03-20', 'EDate': '2021-03-21'})

this works perfectly ok.

I need to change ISIN code, start date and end date in several ways, and wanted to use variables, like below.(givenisin, startdte, enddate are variables)


ek_data, err = ek.get_data(givenisin , ['TR.FundNAV.Date','TR.FundNAV'], \

{'Frq':'D', 'SDate': startdate, 'EDate': enddate})

but variables for startdate and enddate are not able to extract in get_data command. the variable givenisin works ok.




how can i express these startdate/enddate parameters in variables?

thanks,

--Shin

eikoneikon-data-apipythonrefinitiv-dataplatform-eikonworkspaceworkspace-data-api
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
Accepted
78.9k 250 52 74

@shinji.kakizaki1

The following code works in my environment.

givenisin = 'LU1725405200'
startdate =  '2021-02-20'
enddate =  '2021-03-21'
ek_data, err = ek.get_data(givenisin , 
                           ['TR.FundNAV.Date','TR.FundNAV'], 
                           {'Frq':'D', 'SDate': startdate, 'EDate': enddate})

ek_data


1616575005453.png (23.8 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
3 0 0 0

Hi @jirapongse.phuriphanvichai thanks for quick response.

you are rt. i tested the lines u gave me, and it worked on my console.

what I found was i got startdate and enddate value from sql result and it needs to be converted as "date" type. dont really know why startdate = ''2021-03-20' works and queried date does not work, but i know have script working.


Thanks!!!!

--Shin

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.