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:

image


Would be very grateful for advice on this.


Thank you in advance


Best Answer

  • Alex Putkov.1
    Alex Putkov.1 ✭✭✭✭✭
    Answer ✓

    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')

Answers