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.
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.