Skip to main content

yh_finance

A Python package that wraps YH Finance API endpoints and returns financial data in JSON format. The API queries markets, stocks, news and conversations on Yahoo! Finance in real time to streamline the development of financial applications.

IMPORTANT LEGAL DISCLAIMER


yh-finance is not affiliated, endorsed, or vetted by Yahoo, Inc. It is an open-source tool that uses a publicly available API and is intended for research and educational purposes.

Install

pip install yh_finance

Subscribe to YH Finance API

Tutorial

import yh_finance as yhf

Default

Get auto complete suggestions by term or phrase.

json_resp = yhf.auto_complete(query='tesla', 
                              region='US', 
                              api_key='YOUR_API_KEY')

Market

Get live price quotes.

json_resp = yhf.get_quotes(region='US',
                           symbols='AMD,IBM,AAPL',
                           api_key='YOUR_API_KEY')

The live day gainers, losers, and actives in a specific region.

json_resp = yhf.get_movers(region='US',
                           lang='en-US',
                           count=5,
                           api_key='YOUR_API_KEY')

Get live summary information of market by region.

json_resp = yhf.get_summary(region='US',
                            api_key='YOUR_API_KEY')

Used with get_trending_tickers endpoint together to draw brief chart.

json_resp = yhf.get_spark(symbols='AMZN,AAPL,WDC,REYN,AZN',
                          interval='1m',
                          time_range='1d',
                          api_key='YOUR_API_KEY')

Get recent earnings in the market.

json_resp = yhf.get_earnings(region='US',
                             start_date='1585155600000',
                             end_date='1589475600000',
                             size=10,
                             api_key='YOUR_API_KEY')

Get latest trending tickers in the market (Count 20).

json_resp = yhf.get_trending_tickers(region='US',
                                     api_key='YOUR_API_KEY')

Get popular watchlists in the market.

json_resp = yhf.get_popular_watchlists(api_key='YOUR_API_KEY')

Get performance information of specific watchlist.

json_resp = yhf.get_watchlist_performance(user_id='X3NJ2A7VDSABUI4URBWME2PZNM',
                                          portfolio_id='the_berkshire_hathaway_portfolio',
                                          symbols='^GSPC',
                                          region='US',
                                          api_key='YOUR_API_KEY')

Get detail information of specific watchlist.

json_resp = yhf.get_watchlist_detail(user_id='X3NJ2A7VDSABUI4URBWME2PZNM',
                                     portfolio_id='the_berkshire_hathaway_portfolio',
                                     api_key='YOUR_API_KEY')

Stock

Get data in summary section.

json_resp = yhf.get_summary(symbol='AMRN',
                            region='US',
                            api_key='YOUR_API_KEY')

Get symbols similar to the specified one.

json_resp = yhf.get_recommendations(symbol='INTC',
                                    api_key='YOUR_API_KEY')

Get upgrade and downgrade data.

json_resp = yhf.get_upgrades_downgrades(symbol='INTC',
                                        region='US',
                                        api_key='YOUR_API_KEY')

Get data to draw full screen chart.

json_resp = yhf.get_chart(interval='1mo',
                          symbol='AMRN',
                          time_range='1y',
                          region='US',
                          include_pre_post='false',
                          use_yahoo_id='true',
                          include_adj_close='true',
                          events='capitalGain,div,split',
                          api_key='YOUR_API_KEY')

Get data in statistics section.

json_resp = yhf.get_statistics(symbol='JD',
                               api_key='YOUR_API_KEY')

Get data in historical section.

json_resp = yhf.get_historical_data(symbol='AMRN',
                                    region='US',
                                    api_key='YOUR_API_KEY')

Get data in profile section.

json_resp = yhf.get_profile(symbol='AMRN',
                            region='US',
                            api_key='YOUR_API_KEY')

Get income statement and annual data in financial section.

json_resp = yhf.get_financials(symbol='AMRN',
                               region='US',
                               api_key='YOUR_API_KEY')

Get quarterly data in financial section.

json_resp = yhf.get_timeseries(symbol='AMRN',
                               start_date='493578000',
                               end_date='1625011200',
                               region='US',
                               api_key='YOUR_API_KEY')

Get cash flow data in financial section.

json_resp = yhf.get_cash_flow(symbol='AMRN',
                              region='US',
                              api_key='YOUR_API_KEY')

Get balance sheet data in financial section.

json_resp = yhf.get_balance_sheet(symbol='AMRN',
                                  region='US',
                                  api_key='YOUR_API_KEY')

Get data in analysis section.

json_resp = yhf.get_analysis(symbol='AMRN',
                             region='US',
                             api_key='YOUR_API_KEY')

Get data in options section.

json_resp = yhf.get_options(symbol='AMRN',
                            date='1562284800',
                            region='US',
                            api_key='YOUR_API_KEY')

Get major holders in holders section.

json_resp = yhf.get_holders(symbol='AMRN',
                            region='US',
                            api_key='YOUR_API_KEY')

Get data in holdings section. The symbol must be a mutual fund stock.

json_resp = yhf.get_holdings(symbol='AMRN',
                             api_key='YOUR_API_KEY')

Get brief reports relating to the symbol.

json_resp = yhf.get_insights(symbol='AAPL',
                             api_key='YOUR_API_KEY')

Get insider transaction data in the holders section.

json_resp = yhf.get_insider_transactions(symbol='AMRN',
                                         region='US',
                                         api_key='YOUR_API_KEY')

Get insider roster data in the holders section.

json_resp = yhf.get_insider_roster(symbol='AMRN',
                                   region='US',
                                   api_key='YOUR_API_KEY')

Conversation

Get conversations list relating to a symbol.

json_resp = yhf.get_conversation_list(symbol='AAPL',
                                      message_board_id='finmb_24937',
                                      region='US',
                                      user_activity='true',
                                      sort_by='createdAt',
                                      off='0',
                                      api_key='YOUR_API_KEY')

Release files for yh-finance 0.0.6

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

Source distribution (sdist)

Source distribution for yh-finance 0.0.6
File Size Uploaded
yh_finance-0.0.6.tar.gz 19.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yh-finance 0.0.6
File Interpreter ABI Platform
yh_finance-0.0.6-py3-none-any.whl Python 3 none any Details

Total release size: 39.2 kB

Release files / yh_finance-0.0.6.tar.gz

Download URL yh_finance-0.0.6.tar.gz
Size 19.4 kB
Tags Source
SHA-256 checksum
How to use checksums
8aee116bc4eaa5e847afd17660fd3718e7e95619c8a00c9f0e5d4c504eff6e88
BLAKE2b-256 checksum
How to use checksums
13be48b0834c5fb9ada14a842d002b542b90c2144ac1da359feb97e052d3696c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

Release files / yh_finance-0.0.6-py3-none-any.whl

Download URL yh_finance-0.0.6-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
291a733a680a28fa4e50c320233d6b5070150aea3c53785e788f3a2685ab2b06
BLAKE2b-256 checksum
How to use checksums
81adce3f12ab07c8c3172bacfe007fbd71af486c5763d7352ee8320083281b9f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.1

Release history Release notifications | RSS feed

This release

0.0.6 This release

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

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