Skip to main content

Official Python SDK for the SentiSense market intelligence API

Project description

SentiSense Python SDK

PyPI version Python versions License: MIT

Official Python SDK for the SentiSense market intelligence API.

Installation

pip install sentisense

Quick Start

from sentisense import SentiSenseClient

client = SentiSenseClient("your-api-key")

# Get a stock price
price = client.get_stock_price("AAPL")
print(price)

# Get multiple stock prices
prices = client.get_stock_prices(["AAPL", "MSFT", "GOOGL"])

# Check market status
status = client.get_market_status()
print(status)

# Get latest news for a stock
news = client.get_documents_by_ticker("TSLA", source="news", days=7)

# Search across news and social media
results = client.search_documents("AI earnings surprise")

# Get mention time series for a stock (v2 metrics API)
mentions = client.get_metrics("NVDA", metric_type="mentions")

# Get sentiment time series
sentiment = client.get_metrics("NVDA", metric_type="sentiment")

# Get mentions broken down by source
dist = client.get_metrics_distribution("NVDA", metric_type="mentions", dimension="source")

Authentication

All API requests require an API key. You can generate one from your Developer Console.

client = SentiSenseClient("your-api-key")

For full endpoint documentation, request/response schemas, and interactive examples, see the API Documentation.

API Reference

Stocks

Method Description
get_stock_price(ticker) Real-time price for a single stock
get_stock_prices(tickers) Real-time prices for multiple stocks
get_stock_profile(ticker) Company profile
get_stock_chart(ticker, timeframe="1M") OHLCV chart data
get_all_stocks() List of available tickers
get_all_stocks_detailed() Tickers with company names and entity IDs
get_market_status() Market open/closed status
get_fundamentals(ticker, timeframe="quarterly") Financial fundamentals

News & Documents

Method Description
get_documents_by_ticker(ticker, source?, days?, hours?, limit?) News and social posts for a stock
get_documents_by_ticker_range(ticker, start_date, end_date) Documents within a date range
get_documents_by_entity(entity_id) Documents for a KB entity
search_documents(query, source?, days?, limit?) Natural language search across news and social
get_documents_by_source(source, days?, hours?, limit?) Latest from a source ("news", "reddit", "x", "substack")
get_stories(limit?, days?, expanded?) AI-curated news story clusters
get_story(cluster_id) Single story with all source documents
get_stories_by_ticker(ticker, limit?) Stories for a specific stock

Metrics (v2)

Method Description
get_metrics(symbol, metric_type="mentions", start_time?, end_time?, max_data_points?) Time series for a metric (mentions, sentiment, sentisense_score, social_dominance, creators)
get_metrics_distribution(symbol, metric_type="mentions", dimension="source", start_time?, end_time?) Metric distribution by dimension (e.g. mentions by source)

Note: start_time and end_time are epoch milliseconds.

Sentiment & Mentions (deprecated)

The following methods hit the v1 entity-metrics endpoints which return empty data. Use the v2 metrics methods above instead.

Method Description
get_mentions(symbol, source?, start_date?, end_date?) Mention data across news and social
get_mention_count(symbol, source?, start_date?, end_date?) Total mention count
get_mention_count_by_source(symbol, start_date?, end_date?) Mentions broken down by source
get_sentiment(symbol, start_date?, end_date?) Sentiment data for a stock
get_sentiment_by_source(symbol, date?) Sentiment broken down by source
get_average_sentiment(symbol, start_date?, end_date?) Average sentiment score

Institutional Flows (13F)

Method Description
get_institutional_quarters() Available 13F reporting quarters
get_institutional_flows(report_date, limit=50) Fund flows for a quarter
get_stock_holders(ticker, report_date) Institutional holders for a stock
get_activist_positions(report_date) Activist investor positions

Error Handling

The SDK raises typed exceptions for API errors:

from sentisense import SentiSenseClient, AuthenticationError, RateLimitError

client = SentiSenseClient("your-api-key")

try:
    price = client.get_stock_price("AAPL")
except AuthenticationError:
    print("Invalid or missing API key")
except RateLimitError:
    print("Rate limit exceeded, try again later")
Exception HTTP Status Description
AuthenticationError 401, 403 Invalid or missing API key
NotFoundError 404 Resource not found
RateLimitError 429 Rate limit exceeded
APIError Other 4xx/5xx General API error

All exceptions inherit from SentiSenseError and include .status_code, .message, and .response attributes.

License

MIT - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sentisense-0.5.0.tar.gz (11.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sentisense-0.5.0-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file sentisense-0.5.0.tar.gz.

File metadata

  • Download URL: sentisense-0.5.0.tar.gz
  • Upload date:
  • Size: 11.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.8

File hashes

Hashes for sentisense-0.5.0.tar.gz
Algorithm Hash digest
SHA256 c17b0c68e26da43b4e0e89e8e4c859fd4448dfbd8c50026ab649006836aff0ba
MD5 e17c4dcbedb06fc15b0f62e774ac1fe9
BLAKE2b-256 de47a2b01510a2dc90c6e65dbcdb0d0b8e8a1695fd00ba4e4af406fc32dd7ddd

See more details on using hashes here.

File details

Details for the file sentisense-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: sentisense-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 8.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.8

File hashes

Hashes for sentisense-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5babe1949238faa8dc0bbc195bead8abf01542a3d30271e9011c68ca13ab43d9
MD5 984096a10322e57626fec664da061ea9
BLAKE2b-256 9df87097227797956917e7f4755fbfa5ac881a3ee4b10a2f5d16c9ea98436ad8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page