예제 #1
0
    def test_returns_correct_asset(self):

        api = KnowsisClient(oauth_consumer_key, oauth_consumer_secret)

        asset = api.asset_sentiment(identifier="AAPL")

        self.assertEqual(asset.name, "Apple Inc")
예제 #2
0
    def test_returns_data_for_last_period_by_default(self):

        api = KnowsisClient(oauth_consumer_key, oauth_consumer_secret)

        asset = api.asset_sentiment(identifier="AAPL")

        current_day = datetime.combine(datetime.utcnow(), time.min)

        self.assertEqual(asset.name, "Apple Inc")
        self.assertEqual(asset.startdate, current_day)
        self.assertEqual(asset.enddate, current_day)
예제 #3
0
    def test_returns_data_for_daterange_specified(self):

        api = KnowsisClient(oauth_consumer_key, oauth_consumer_secret)
        startdate = datetime.combine(datetime.utcnow(),
                                     time.min) - timedelta(days=5)
        enddate = datetime.combine(datetime.utcnow(),
                                   time.min) - timedelta(days=2)

        asset = api.asset_sentiment(identifier="AAPL",
                                    startdate=startdate,
                                    enddate=enddate)

        self.assertEqual(asset.name, "Apple Inc")
        self.assertEqual(asset.startdate, startdate)
        self.assertEqual(asset.enddate, enddate)