Skip to main content

Financial data access and analysis library with market data, options calculations, and database integration

Project description

Sharpe - Financial Data & Analysis Library

A Python library for financial data access, market analysis, and options calculations.

Wrappers around Polygon and Financial Modeling Prep.

Features

  • Market Data: Stock prices, options data, and historical information
  • Alternative Data: News, earnings, and company profiles
  • Options Calculations: Black-Scholes pricing and Greeks
  • Database Integration: PostgreSQL with async support
  • AWS Integration: Cloud data retrieval

Installation

# From source
git clone https://github.com/wang-sanity/sharpe.git
cd sharpe
pip install -e .

# Using conda
conda env create -f environment.yml
conda activate tensorfi-sharpe

Quick Start

from sharpe.data import mkt, alt
from sharpe.utils import options, time, universe

# Get market data using aggregates
data = mkt.aggregates(
    ticker="AAPL",
    multiplier=1,
    timespan="day",
    from="2024-01-01",
    to="2024-01-31"
)

# Get options chain for a ticker
options_data = mkt.options_chain("SPY")

# Work with time utilities
trading_day = time.closest_trading_day_now()
is_trading = time.is_trading_day("2024-01-15")

# Get universe of stocks
top_stocks = universe.get_top_n_traded_stock(n=50)

Package Structure

  • sharpe/data/ - Market and alternative data access, database operations
  • sharpe/utils/ - Options calculations, time utilities, universe management

Requirements

  • Python 3.11+
  • Core: pandas, numpy, scipy, sqlalchemy
  • Optional: PostgreSQL, AWS credentials

Development

# Setup
conda env create -f environment.yml
conda activate tensorfi-sharpe
pip install -e .[dev]

# Test
pytest

Performance tuning

The data layer uses a pooled HTTP client and optional on-disk cache to reduce duplicated network calls during simulations.

  • SHARPE_HTTP_CACHE_ENABLED: set to 0 to disable (default 1)
  • SHARPE_HTTP_CACHE_TTL_SECONDS: cache TTL in seconds (default 86400)
  • SHARPE_HTTP_CACHE_DIR: directory for cached responses (default ~/.cache/sharpe/http)

These affect sharpe.data.mkt.aggregates and sharpe.data.mkt.option_definition calls extensively used by options utilities.

License

CC BY-NC 4.0 License - see LICENSE file for details.


Disclaimer: For educational and research purposes only. Consult qualified professionals before making investment decisions.

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

tensorfi_sharpe-0.1.15.tar.gz (44.1 kB view details)

Uploaded Source

Built Distribution

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

tensorfi_sharpe-0.1.15-py3-none-any.whl (40.5 kB view details)

Uploaded Python 3

File details

Details for the file tensorfi_sharpe-0.1.15.tar.gz.

File metadata

  • Download URL: tensorfi_sharpe-0.1.15.tar.gz
  • Upload date:
  • Size: 44.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for tensorfi_sharpe-0.1.15.tar.gz
Algorithm Hash digest
SHA256 fb57cbbe49a5c49186ba68c59fd5337d5900c2647f601545c4142f0f7f82aecc
MD5 64c9607f9dfb4a376630e03c9ecc2632
BLAKE2b-256 cf02d2538e3ccb7764624452a91252a7c306ff9570b984e9e3a2529162daf875

See more details on using hashes here.

File details

Details for the file tensorfi_sharpe-0.1.15-py3-none-any.whl.

File metadata

File hashes

Hashes for tensorfi_sharpe-0.1.15-py3-none-any.whl
Algorithm Hash digest
SHA256 60284f7edd1da32617abeaf463abe34ee5830014d990491dbbcd48b50eb2d5f4
MD5 6f5460ea795c04d56cfc12143c6e9892
BLAKE2b-256 24d5aa4f425b4ee36ffbaedf261f87f83af89a269cb55aed0be3431b8b7c6b1d

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