Skip to main content

No project description provided

Project description

yfinance-cli

yfinance-cli is a terminal-first CLI for Yahoo Finance Data. It keeps the command set close to yfinance, defaults to readable rich output, and offers stable JSON payloads when you need shell pipelines or automation.

Features

  • Single-ticker lookups for company info, price history, news, financials, and options
  • Search across quote matches, news, or both
  • Sector ranking lookups for companies, ETFs, mutual funds, growth, and performers
  • Human-readable summary output by default
  • Stable --json output for scripts and pipelines
  • History chart export with the output format inferred from the file extension

Requirements

  • Python 3.12+
  • uv for local development and packaging workflows

Installation

Primary packaged install:

uv tool install yfinance-cli

Run it after installation:

yfinance-cli --help

Run it without installing:

uvx yfinance-cli --help

Run a one-off command with uvx:

uvx yfinance-cli info AAPL

Install from source for local development:

git clone git@github.com:narumiruna/yfinance-cli.git
cd yfinance-cli
uv sync
uv run yfinance-cli --help

Quick Start

# One-off execution without installing
uvx yfinance-cli info AAPL

# Company overview
yfinance-cli info AAPL

# Historical prices
yfinance-cli history AAPL --period 6mo --interval 1d

# Export a chart
yfinance-cli history AAPL --chart price-volume --output aapl.webp

# Search quotes
yfinance-cli search nvidia

# Search news results as JSON
yfinance-cli search nvidia --type news --json

# Latest ticker news
yfinance-cli news MSFT --limit 5

# Financial statements
yfinance-cli financials NVDA --frequency quarterly -v

# Option expiration dates, then a chain lookup
yfinance-cli options dates AAPL
yfinance-cli options chain AAPL --date 2026-06-19 --type calls

# Sector rankings
yfinance-cli top companies technology

Command Overview

info

Look up a single ticker and show a summary of company, market, price, and key metrics.

yfinance-cli info AAPL
yfinance-cli info MSFT --json
yfinance-cli info NVDA --verbose

history

Fetch historical price data for one ticker.

yfinance-cli history AAPL
yfinance-cli history AAPL --period 1y --interval 1wk
yfinance-cli history AAPL --json
yfinance-cli history AAPL --chart price --output aapl.png

Allowed --period values: 1d, 5d, 1mo, 3mo, 6mo, 1y, 2y, 5y, 10y, ytd, max

Allowed --interval values: 1m, 2m, 5m, 15m, 30m, 60m, 90m, 1h, 1d, 5d, 1wk, 1mo, 3mo

Allowed --chart values: price, price-volume

Notes:

  • --chart and --json cannot be used together.
  • --output is required when exporting a chart.
  • The export format is inferred from the output file extension.

search

Search quote matches, news, or both.

yfinance-cli search tesla
yfinance-cli search tesla --type all
yfinance-cli search "artificial intelligence" --type news --limit 20
yfinance-cli search nvidia --all --json

Allowed --type values: quotes, news, all

news

Show recent news for a single ticker.

yfinance-cli news AMZN
yfinance-cli news AMD --limit 5
yfinance-cli news META --all --json

financials

Show income statement, balance sheet, and cash flow data.

yfinance-cli financials AAPL
yfinance-cli financials AAPL --frequency quarterly
yfinance-cli financials AAPL --frequency ttm --json

Allowed --frequency values: annual, quarterly, ttm

Note:

  • ttm does not include a balance sheet because that dataset is not available for the trailing frequency.

options

Inspect option expiration dates and option chains.

yfinance-cli options dates AAPL
yfinance-cli options chain AAPL --date 2026-06-19
yfinance-cli options chain AAPL --date 2026-06-19 --type puts --limit 25
yfinance-cli options chain AAPL --date 2026-06-19 --all --json

Allowed --type values for options chain: all, calls, puts

Notes:

  • options chain requires an explicit --date.
  • A useful workflow is yfinance-cli options dates TICKER first, then options chain.

top

Inspect top sector rankings grouped by category.

Available categories: companies, etfs, mutual-funds, growth, performers

yfinance-cli top companies technology
yfinance-cli top etfs financial-services
yfinance-cli top growth healthcare --limit 20
yfinance-cli top performers communication-services --json

Available sector slugs: basic-materials, communication-services, consumer-cyclical, consumer-defensive, energy, financial-services, healthcare, industrials, real-estate, technology, utilities

Output Modes

Default output is a human-readable summary view for terminal use.

Use --verbose or -v to expand the human-readable output with more fields:

yfinance-cli info AAPL -v

Use --json to emit stable JSON payloads for automation:

yfinance-cli history AAPL --json

Use --limit for preview size or --all to request the full result set on multi-row commands:

yfinance-cli news AAPL --limit 5
yfinance-cli search nvidia --all

Docker

Build the local image:

docker build -t yfinance-cli .

Run a command through the image:

docker run --rm yfinance-cli info AAPL

Export a chart to the host by mounting a directory:

docker run --rm -v "$PWD:/work" yfinance-cli \
  history AAPL --chart price-volume --output /work/aapl.webp

Development

Set up the local environment:

uv sync

Useful commands:

uv run yfinance-cli --help
uv build
just format
just lint
just type
just test
just all

Tests are expected to be fast and deterministic. Prefer mocked Yahoo Finance behavior over live network integration tests.

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

yfinance_cli-0.0.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

yfinance_cli-0.0.1-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

Details for the file yfinance_cli-0.0.1.tar.gz.

File metadata

  • Download URL: yfinance_cli-0.0.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for yfinance_cli-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5009946be9b85ed64529cc41a1480d2655cdfa1815129f06b816bf771d791139
MD5 23e1117c3690a0cb2cdd79a8d8991ee9
BLAKE2b-256 3b1e32725180acfd6cb4a11f5a646bc84d29e13860a8d0f06e676dd4bab8832f

See more details on using hashes here.

File details

Details for the file yfinance_cli-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: yfinance_cli-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 18.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for yfinance_cli-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 33233fcd1ee8199282f5be2d316d92b279f441ce71e75acb826eacaecf4edafa
MD5 9d2fb1deb56c36062fa67f826d337ff4
BLAKE2b-256 0af98634e60e3cdc4a94b4419efda819d625f40cbed5937bedc257851f407582

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