Stocksent
A Python library for sentiment analysis of various tickers from the latest news by trusted sources, and tools to plot results. 📈📊📰
Install / Use
/learn @Aryagm/StocksentREADME
Stocksent
<a href="https://github.com/Aryagm/Stocksent" target="blank"><img align="center" src="https://img.shields.io/badge/Stocksent-100000?logo=github&logoColor=white" /> <a href="https://pepy.tech/project/stocksent" target="blank"><img align="center" src="https://static.pepy.tech/personalized-badge/stocksent?style=for-the-badge&period=total&units=international_system&left_color=black&right_color=orange&left_text=Downloads" /> </a> </a>
<p align="center"> <img src="https://raw.githubusercontent.com/Aryagm/Stocksent/master/logo.png" alt="logo" width="100"/> </p>Stocksent is a Python library for sentiment analysis of various tickers from the latest news from trusted sources. It also has options for plotting results.
Installation
Use the package manager pip to install stocksent.
pip install stocksent
<br />
<br />
Usage
<br />Get Sentiment of single stock
from stocksent import Sentiment
stock = Sentiment('AAPL')
sentiment_score = stock.get_sentiment()
print(sentiment_score) # Returns a float with the sentiment score.
0.189
<br />
Get Sentiment of multiple stocks
from stocksent import Sentiment
stocks = Sentiment(['AAPL','TSLA','GOOG'])
sentiment_score = stocks.get_sentiment(days=4) # Get the sentiment for the past 4 days.
print(sentiment_score) # Returns a float with the sentiment score.
0.237
<br/>
Get DataFrame of headlines, source and sentiment scores
from stocksent import Sentiment
stocks = Sentiment(['AAPL','TSLA','AMZN'])
sentiment_score = stocks.get_dataframe(days=6) # Get the headlines for the past 6 days.
print(sentiment_score) # Returns a DataFrame with headlines, source and sentiment scores.
ticker date time source headline Negative Neutral Positive Overall
0 AAPL 2021-07-05 09:55AM Investor's Business Daily Dow Jones Futures: Apple, Google, Tech Titans ... 0.000 1.000 0.000 0.0000
1 AAPL 2021-07-05 09:04AM The Independent 7 best VPN services for streaming and security... 0.000 0.645 0.355 0.7650
2 AAPL 2021-07-05 09:00AM Motley Fool Warren Buffett Owns These Dividend-Paying Grow... 0.000 0.776 0.224 0.3818
3 AAPL 2021-07-05 06:51AM Motley Fool Here's Why Bill Ackman's SPAC Deal Could Be a ... 0.000 0.581 0.419 0.7579
4 AAPL 2021-07-05 06:09AM Barrons.com Jeff Bezos Steps Down as CEO on Monday. Heres ... 0.073 0.927 0.000 -0.0258
... ... ... ... ... ... ... ... ... ...
295 AMZN 2021-06-30 12:16PM Reuters UPDATE 1-Amazon asks FTC to recuse Chairwoman ... 0.000 1.000 0.000 0.0000
296 AMZN 2021-06-30 12:01PM Reuters Amazon says FTC should take new chair off its ... 0.000 0.841 0.159 0.1779
297 AMZN 2021-06-30 10:13AM Motley Fool 3 Stocks I Would Avoid at All Costs 0.306 0.694 0.000 -0.2960
298 AMZN 2021-06-30 08:43AM TheStreet.com Amazon Asks FTC to Bar Chair Khan From Matters... 0.000 0.781 0.219 0.2023
299 AMZN 2021-06-30 08:13AM Zacks Digital Transformation Giving Cloud Business a... 0.000 0.495 0.505 0.6249
<br />
Get plot of sentiment scores
from stocksent import Sentiment
stocks = Sentiment(['AAPL','TSLA','GOOG'])
stocks.plot(save_figure=True)
<img src="https://raw.githubusercontent.com/Aryagm/Stocksent/master/plot.png" alt="plot" width=450/>
<br />
<br />
Get word cloud of headlines
from stocksent import Sentiment
stocks = Sentiment(['AAPL','AMZN','GOOG','TSLA'])
stocks.word_cloud(days=5) #Create a word cloud from news from the past 5 days.
<img src="https://raw.githubusercontent.com/Aryagm/Stocksent/master/word_cloud.png" alt="word cloud" width=450/>
<br />
<br />
Docs
Read the docs here: https://stocksent.readthedocs.io ! <br /> <br />
Contributing
Pull requests are welcome on GitHub !
<br />License
Mozilla Public License Version 2.0
<br />Author
Arya Manjaramkar
<a href="https://www.linkedin.com/in/arya-manjaramkar" target="blank"><img align="center" src="https://img.shields.io/badge/Arya Manjaramkar-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" /></a> <a href="https://www.github.com/Aryagm" target="blank"><img align="center" src="https://img.shields.io/badge/Aryagm-100000?style=for-the-badge&logo=github&logoColor=white" /></a>
<br/>Disclaimer
<i> The material in this repository is purely for educational purposes and should not be taken as professional investment advice. Invest at your own discretion. </i>Related Skills
node-connect
337.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
83.2kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
83.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
337.3kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
