Socket
Socket
Sign inDemoInstall

pyfin-sentiment

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pyfin-sentiment

A library for market sentiment analysis of financial social media posts


Maintainers
1

pyFin-Sentiment

Documentation Status CI (tests) Code style: black License: MIT

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 NameMeaning
1Positive, Bullish
2Neutral, Uncertain
3Negative, Bearish

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc