question

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

1 Answer

· Write an Answer
Upvote
Accepted
39.4k 77 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 512.0 KiB each and 1.0 MiB total.

Thank you very much

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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