question

Upvotes
Accepted
3 0 0 1

Historic beta in DSWS Python API

Hi,
I'm trying to pull the historic beta timeseries of a stock using the Datastream API in Python.

In Excel I use this function:
=@DSGRID("TW:TSM","897E","2010-01-01","2020-01-01","M","RowHeader=true;TimeSeriesList=true;ColHeader=true;DispSeriesDescription=false;YearlyTSFormat=false;QuarterlyTSFormat=false","")

In Python I tried:
data = ds.get_data(tickers = "TW:TSM", fields = ["897E"], start = "2010-01-01", end = "2020-01-01", freq = "M")

But I get:
"$$ER: E100,INVALID CODE OR EXPRESSION ENTERED"


1636683732640.png


Appreciate your advice. Thanks!

datastream-apipython apibeta
1636683732640.png (16.6 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

1 Answer

Upvotes
Accepted
38.1k 71 35 53

@brendan.kermorvan

Please try this one below.

ds.get_data(tickers="897E(TW:TSM)",  start = "2010-01-01", end = "2020-01-01", freq = "M")
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 5.0 MiB each and 10.0 MiB total.

Works perfectly thank you! Could you please explain why in this case the field name has to be passed in "tickers" and not "fields"?

@brendan.kermorvan

You can contact the Refinitiv Datastream Web Service support team directly via MyRefiniiv to verify why the 897E can't be passed in "fields".

Click below to post an Idea Post Idea