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
1 1 3 6

How to get fx rate for a particular snaptime and date (london timezone)

Hi All, i am currently using the below piece of code to get fx rate using eikon API but it gives me the latest fx rate for the given ric, say I want to know fx rate for a specific timezone and date, how can I retrieve it ?


ek.set_app_key('************')
df, err = ek.get_data(
   ['JPY='],['TR.RIC','BID','ASK']
)
df['Mid']=df.mean(axis=1)
print(df)
eikoneikon-data-apipython 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.

Hello @Atul.Sanwal

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?


If so please can you click the 'Accept' text next to the appropriate reply? This will guide all community members who have a similar question.

Thanks,


AHS

@Atul.Sanwal

Hi,

Please be informed that a reply has been verified as correct in answering the question, and marked as such.

Thanks,

AHS

Upvote
Accepted
22.1k 59 14 21

You can look into get_timeseries API call to get granular timeseries data. The bar data can be rolled up into minutes using:

df = ek.get_timeseries("JPY=", count = 5, start_date = "2022-05-12T15:00:00", interval="minute")

other option for minutes parameter are:

'tick', 'minute', 'hour', 'daily', 'weekly', 'monthly', 'quarterly', 'yearly'


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
22.1k 59 14 21

Hi @Atul.Sanwal,

The Eikon API only provides data in UTC. For other timezones, you will have to convert the local timezone into UTC before requesting the data.

To get a data point at a particular point-in-time, use the fields which allow history. This can be seen from the Data Item Browser (DIB).

Here is an example:

df, err = ek.get_data(['JPY='],['TR.ASKPRICE', 'TR.BIDPRICE', 'TR.ASKPRICE.Timestamp'], {'SDate': '2022-05-01'})
display(df)

Response:

1652387066769.png


1652387066769.png (6.9 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.

Hi Gurpreet, Thanks for the help, sorry a bit confused how can i search the fx rate based on UTC timezone, where do i need to input the timestamp ? say i want to see UTC 15:00:00 for 12th May
Upvotes
1 1 3 6
df, err = ek.get_data(['JPY='],['TR.ASKPRICE', 'TR.BIDPRICE', 'TR.ASKPRICE.Timestamp'], {'SDate': '2022-05-12T15:00:00'})

i tried the above but getting NAN values
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.