Field Filter Cookbook

Here is a cookbook of how to filter fields by using our REST API.

from accern import API

TOKEN = 'YOUR TOKEN'
Client = API()
Client.token = TOKEN

Filter by single event.

schema = {
    'filters': {
        'event': 'Analyst Ratings'
    }
}

resp = Client.request(schema)

Filter by a list of events.

schema = {
    'filters': {
        'event': ['Analyst Ratings', 'Corporate Actions']
    }
}

Get only entity_type = US_EQUITY.

schema = {
    'filters': {
        'entity_type': 'US_EQUITY'
    }
}

Get only story_type = news.

schema = {
    'filters': {
        'story_type': 'news'
    }
}

Get articles with low story_group_exposure.

schema = {
    'filters': {
        'story_group_exposure': 'low'
    }
}

You can provide multiple fields in the filter (they will be AND’d).

schema = {
    'filters': {
        'event': ['Analyst Ratings', 'Corporate Actions'],
        'story_group_exposure': 'low',
        'story_type': 'news'
    }
}

You can filter date by either from or harvested_at. The time is in UTC.

schema = {
    'filters': {
        'from': '2017-11-01'
    }
}

or

schema = {
    'filters': {
        'harvested_at': ['2017-11-01 00:00:00', '2017-11-31 00:00:00']
    }
}