question

Upvotes
Accepted
7 1 0 6

Relative stock price vs index performance

Is there an API that returns historical(2 years) stock price(e.g Barclays) vs index(e.g FTSE) relative price performance data?

I want to create a comparative chart hence need data via API.

datastream-apidsws-apidatastream
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

Upvotes
Accepted
56.3k 145 45 65

@vishal.kak

You can use the Datastream DSWS to retrieve historical data. The code looks like this:

ds.get_data(tickers='BARC,FTALLSH', start='-2Y', kind=1)

It returns daily historical prices for 2 years of Barclays and FTSE ALL SHARE.

You can access the Datastream navigator to search for instruments and data types used in the DatastreamDSWS.


1622197963810.png (18.4 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.