Python SDK for the Stock Sentiment API — Reddit & X/Twitter sentiment analysis for stocks
Project description
social-stock-sentiment
Python SDK for the Stock Sentiment API — analyze stock sentiment from Reddit and X/Twitter.
Installation
pip install social-stock-sentiment
Quick Start
from stocksentiment import StockSentimentClient
client = StockSentimentClient(api_key="sk_live_...")
# Get trending stocks on Reddit
trending = client.reddit.trending(days=7, limit=10)
for stock in trending:
print(f"{stock.ticker}: buzz={stock.buzz_score}, sentiment={stock.sentiment_score}")
# Get detailed sentiment for a stock
tsla = client.reddit.stock("TSLA", days=14)
print(f"TSLA buzz: {tsla.buzz_score}, trend: {tsla.trend}")
# AI-generated trend explanation
explanation = client.reddit.explain("TSLA")
print(explanation.explanation)
# Search for stocks
results = client.reddit.search("Tesla")
# Compare multiple stocks
comparison = client.reddit.compare(["TSLA", "AAPL", "MSFT"], days=7)
X/Twitter Data
# Same interface, different data source
x_trending = client.x.trending(days=1, limit=20)
nvda = client.x.stock("NVDA")
Async Usage
Every method has an _async variant:
import asyncio
from stocksentiment import StockSentimentClient
async def main():
async with StockSentimentClient(api_key="sk_live_...") as client:
trending = await client.reddit.trending_async(days=7)
tsla = await client.reddit.stock_async("TSLA")
asyncio.run(main())
Available Methods
client.reddit.*
| Method | Description |
|---|---|
trending(days, limit, offset, type) |
Trending stocks by buzz score |
trending_sectors(days, limit, offset) |
Trending sectors |
trending_countries(days, limit, offset) |
Trending countries |
stock(ticker, days) |
Detailed sentiment for a ticker |
explain(ticker) |
AI-generated trend explanation |
search(query) |
Search stocks by name/ticker |
compare(tickers, days) |
Compare up to 10 stocks |
client.x.*
| Method | Description |
|---|---|
trending(days, limit, offset, type) |
Trending stocks on X/Twitter |
trending_sectors(days, limit, offset) |
Trending sectors |
trending_countries(days, limit, offset) |
Trending countries |
stock(ticker, days) |
Detailed X/Twitter sentiment |
search(query) |
Search stocks |
compare(tickers, days) |
Compare stocks |
Authentication
Get your API key at api.adanos.org. Free tier includes 250 requests/month.
# Custom base URL (e.g. for self-hosted instances)
client = StockSentimentClient(
api_key="sk_live_...",
base_url="https://your-instance.com",
timeout=60.0,
)
Rate Limits
| Tier | Monthly Requests | Burst Limit |
|---|---|---|
| Free | 250 | 100/min |
| Paid | Unlimited | 1000/min |
Rate limit headers are included in every response.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file
social_stock_sentiment-1.15.0.tar.gz.File metadata
File hashes
582fe7fb7ad55a54dcb9a423abe24cfcfe159eec39a9e1db2cd04a147ebfe4fe57088e0b7645efac9f95d29f59fef6d79baa462f3f3b90809a001b4a8c2975aa1302c0a5ae098b305ded900bd53a7d83See more details on using hashes here.
Provenance
The following attestation bundles were made for
social_stock_sentiment-1.15.0.tar.gz:Publisher:
Attestations: Values shown here reflect the state when the release was signed and may no longer be current.publish-sdk.ymlon alexander-schneider/api.adanos.org-
Statement type:
-
Predicate type:
-
Subject name:
-
Subject digest:
-
Sigstore transparency entry: 954513827
- Sigstore integration time:
Source repository:https://in-toto.io/Statement/v1https://docs.pypi.org/attestations/publish/v1social_stock_sentiment-1.15.0.tar.gz582fe7fb7ad55a54dcb9a423abe24cfcfe159eec39a9e1db2cd04a147ebfe4fe-
Permalink:
-
Branch / Tag:
-
Owner: https://github.com/alexander-schneider
-
Access:
Publication detail:alexander-schneider/api.adanos.org@5dadc0e79b0f590f24581a9a4a330d543e311919refs/heads/mainprivatehttps://token.actions.githubusercontent.comgithub-hostedpublish-sdk.yml@5dadc0e79b0f590f24581a9a4a330d543e311919workflow_dispatch