Exemple #1
0
 def analyze_social_sentiment(self):
     self._final_analysis_str += 'Public Twitter sentiment analysis (-1.0 to 1.0)...\n'
     for symbol in self._stock_symbols:
         sentiment_data = get_social_sentiment(symbol)
         sentiment_value = sentiment_data['sentiment']
         if sentiment_value > 0.5:
             self._final_analysis_str += symbol.upper(
             ) + ' BULLISH with public Twitter sentiment value of ' + str(
                 sentiment_value) + '\n'
         else:
             self._final_analysis_str += symbol.upper(
             ) + ' BEARISH with public Twitter sentiment value of ' + str(
                 sentiment_value) + '\n'
     self._final_analysis_str += '\n\n'
Exemple #2
0
    def test_social_json(self):
        data = get_social_sentiment("AAPL")

        assert isinstance(data, dict)
Exemple #3
0
 def test_social_bad_period(self):
     with pytest.raises(ValueError):
         get_social_sentiment('AAPL', period_type='badperiod')
Exemple #4
0
 def test_social_bad_period(self):
     with pytest.raises(ValueError):
         get_social_sentiment("AAPL", period_type="badperiod")
Exemple #5
0
# -*- coding: utf-8 -*-
"""
Created on Fri Mar 22 17:19:39 2019

@author: Mathias
"""

from iexfinance.altdata import get_social_sentiment

get_social_sentiment("AAPL")