pyFin-Sentiment
A library for sentiment analysis of financial social media posts
Sentiment Analysis of Financial Social Media Posts
This library can help you extract market sentiment from short social media posts. Trained on data from Twitter, it can classify sentimetn into three classes: Bullish, Bearish, Neutral/No Sentiment. Note that we need to differentiate between market sentiment and general sentiment. Consider this example:
💬 Nice, already made loads of money this morning and now im shorting $AAPL, let's goooo!
While the general sentiment in the text is positve, the market sentiment is negative as the author is shorting a stock. Therefore, ...
- If you are looking for a generic sentiment model that works well on social media content, take a look at VADER or TwitterRoBERTa
- If you are looking for a sentiment analysis models that excels on new headlines sentiment analysis, check out FinBERT
- Otherwise, stay here 🙃
Installation
It's as easy as...
pip install pyfin-sentiment
Documentation
📚 The documentation lives on pyfin-sentiment.readthedocs.io
Example
from pyfin_sentiment.model import SentimentModel
# the model only needs to be downloaded once
SentimentModel.download("small")
model = SentimentModel("small")
model.predict(["Long $TSLA!!", "Selling my $AAPL position"])
# array(['1', '3'], dtype=object)
We use the following conventions for mapping sentiment classes:
| Class Name | Meaning |
|---|---|
| 1 | Positive, Bullish |
| 2 | Neutral, Uncertain |
| 3 | Negative, Bearish |
Metadata
Release files for pyfin-sentiment 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyfin-sentiment-0.1.1.tar.gz | 6.2 kB | Without provenance | Details for pyfin-sentiment-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyfin_sentiment-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pyfin_sentiment-0.1.1-py3-none-any.whl |
Total release size: 12.3 kB
Release files / pyfin-sentiment-0.1.1.tar.gz
| Download URL | pyfin-sentiment-0.1.1.tar.gz |
|---|---|
| Size | 6.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7bee4e003ebeaebaca36f2ed1b782d26a274cd52ccb5c3d7aadc3a449691e684
|
|
BLAKE2b-256 checksum How to use checksums |
5c9474e50156984cacafbb0b4c9179f83969c5591476e16a46a36a303266e651
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Release files / pyfin_sentiment-0.1.1-py3-none-any.whl
| Download URL | pyfin_sentiment-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d9e7687b2cae00d614add5a67bc44195be32420bee1f516b79be90487ea11c9
|
|
BLAKE2b-256 checksum How to use checksums |
b6be05c3f6c4de46c0454088d9db8b6c1916fcb7ec56167d311bf4c0ab7efe85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.2
|
Security for pyfin-sentiment 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.