Sentiment

class stocksent.Sentiment(ticker)[source]

Instantiate ticker(s) for analysis. Provides several functions to analyze sentiments of stocks based on trusted news sources.

Parameters

ticker (str/list) – The ticker or list of tickers.

get_dataframe(days=None)[source]

Returns dataframe of given ticker(s) with date, time, headlines, source and sentiment.

Parameters

days (int) – Number of days into the past you want the sentiment for.

get_sentiment(days=None)[source]

Returns sentiment of given ticker(s).

Parameters

days (int) – Number of days into the past you want the sentiment for.

plot(days=None, save_figure=False)[source]

Returns plot of given ticker(s) with sentiment across several days.

Parameters
  • days (int) – Number of days into the past you want the plot for.

  • save_figure (bool) – Option for saving figure as png.

word_cloud(days=None, save_figure=False, figsize=(15, 8))[source]

Returns a word cloud plot of given ticker(s).

Parameters
  • days (int) – Number of days into the past you want the word cloud for.

  • save_figure (tuple) – Option for saving figure as png.

  • figsize – Option for resizing plot.