コード例 #1
0
ファイル: alerts.py プロジェクト: danbob123/jivedata
    def __init__(self, client_id, client_secret,
                 endpoints=[], params={}):

        self.nyc_datetime = current_est().replace(tzinfo=None)
        super(Alerts, self).__init__(client_id=client_id,
                                    client_secret=client_secret)
        self.endpoints = endpoints
        self.params = params
        for endpoint in self.endpoints:
            if endpoint not in self.params:
                self.params[endpoint] = {}
        self.params = params
        self.filings, self.insiders, self.institutional, self.econ = \
                                                ([] for i in range(4))

        self.raw_alerts = []
        self.get_resources()
コード例 #2
0
ファイル: test_alerts.py プロジェクト: danbob123/jivedata
import unittest
import copy
from ..alerts import Alerts
from jivedata.utils import current_est
from datetime import timedelta

est = current_est().replace(tzinfo=None)
raw_data = [
    {
        "accession": "",
        "date_filed": (est - timedelta(minutes=9)).isoformat(),
        "processed": (est - timedelta(seconds=59)).isoformat(),
    }
]
subscribed_alerts = ["/filings/"]
watchlist = [1288776]
funds = [921669]


def raw_to_alert(alert_type, cik):
    new_raw = copy.deepcopy(raw_data)
    new_raw[0]["cik"] = cik
    new_raw[0]["type"] = alert_type
    new_raw[0]["text"] = ""
    new_raw[0]["html"] = ""
    new_raw[0]["subject"] = ""
    return new_raw


class Tester(unittest.TestCase):
    def test_time_filter(self):
コード例 #3
0
ファイル: jinja2_filters.py プロジェクト: danbob123/jivedata
def current_year(*args):
    """Return the current year"""
    return current_est().year