question

Upvotes
Accepted
3 0 0 2

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 512.0 KiB each and 1.0 MiB total.

1 Answer

Upvotes
Accepted
47.2k 109 44 60

@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 512.0 KiB each and 1.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".