Пример #1
0
    def format_institutional(self, filing):
        alert = {'type': '/13F/', 'cik': int(filing['cik']),
                 'original': filing['url']}
        company = truncator(filing['name'], 40)

        if filing['amendment'] == 'A':
            amended_wording = 'an amended 13F'
        elif filing['amendment'] == 'R':
            amended_wording = 'a replacement 13F'
        else:
            amended_wording = 'a 13F'

        date_filed = self.format_date_filed(filing['date_filed'])
        period_of_report = pretty_date(filing['period_of_report'])
        positions = format_number(filing['positions'])
        aum = format_aum(filing['aum'])
        alert['subject'] = '%s filed %s for %s' % \
                    (company, amended_wording, period_of_report)

        """Create the text body"""
        alert['text'] = [alert['subject']]
        alert['text'].append(date_filed)
        alert['text'].append('Period: ' + period_of_report)
        alert['text'].append('Positions: ' + positions + ' (%s)' % aum)

        """Create the tweet"""
        if float(filing['aum']) > 100000 and filing['amendment'] == 'O':
            alert['tweet'] = [alert['subject']]
            alert['tweet'].append(positions + ' positions ' + '(' + aum + ')')
        self.raw_alerts.append(alert)
Пример #2
0
    def format_econ(self, series):
        alert = {'type': '/econ/', 'id': series['id']}
        title = truncator(series['name'], 25)
        units = truncator(series['units_short'], 15)

        alert['subject'] = '%s (%s, %s) ' % (title, units, series['seasonal'])
        alert['subject'] += pretty_date(series['latest_date']) + ': '
        alert['subject'] += series['latest'] + ', '
        alert['subject'] += series['sequential_change'] + ' vs. '
        alert['subject'] += prior_wording(series['frequency']) + ' and '
        alert['subject'] += series['yoy_change'] + ' YoY'

        """Create the text body"""
        """Will implement when we get econ watchlists setup"""
        alert['text'] = [alert['subject']]

        """Create the tweet"""
        if series['popularity'] > 50:
            alert['tweet'] = [alert['subject']]
        self.raw_alerts.append(alert)