question

Upvotes
Accepted
1 0 1 0

DSWS MV Not Working

Market Value for tickers is not working even where other functionality works:


The following code:


xxx = ds.get_data(tickers= '@AMZN', fields = "MV",start=str(start), end =str(end), freq = 'D')


returns:


Would be very grateful for advice on this.


Thank you in advance


datastream-apidsws-api
1616460936958.png (6.9 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

Upvote
Accepted
39.2k 75 11 27

In get_data method the "fields" kwarg must be a Python list. When you provide a multi-character string (like "MV") instead of a list, the string is converted to the list of characters (resulting in ['M','V']). Since both 'M' and 'V' are invalid Datastream datatypes, you get the error "$$ER: E100,INVALID CODE OR EXPRESSION ENTERED". Use

ds.get_data(tickers='@AMZN', fields=['MV'], start=str(start), end=str(end), freq='D')
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.

Thank you very much

Click below to post an Idea Post Idea