Files
OpenBB/website/content/api/common/behavioural_analysis/sentiment/_index.md
Colin Delahunty 8731fbd692 Auto Generate API Documentation (#2360)
* Started auto doc generation

* Created a markdown document

* Added test changed to md

* Created working version of new documentation

* Made requested changes

* Generate docs for all

Co-authored-by: minhhoang1023 <40023817+minhhoang1023@users.noreply.github.com>
2022-09-20 19:15:54 +01:00

1.2 KiB
Vendored

common.behavioural_analysis.sentiment

To obtain charts, make sure to add chart=True as the last parameter

Get underlying data

###common.behavioural_analysis.sentiment(post_data: List[str]) -> float

Find the sentiment of a post and related comments

Parameters
----------
post_data: List[str]
    A post and its comments in string form

Returns
-------
float
    A number in the range [-1, 1] representing sentiment

Getting charts

###common.behavioural_analysis.sentiment(symbol: str, n_tweets: int = 15, n_days_past: int = 2, compare: bool = False, export: str = '', external_axes: Optional[List[matplotlib.axes._axes.Axes]] = None, chart=True)

Plot sentiments from symbol

Parameters
----------
symbol: str
    Stock ticker symbol to get sentiment for
n_tweets: int
    Number of tweets to get per hour
n_days_past: int
    Number of days to extract tweets for
compare: bool
    Show corresponding change in stock price
export: str
    Format to export tweet dataframe
external_axes: Optional[List[plt.Axes]], optional
    External axes (1 axis is expected in the list), by default None