Skip to main content

A python wrapper around the yahoo finance API that leverages pandas DataFrames

Project description

A simple asyncronous wrapper around the public yahoo finance API

While the yahoo finance website is clunky and basic - underlying it is a very powerful API that is primarily powered by refinitiv data. Many python packages have attempted to implement wrappers around this API, however they fall short for one of two reasons. Either they don’t expose all of the available endpoints of the API, or they are syncronous / rely on threading which is less efficient for IO bound tasks.

yfinhanced attempts to solve both of these issues by providing access to the full range of endpoints, and using pythons modern asyncronous support in asyncio and aiohttp. As a result, this package is extremely fast and feature complete.

You can find the full documentation at: https://me-64.github.io/yfinhanced

>>> from yfinhanced import YFClient
>>> yf = YFClient()
>>> await yf.connect()
>>> quote = await yf.get_quote(['AAPL', 'BTC-USD', 'BYND220401C00030000', 'GC=F', 'AZN.L'])
>>> print(quote['AAPL'])
{'language': 'en-US',
'region': 'US',
'quoteType': 'EQUITY',
'typeDisp': 'Equity',
'quoteSourceName': 'Nasdaq Real Time Price',
'triggerable': True,
'customPriceAlertConfidence': 'HIGH',
'currency': 'USD',
'exchange': 'NMS',
'shortName': 'Apple Inc.',
'longName': 'Apple Inc.',
'messageBoardId': 'finmb_24937',
'exchangeTimezoneName': 'America/New_York',
'exchangeTimezoneShortName': 'EDT',
'gmtOffSetMilliseconds': -14400000,
'market': 'us_market',
'esgPopulated': False,
'fullExchangeName': 'NasdaqGS',
'financialCurrency': 'USD',
'regularMarketOpen': 167.99,
'averageDailyVolume3Month': 93351350,
'averageDailyVolume10Day': 97387620,
'fiftyTwoWeekLowChange': 51.429993,
'fiftyTwoWeekLowChangePercent': 0.43269387,
'fiftyTwoWeekRange': '118.86 - 182.94',
'fiftyTwoWeekHighChange': -12.650009,
'fiftyTwoWeekHighChangePercent': -0.06914841,
'fiftyTwoWeekLow': 118.86,
'fiftyTwoWeekHigh': 182.94,
'dividendDate': 1644451200,
'earningsTimestamp': 1643301000,
'earningsTimestampStart': 1651003200,
'earningsTimestampEnd': 1651521600,
'trailingAnnualDividendRate': 0.865,
'trailingPE': 28.310888,
'trailingAnnualDividendYield': 0.0051238,
'epsTrailingTwelveMonths': 6.015,
'epsForward': 6.56,
'epsCurrentYear': 6.16,
'priceEpsCurrentYear': 27.64448,
'sharesOutstanding': 16319399936,
'bookValue': 4.402,
'fiftyDayAverage': 166.388,
'fiftyDayAverageChange': 3.9019928,
'fiftyDayAverageChangePercent': 0.023451166,
'twoHundredDayAverage': 154.8563,
'twoHundredDayAverageChange': 15.433701,
'twoHundredDayAverageChangePercent': 0.099664666,
'marketCap': 2779030487040,
'forwardPE': 25.958841,
'priceToBook': 38.68469,
'sourceInterval': 15,
'exchangeDataDelayedBy': 0,
'firstTradeDateMilliseconds': 345479400000,
'priceHint': 2,
'regularMarketChange': 1.469986,
'regularMarketChangePercent': 0.87074155,
'regularMarketTime': 1648046328,
'regularMarketPrice': 170.29,
'regularMarketDayHigh': 170.76,
'regularMarketDayRange': '167.65 - 170.76',
'regularMarketDayLow': 167.65,
'regularMarketVolume': 24929352,
'regularMarketPreviousClose': 168.82,
'bid': 170.08,
'ask': 170.13,
'bidSize': 12,
'askSize': 8,
'marketState': 'REGULAR',
'pageViewGrowthWeekly': -0.10239728,
'averageAnalystRating': '1.8 - Buy',
'tradeable': False,
'displayName': 'Apple'}

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

yfinhanced-0.1.11.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

yfinhanced-0.1.11-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file yfinhanced-0.1.11.tar.gz.

File metadata

  • Download URL: yfinhanced-0.1.11.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for yfinhanced-0.1.11.tar.gz
Algorithm Hash digest
SHA256 b35f7a3a26ccc3e42c636b9a507802d9ac36162e205b8a2feb06dad19f13c68a
MD5 3a1ae993be62d54f8a267730cb0ab55b
BLAKE2b-256 ef8cccc39af800de1fdf0c645b4ff9bdec85d60d836e0a2152dfd9330bfc7b1f

See more details on using hashes here.

File details

Details for the file yfinhanced-0.1.11-py3-none-any.whl.

File metadata

  • Download URL: yfinhanced-0.1.11-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.2

File hashes

Hashes for yfinhanced-0.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 4db9ddbff5a4d67b1774b144d029470fbb5c539de1b004791049599d054a4d3a
MD5 f472dd680b5381366a7800205faed046
BLAKE2b-256 be9ebc9d754b3c45abfffdd3da1d1e25e078565397ac51d80ecb894ca6715688

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page