Skip to main content

Simple and efficient access to Yahoo Finance's historical data API <https://finance.yahoo.com/> for querying and retrieval of financial data.

Project description

hist

PyPI version codecov Downloads

Overview

'hist' is a package that provides simple and efficient access to Yahoo Finance's 'history' API https://finance.yahoo.com/ for querying and retrieval of financial data.

The core functionality of the 'hist' package abstracts the complexities of interacting with Yahoo Finance APIs, such as session management, crumb and cookie handling, query construction, date validation, and interval management. This abstraction allows users to focus on retrieving data rather than managing API details. Use cases include historical data across a range of security types:

  • Equities & ETFs: end-of-day or intraday Open, High, Low, Close, Volume (OHLCV), and adjusted close prices
  • Indices: levels over time for benchmarking and research
  • Other tickers supported by Yahoo Finance where chart data is available

The package supports flexible query capabilities, including customizable date ranges, multiple time intervals, and automatic data validation. It automatically manages interval-specific limitations, such as lookback periods for intraday data and maximum date ranges for minute-level intervals.

The implementation leverages standard HTTP libraries to handle API interactions efficiently and provides support for both R and 'Python' to ensure accessibility for a broad audience.

Installation

  • Install the released version from PyPI:
pip install yfhist
  • Or the development version from GitHub:
pip install git+https://github.com/jasonjfoster/hist.git@main#subdirectory=python

Usage

First, load the package and explore the available interval options:

import yfhist as yfh

print(yfh.data_intervals)

Then, to retrieve historical data, use the the get_data method:

data = yfh.get_data(["AAPL", "MSFT"])

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

yfhist-0.1.3.tar.gz (8.3 kB view details)

Uploaded Source

Built Distribution

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

yfhist-0.1.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file yfhist-0.1.3.tar.gz.

File metadata

  • Download URL: yfhist-0.1.3.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for yfhist-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1cc686332cb738889b2d3f4adf47a1307863193610b6a7b99feef755a63755df
MD5 c8590e502a28b159bfabbbe11eeda0c1
BLAKE2b-256 5ac862b2e4c66c5afd00f389dc24ac8f2e6d0537f137e9dbcaf8d05f5944d9af

See more details on using hashes here.

File details

Details for the file yfhist-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: yfhist-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for yfhist-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4c3e280256dff4bf805cadf5c4210bd3bf2573fcf8bcd0e288a95360d1d61829
MD5 a00d19f16f22573874d4bc3523603247
BLAKE2b-256 9d212218491dc84d206bfa6bb40067277cd3810ee23947e74fb4609e679327a4

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