Skip to main content

YahFin v1.1 (Yahoo Finance Python Wrapper - Unofficial)

Pypi: https://pypi.org/project/yahfin/

The Ultimate Yahoo Finance Python module you'll ever need.

Benchmark Result: YahFin is ~6x faster than yfinance for historical data and ~10x faster for company profiles because it hits lean JSON endpoints directly without middleware bloat.

Features:

  • Live Price Data
  • Historical Price Data
  • Multi Symbol Data
  • Options Data
  • Company Profile
  • Shareholding Info
  • Fundamental Statements
  • Balance Sheets
  • P&L
  • Cash Flows
  • (Yearly and Quarterly upto 4 years/qtrs)

Quick Guide

Importing into python file

  # one way
  from yahfin import yahfin as yf

  # other way
  import yahfin.yahfin as yf

The Symbol Object

  tsla = yf.Symbol('TSLA')
  multiSymbols = yf.Symbol('TSLA, AAPL, MSFT, FB, ZOOM, GOOG')

Quick Examples - Single Symbol

  from yahfin import yahfin as yf

  tsla = yf.Symbol('tsla')

  # Get Company Profile -
  tsla.profile()

  # Get Company's Key Managerial Personnel Info
  tsla.profile('kmp')

  # Live Price Data
  tsla.livePriceData()

  # Historical Prices
  tsla.history()  # defaults: period=max, interval=1d
  tsla.history(start='2021-01-01', end='2021-01-05')
  tsla.history(period='1y')
  tsla.history(period='5d', interval='1m')

  #valid periods: 1d,5d,1mo,3mo,6mo,1y,2y,5y,10y,ytd,max
  #valid intervals: 1m,2m,5m,15m,30m,60m,90m,1h,1d,5d,1wk,1mo,3mo

  # Options Data
  tsla.options('calls')
  tsla.options('puts')
  tsla.options('dates')
  tsla.options('strikes')
  tsla.options('quotes')

  # Analysis Data
  tsla.analysis()

  # Shareholding Data
  tsla.shareholding()

Multi Symbol Data

  from yahfin import yahfin as yf

  multiSymbols = yf.Symbol('TSLA, AAPL, GOOG, FB, RELIANCE.NS')

  # All data at once
  m = multiSymbols.multi()

  # dataPoints of all symbols
  prices = m['regularMarketPrice']
  marketCaps = m['marketCap']

  # Individual Data
  aapl_price = prices['AAPL']

  # Note: The best thing is that it also works with single symbol.

Fundamental Data

  from yahfin import yahfin as yf

  tsla = yf.Symbol('tsla')

  # Balance Sheets
  tsla.balanceSheets()
  tsla.balanceSheetsQtr()

  # Profile and Loss Statements
  tsla.incomeStatements()
  tsla.incomeStatementsQtr()

  # Cash Flow Statements
  tsla.cashFlows()
  tsla.cashFlowsQtr()

Requirements

stealthkit pandas

Metadata

Release files for yahfin 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yahfin 1.1.1
File Size Uploaded
yahfin-1.1.1.tar.gz 25.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yahfin 1.1.1
File Interpreter ABI Platform
yahfin-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 51.5 kB

Release files / yahfin-1.1.1.tar.gz

Download URL yahfin-1.1.1.tar.gz
Size 25.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3e51d3c7ba94642618113431137d0cf2bdcef5cf51a591f04821df5aeb5456a8
BLAKE2b-256 checksum
How to use checksums
6b2df0f9c21a1fe2a0bbe41f657bf500c6d9dfed7a2d83aa2e366690b86a3d3d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release files / yahfin-1.1.1-py3-none-any.whl

Download URL yahfin-1.1.1-py3-none-any.whl
Size 26.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
83c36499e06895086b6673e9ec9056424a7bc60d83b2bb415b125ad6f084401b
BLAKE2b-256 checksum
How to use checksums
1213de73099fb53e51e50a7573d522c4f8601fdfe0b70cd5a9ccd0ec6dec0021
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.5

Release history Release notifications | RSS feed

This release

1.1.1 This release

2 release files

1.1.0

2 release files

1.0

2 release files

0.3.7

1 release file

0.3.6

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.94

2 release files

0.2.93

2 release files

0.2.92

2 release files

0.2.91

2 release files

0.2.9

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page