"Real Estate" economic Sector in Eikon API

Hello,


I am trying to use the Screener in Eikon API in order to not select the 'Real Estate' Sector on the data:


screen = SCREEN.express.universe('0#.BVSP').conditions(NOT_IN('TR.TRBCEconomicSector', 'Real Estate')).currency('BRL').query


However the call above returns the following error:


[{'code': 234, 'col': 1, 'message': "The 'Estate' is unexpected in formula. A delimiter is probably missing before the lexeme.", 'row': 0}, {'code': 234, 'col': 2, 'message': "The 'Estate' is unexpected in formula. A delimiter is probably missing before the lexeme.", 'row': 0}, {'code': 234, 'col': 3, 'message': "The 'Estate' is unexpected in formula. A delimiter is probably missing before the lexeme.", 'row': 0}, {'code': 234, 'col': 4, 'message': "The 'Estate' is unexpected in formula. A delimiter is probably missing before the lexeme.", 'row': 0}]


The name is according to the Workspace:


1663075647307.png



Could you help me?


Thanks in advance


Regards.

Best Answer

  • @rafael01

    You need to modify the dataquery.py code in the NOT_IN method.

    #not_in function
    def NOT_IN(field, *values):
        '''
        Returns true (1) if the specified value (first parameter) is not within the specified list of values (second parameter). 
        This analytic can be useful primarily when using screens that require you to look for instruments that do not fall in a specific industry or sector.
        '''
        if (field is not None) and (len(field)>0) and (values is not None) and (len(values)>0):
            if type(values)==str:
                value_ = 'NOT_IN({},"{}")'.format(field, values)
            else:
                value_ = 'NOT_IN({},"{}")'.format(field, ','.join(values))
        else:
            value_=''    
        return value_

    1663079000405.png

    The screen string contains 'SCREEN(U(IN(0#.BVSP)),NOT_IN(TR.TRBCEconomicSector,"Real Estate"),CURN=BRL)'

    1663079061985.png

Answers

  • @Jirapongse , when I substitute 'Real Estate' with 'Financials' my code runs well .


    screen = SCREEN.express.universe('0#.BVSP').conditions(NOT_IN('TR.TRBCEconomicSector', 'Financials')).currency('BRL').query

    Would you know the reason?





  • @rafael01

    "Real Estate" contains a space character so it must be inside double quotes. Therefore, I modified the NOT_IN method to wrap a string with double quotes.
  • Thanks a lot