Yahoo Finance Python Wrapper (Unofficial)
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file yahfin-1.1.1.tar.gz.
File metadata
- Download URL: yahfin-1.1.1.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e51d3c7ba94642618113431137d0cf2bdcef5cf51a591f04821df5aeb5456a8
|
|
| MD5 |
7429cbc8060fc44e2c226ef475666ce8
|
|
| BLAKE2b-256 |
6b2df0f9c21a1fe2a0bbe41f657bf500c6d9dfed7a2d83aa2e366690b86a3d3d
|
File details
Details for the file yahfin-1.1.1-py3-none-any.whl.
File metadata
- Download URL: yahfin-1.1.1-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83c36499e06895086b6673e9ec9056424a7bc60d83b2bb415b125ad6f084401b
|
|
| MD5 |
6ea0360df7e261a6ae0d766b5d079da3
|
|
| BLAKE2b-256 |
1213de73099fb53e51e50a7573d522c4f8601fdfe0b70cd5a9ccd0ec6dec0021
|