question

Upvotes
Accepted
7 3 2 5

How to pull index data from Datastream in Python?

For example, I want to pull the price of Hang Seng Index which the ric is ".HSI".

I can use the ric to pull price from Eikon, but I can't pull from datastream.
datastream-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.

1 Answer

· Write an Answer
Upvotes
Accepted
80.1k 257 52 75

@Ren

To use a RIC in the Datastream, you need to embrace it with angle brackets <>.

ds.get_data(tickers='<.HSI>', fields=['PI','PE'], kind=0)

The output is:

1644812259598.png

To list all available fields, please refer to the Datastream Navigator website.


1644812259598.png (12.5 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.

Oh.. I used the wrong field "P" to try to pull the index price.

Thank you!

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.