Skip to main content

A python wrapper for Yahoo Finance using rust for the backend.

Project description

YahooRS

YahooRS is a Python-based utility for fetching and managing Yahoo Finance data, leveraging DuckDB for efficient local storage and Polars for high-performance data manipulation. It provides tools for candle data, option chains (with Greeks), and financial statements.

Features

  • Historical Price Data (Candles): Fetch and store historical price data with configurable intervals and periods. Includes automated staleness detection and local caching.
  • Options Analysis: Download full option chains, including real-time Greeks (Delta, Gamma, Theta, Vega), Black-Scholes pricing, and historical probability of profit calculations.
  • Financial Statements: Retrieve annual and quarterly income statements, balance sheets, and cash flow statements.
  • Financial Ratios & Margins: Automated calculation of key financial metrics such as P/E, P/S, P/B, EV/EBITDA, ROE, and various profit margins.
  • Local Database (DuckDB): Persists all fetched data locally to minimize redundant API calls and enable fast offline analysis.
  • CLI & Library: Accessible via a command-line interface or directly as a Python library.

Installation

pip install yahoors

Data Storage

By default, YahooRS stores data in a DuckDB database located in your platform's standard configuration directory (e.g., ~/.config/yahoors/ on Linux). You can override this by setting the YAHOO_FINANCE_DB environment variable.

CLI Usage

The package installs a yahoors command with several subcommands:

Fetch Candle Data

yahoors get-candles AAPL MSFT --interval 1d --range 1y

Options Screener

yahoors options-screener -s AAPL --min-dte 30 --max-dte 60

Financial Statements

yahoors statements AAPL --statement-type income --annual --ratios

Library Usage

from YahooRS.modules.candles import Candles
from YahooRS.modules.options import Options

# Initialize with default database
candles = Candles()
options = Options()

# Fetch data
df = candles.get_candles(["AAPL"])
option_chain = options.get_options(["AAPL"])

License

This project is licensed under the MIT License - see the LICENSE file 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

yahoors-0.1.1.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

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

yahoors-0.1.1-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file yahoors-0.1.1.tar.gz.

File metadata

  • Download URL: yahoors-0.1.1.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for yahoors-0.1.1.tar.gz
Algorithm Hash digest
SHA256 44cc048ae1da8e6f34d5c194d266b2a0fe0649fefaab685385b902ed2bbf642c
MD5 9dcbfc3f0b490ad4a3b216d96b5f0171
BLAKE2b-256 cc72f72cd33dd2d4acc887013eb162b3b2bfd45e0170decafa72f23c9628cac7

See more details on using hashes here.

File details

Details for the file yahoors-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: yahoors-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for yahoors-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 47cbc3dd7dcbe180e55755a5e2e78bae88db2174e376fa0bf2b2f7e7edfcd6a4
MD5 4054c0c6010c38527a42db0bc89b1a1a
BLAKE2b-256 7d36aecc76107e5387d2a3fad904abddb1d43e3e8e2a03e076f2d0e1d6a42047

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