===============
yahoofinancials
===============
A python module that returns stock, cryptocurrency, forex, mutual fund, commodity futures, ETF, and US Treasury financial data from Yahoo Finance.
.. image:: https://github.com/JECSand/yahoofinancials/actions/workflows/test.yml/badge.svg?branch=master
:target: https://github.com/JECSand/yahoofinancials/actions/workflows/test.yml
.. image:: https://static.pepy.tech/badge/yahoofinancials
:target: https://pepy.tech/project/yahoofinancials
.. image:: https://static.pepy.tech/badge/yahoofinancials/month
:target: https://pepy.tech/project/yahoofinancials
.. image:: https://static.pepy.tech/badge/yahoofinancials/week
:target: https://pepy.tech/project/yahoofinancials
Current Version: v1.20
Version Released: 12/17/2023
Report any bugs by opening an issue here: https://github.com/JECSand/yahoofinancials/issues
Overview
--------
A powerful financial data module used for pulling both fundamental and technical data from Yahoo Finance.
- New analytic methods in v1.20:
- get_insights()
- returns data for:
- 'instrumentInfo'
- 'companySnapshot'
- 'recommendation'
- 'sigDevs'
- 'secReports'
- get_recommendations()
- Example:
.. code-block:: python
print(YahooFinancials('C').get_recommendations())
- Example Output:
.. code-block:: javascript
{
"C": [
{
"recommendedSymbols": [
{
"score": 0.239602,
"symbol": "BAC"
},
{
"score": 0.225134,
"symbol": "JPM"
},
{
"score": 0.167669,
"symbol": "WFC"
},
{
"score": 0.145864,
"symbol": "GS"
},
{
"score": 0.134071,
"symbol": "F"
}
],
"symbol": "C"
}
]
}
- As of Version 1.20, YahooFinancials supports a new optional parameter called flat_format.
- When `YahooFinancials(flat_format=True)`, financial statement data will return in a dict instead of a list. The keys of the dict will be the reporting dates.
- Default is False, to ensure backwards compatibility.
- As of Version 1.9, YahooFinancials supports optional parameters for asynchronous execution, proxies, and international requests.
.. code-block:: python
from yahoofinancials import YahooFinancials
tickers = ['AAPL', 'GOOG', 'C']
yahoo_financials = YahooFinancials(tickers, concurrent=True, max_workers=8, country="US")
balance_sheet_data_qt = yahoo_financials.get_financial_stmts('quarterly', 'balance')
print(balance_sheet_data_qt)
proxy_addresses = [ "mysuperproxy.com:5000", "mysuperproxy.com:5001"]
yahoo_financials = YahooFinancials(tickers, concurrent=True, proxies=proxy_addresses)
balance_sheet_data_qt = yahoo_financials.get_financial_stmts('quarterly', 'balance')
print(balance_sheet_data_qt)
Installation
-------------
- yahoofinancials runs on Python 3.7, 3.8, 3.9, 3.10, 3.11, and 3.12
1. Installation using pip:
- Linux/Mac:
.. code-block:: bash
$ pip install yahoofinancials
- Windows (If python doesn't work for you in cmd, try running the following command with just py):
.. code-block::
> python -m pip install yahoofinancials
2. Installation using github (Mac/Linux):
.. code-block:: bash
$ git clone https://github.com/JECSand/yahoofinancials.git
$ cd yahoofinancials
$ python setup.py install
3. Demo using the included demo script:
.. code-block:: bash
$ cd yahoofinancials
$ python demo.py -h
$ python demo.py
$ python demo.py WFC C BAC
4. Test using the included unit testing script:
.. code-block:: bash
$ cd yahoofinancials
$ python test/test_yahoofinancials.py
Module Methods
--------------
- The financial data from all methods is returned as JSON.
- You can run multiple symbols at once using an inputted array or run an individual symbol using an inputted string.
- YahooFinancials works with Python 3.7, 3.8, 3.9, 3.10, 3.11 and 3.12 and runs on all operating systems. (Windows, Mac, Linux).
Featured Methods
^^^^^^^^^^^^^^^^
1. get_financial_stmts(frequency, statement_type, reformat=True)
- frequency can be either 'annual' or 'quarterly'.
- statement_type can be 'income', 'balance', 'cash' or a list of several.
- reformat optional value defaulted to true. Enter False for unprocessed raw data from Yahoo Finance.
2. get_stock_price_data(reformat=True)
3. get_stock_earnings_data()
- reformat optional value defaulted to true. Enter False for unprocessed raw data from Yahoo Finance.
4. get_summary_data(reformat=True)
- Returns financial summary data for cryptocurrencies, stocks, currencies, ETFs, mutual funds, U.S. Treasuries, commodity futures, and indexes.
- reformat optional value defaulted to true. Enter False for unprocessed raw data from Yahoo Finance.
5. get_stock_quote_type_data()
6. get_historical_price_data(start_date, end_date, time_interval)
- This method will pull historical pricing data for stocks, currencies, ETFs, mutual funds, U.S. Treasuries, cryptocurrencies, commodities, and indexes.
- start_date should be entered in the 'YYYY-MM-DD' format and is the first day that data will be pulled for.
- end_date should be entered in the 'YYYY-MM-DD' format and is the last day that data will be pulled for.
- time_interval can be either 'daily', 'weekly', or 'monthly'. This variable determines the time period interval for your pull.
- Data response includes relevant pricing event data such as dividends and stock splits.
7. get_num_shares_outstanding(price_type='current')
- price_type can also be set to 'average' to calculate the shares outstanding with the daily average price.
Additional Module Methods
^^^^^^^^^^^^^^^^^^^^^^^^^
- get_daily_dividend_data(start_date, end_date)
- get_stock_profile_data()
- get_financial_data()
- get_interest_expense()
- get_operating_income()
- get_total_operating_expense()
- get_total_revenue()
- get_cost_of_revenue()
- get_income_before_tax()
- get_income_tax_expense()
- get_esg_score_data()
- get_gross_profit()
- get_net_income_from_continuing_ops()
- get_research_and_development()
- get_current_price()
- get_current_change()
- get_current_percent_change()
- get_current_volume()
- get_prev_close_price()
- get_open_price()
- get_ten_day_avg_daily_volume()
- get_stock_exchange()
- get_market_cap()
- get_daily_low()
- get_daily_high()
- get_currency()
- get_yearly_high()
- get_yearly_low()
- get_dividend_yield()
- get_annual_avg_div_yield()
- get_five_yr_avg_div_yield()
- get_dividend_rate()
- get_annual_avg_div_rate()
- get_50day_moving_avg()
- get_200day_moving_avg()
- get_beta()
- get_payout_ratio()
- get_pe_ratio()
- get_price_to_sales()
- get_exdividend_date()
- get_book_value()
- get_ebit()
- get_net_income()
- get_earnings_per_share()
- get_key_statistics_data()
- get_stock_profile_data()
- get_financial_data()
Usage Examples
--------------
- The class constructor can take either a single ticker or a list of tickers as it's parameter.
- This makes it easy to initiate multiple classes for different groupings of financial assets.
- Quarterly statement data returns the last 4 periods of data, while annual returns the last 3.
Single Ticker Example
^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
from yahoofinancials import YahooFinancials
ticker = 'AAPL'
yahoo_financials = YahooFinancials(ticker)
balance_sheet_data_qt = yahoo_financials.get_financial_stmts('quarterly', 'balance')
income_statement_data_qt = yahoo_financials.get_financial_stmts('quarterly', 'income')
all_statement_data_qt = yahoo_financials.get_financial_stmts('quarterly', ['income', 'cash', 'balance'])
apple_earnings_data = yahoo_financials.get_stock_earnings_data()
apple_net_income = yahoo_financials.get_net_income()
historical_stock_prices = yahoo_financials.get_historical_price_data('2008-09-15', '2018-09-15', 'weekly')
Lists of Tickers Example
^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
from yahoofinancials import YahooFinancials
tech_stocks = ['AAPL', 'MSFT', 'INTC']
bank_stocks = ['WFC', 'BAC', 'C']
commodity_futures = ['GC=F', 'SI=F', 'CL=F']
cryptocurrencies = ['BTC-USD', 'ETH-USD', 'XRP-USD']
currencies = ['EURUSD=X', 'JPY=X', 'GBPUSD=X']
mutual_funds = ['PRLAX', 'QASGX', 'HISFX']
us_treasuries = ['^TNX', '^IRX', '^TYX']
yahoo_financials_tech = YahooFinancials(tech_stocks)
yahoo_financials_banks = YahooFinancials(bank_stocks)
yahoo_financials_commodities = YahooFinancials(commodity_futures)
yahoo_financials_cryptocurrencies = YahooFinancials(cryptocurrencies)
yahoo_financials_currencies = YahooFinancials(currencies)
yahoo_financials_mutualfunds = YahooFinancials(mutual_funds)
yahoo_financials_treasuries = YahooFinancials(us_treasuries)
tech_cash_flow_data_an = yahoo_financials_tech.get_financial_stmts('annual', 'cash')
bank_cash_flow_data_an = yahoo_financials_banks.get_financial_stmts('annual', 'cash')
banks_net_ebit = yahoo_financials_banks.get_ebit()
tech_stock_price_data = yahoo_financials_tech.get_stock_price_data()
daily_bank_stock_prices = yahoo_financials_banks.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')
daily_commodity_prices = yahoo_financials_commodities.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')
daily_crypto_prices = yahoo_financials_cryptocurrencies.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')
daily_currency_prices = yahoo_financials_currencies.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')
daily_mutualfund_prices = yahoo_financials_mutualfunds.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')
daily_treasury_prices = yahoo_financials_treasuries.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')
Examples of Returned JSON Data
------------------------------
1. Annual Income Statement Data for Apple:
.. code-block:: python
yahoo_financials = YahooFinancials('AAPL')
print(yahoo_financials.get_financial_stmts('annual', 'income'))
.. code-block:: javascript
{
"incomeStatementHistory": {
"AAPL": [
{
"2016-09-24": {
"minorityInterest": null,
"otherOperatingExpenses": null,
"netIncomeFromContinuingOps": 45687000000,
"totalRevenue": 215639000000,
"totalOtherIncomeExpenseNet": 1348000000,
"discontinuedOperations": null,
"incomeTaxExpense": 15685000000,
"extraordinaryItems": null,
"grossProfit": 84263000000,
"netIncome": 45687000000,
"sellingGeneralAdministrative": 14194000000,
"interestExpense": null,
"costOfRevenue": 131376000000,
"researchDevelopment": 10045000000,
"netIncomeApplicableToCommonShares": 45687000000,
"effectOfAccountingCharges": null,
"incomeBeforeTax": 61372000000,
"otherItems": null,
"operatingIncome": 60024000000,
"ebit": 61372000000,
"nonRecurring": null,
"totalOperatingExpenses": 0
}
}
]
}
}
2. Annual Balance Sheet Data for Apple:
.. code-block:: python
yahoo_financials = YahooFinancials('AAPL')
print(yahoo_financials.get_financial_stmts('annual', 'balance'))
.. code-block:: javascript
{
"balanceSheetHistory": {
"AAPL": [
{
"2016-09-24": {
"otherCurrentLiab": 8080000000,
"otherCurrentAssets": 8283000000,
"goodWill": 5414000000,
"shortTermInvestments": 46671000000,
"longTermInvestments": 170430000000,
"cash": 20484000000,
"netTangibleAssets": 119629000000,
"totalAssets": 321686000000,
"otherLiab": 36074000000,
"totalStockholderEquity": 128249000000,
"inventory": 2132000000,
"retainedEarnings": 96364000000,
"intangibleAssets": 3206000000,
"totalCurrentAssets": 106869000000,
"otherStockholderEquity": 634000000,
"shortLongTermDebt": 11605000000,
"propertyPlantEquipment": 27010000000,
"deferredLongTermLiab": 2930000000,
"netReceivables": 29299000000,
"otherAssets": 8757000000,
"longTermDebt": 75427000000,
"totalLiab": 193437000000,
"commonStock": 31251000000,
"accountsPayable": 59321000000,
"totalCurrentLiabilities": 79006000000
}
}
]
}
}
3. Quarterly Cash Flow Statement Data for Citigroup:
.. code-block:: python
yahoo_financials = YahooFinancials('C')
print(yahoo_financials.get_financial_stmts('quarterly', 'cash'))
.. code-block:: javascript
{
"cashflowStatementHistoryQuarterly": {
"C": [
{
"2017-06-30": {
"totalCashFromOperatingActivities": -18505000000,
"effectOfExchangeRate": -117000000,
"totalCashFromFinancingActivities": 39798000000,
"netIncome": 3872000000,
"dividendsPaid": -760000000,
"salePurchaseOfStock": -1781000000,
"capitalExpenditures": -861000000,
"changeToLiabilities": -7626000000,
"otherCashflowsFromInvestingActivities": 82000000,
"totalCashflowsFromInvestingActivities": -22508000000,
"netBorrowings": 33586000000,
"depreciation": 901000000,
"changeInCash": -1332000000,
"changeToNetincome": 1444000000,
"otherCashflowsFromFinancingActivities": 8753000000,
"changeToOperatingActivities": -17096000000,
"investments": -23224000000
}
}
]
}
}
4. Monthly Historical Stock Price Data for Wells Fargo:
.. code-block:: python
yahoo_financials = YahooFinancials('WFC')
print(yahoo_financials.get_historical_price_data("2018-07-10", "2018-08-10", "monthly"))
.. code-block:: javascript
{
"WFC": {
"currency": "USD",
"eventsData": {
"dividends": {
"2018-08-01": {
"amount": 0.43,
"date": 1533821400,
"formatted_date": "2018-08-09"
}
}
},
"firstTradeDate": {
"date": 76233600,
"formatted_date": "1972-06-01"
},
"instrumentType": "EQUITY",
"prices": [
{
"adjclose": 57.19147872924805,
"close": 57.61000061035156,
"date": 1533096000,
"formatted_date": "2018-08-01",
"high": 59.5,
"low": 57.08000183105469,
"open": 57.959999084472656,
"volume": 138922900
}
],
"timeZone": {
"gmtOffset": -14400
}
}
}
5. Monthly Historical Price Data for EURUSD:
.. code-block:: python
yahoo_financials = YahooFinancials('EURUSD=X')
print(yahoo_financials.get_historical_price_data("2018-07-10", "2018-08-10", "monthly"))
.. code-block:: javascript
{
"EURUSD=X": {
"currency": "USD",
"eventsData": {},
"firstTradeDate": {
"date": 1070236800,
"formatted_date": "2003-12-01"
},
"instrumentType": "CURRENCY",
"prices": [
{
"adjclose": 1.1394712924957275,
"close": 1.1394712924957275,
"date": 1533078000,
"formatted_date": "2018-07-31",
"high": 1.169864296913147,
"low": 1.1365960836410522,
"open": 1.168961763381958,
"volume": 0
}
],
"timeZone": {
"gmtOffset": 3600
}
}
}
6. Monthly Historical Price Data for BTC-USD:
.. code-block:: python
yahoo_financials = YahooFinancials('BTC-USD')
print(yahoo_financials.get_historical_price_data("2018-07-10", "2018-08-10", "monthly"))
.. code-block:: javascript
{
"BTC-USD": {
"currency": "USD",
"eventsData": {},
"firstTradeDate": {
"date": 1279321200,
"formatted_date": "2010-07-16"
},
"instrumentType": "CRYPTOCURRENCY",
"prices": [
{
"adjclose": 6285.02001953125,
"close": 6285.02001953125,
"date": 1533078000,
"formatted_date": "2018-07-31",
"high": 7760.740234375,
"low": 6133.02978515625,
"open": 7736.25,
"volume": 4334347882
}
],
"timeZone": {
"gmtOffset": 3600
}
}
}
7. Weekly Historical Price Data for Crude Oil Futures:
.. code-block:: python
yahoo_financials = YahooFinancials('CL=F')
print(yahoo_financials.get_historical_price_data("2018-08-01", "2018-08-10", "weekly"))
.. code-block:: javascript
{
"CL=F": {
"currency": "USD",
"eventsData": {},
"firstTradeDate": {
"date": 1522555200,
"formatted_date": "2018-04-01"
},
"instrumentType": "FUTURE",
"prices": [
{
"adjclose": 68.58999633789062,
"close": 68.58999633789062,
"date": 1532923200,
"formatted_date": "2018-07-30",
"high": 69.3499984741211,
"low": 66.91999816894531,
"open": 68.37000274658203,
"volume": 683048039
},
{
"adjclose": 67.75,
"close": 67.75,
"date": 1533528000,
"formatted_date": "2018-08-06",
"high": 69.91999816894531,
"low": 66.13999938964844,
"open": 68.76000213623047,
"volume": 1102357981
}
],
"timeZone": {
"gmtOffset": -14400
}
}
}
8. Apple Stock Quote Data:
.. code-block:: python
yahoo_financials = YahooFinancials('AAPL')
print(yahoo_financials.get_stock_quote_type_data())
.. code-block:: javascript
{
"AAPL": {
"underlyingExchangeSymbol": null,
"exchangeTimezoneName": "America/New_York",
"underlyingSymbol": null,
"headSymbol": null,
"shortName": "Apple Inc.",
"symbol": "AAPL",
"uuid": "8b10e4ae-9eeb-3684-921a-9ab27e4d87aa",
"gmtOffSetMilliseconds": "-14400000",
"exchange": "NMS",
"exchangeTimezoneShortName": "EDT",
"messageBoardId": "finmb_24937",
"longName": "Apple Inc.",
"market": "us_market",
"quoteType": "EQUITY"
}
}
9. U.S. Treasury Current Pricing Data:
.. code-block:: python
yahoo_financials = YahooFinancials(['^TNX', '^IRX', '^TYX'])
print(yahoo_financials.get_current_price())
.. code-block:: javascript
{
"^IRX": 2.033,
"^TNX": 2.895,
"^TYX": 3.062
}
10. BTC-USD Summary Data:
.. code-block:: python
yahoo_financials = YahooFinancials('BTC-USD')
print(yahoo_financials.get_summary_data())
.. code-block:: javascript
{
"BTC-USD": {
"algorithm": "SHA256",
"ask": null,
"askSize": null,
"averageDailyVolume10Day": 545573809,
"averageVolume": 496761640,
"averageVolume10days": 545573809,
"beta": null,
"bid": null,
"bidSize": null,
"circulatingSupply": 17209812,
"currency": "USD",
"dayHigh": 6266.5,
"dayLow": 5891.87,
"dividendRate": null,
"dividendYield": null,
"exDividendDate": "-",
"expireDate": "-",
"fiftyDayAverage": 6989.074,
"fiftyTwoWeekHigh": 19870.62,
"fiftyTwoWeekLow": 2979.88,
"fiveYearAvgDividendYield": null,
"forwardPE": null,
"fromCurrency": "BTC",
"lastMarket": "CCCAGG",
"marketCap": 106325663744,
"maxAge": 1,
"maxSupply": 21000000,
"navPrice": null,
"open": 6263.2,
"openInterest": null,
"payoutRatio": null,
"previousClose": 6263.2,
"priceHint": 2,
"priceToSalesTrailing12Months": null,
"regularMarketDayHigh": 6266.5,
"regularMarketDayLow": 5891.87,
"regularMarketOpen": 6263.2,
"regularMarketPreviousClose": 6263.2,
"regularMarketVolume": 755834368,
"startDate": "2009-01-03",
"strikePrice": null,
"totalAssets": null,
"tradeable": false,
"trailingAnnualDividendRate": null,
"trailingAnnualDividendYield": null,
"twoHundredDayAverage": 8165.154,
"volume": 755834368,
"volume24Hr": 750196480,
"volumeAllCurrencies": 2673437184,
"yield": null,
"ytdReturn": null
}
}
11. Apple Key Statistics Data:
.. code-block:: python
yahoo_financials = YahooFinancials('AAPL')
print(yahoo_financials.get_key_statistics_data())
.. code-block:: javascript
{
"AAPL": {
"annualHoldingsTurnover": null,
"enterpriseToRevenue": 2.973,
"beta3Year": null,
"profitMargins": 0.22413999,
"enterpriseToEbitda": 9.652,
"52WeekChange": -0.12707871,
"morningStarRiskRating": null,
"forwardEps": 13.49,
"revenueQuarterlyGrowth": null,
"sharesOutstanding": 4729800192,
"fundInceptionDate": "-",
"annualReportExpenseRatio": null,
"totalAssets": null,
"bookValue": 22.534,
"sharesShort": 44915125,
"sharesPercentSharesOut": 0.0095,
"fundFamily": null,
"lastFiscalYearEnd": 1538179200,
"heldPercentInstitutions": 0.61208,
"netIncomeToCommon": 59531001856,
"trailingEps": 11.91,
"lastDividendValue": null,
"SandP52WeekChange": -0.06475246,
"priceToBook": 6.7582316,
"heldPercentInsiders": 0.00072999997,
"nextFiscalYearEnd": 1601337600,
"yield": null,
"mostRecentQuarter": 1538179200,
"shortRatio": 1,
"sharesShortPreviousMonthDate": "2018-10-31",
"floatShares": 4489763410,
"beta": 1.127094,
"enterpriseValue": 789555511296,
"priceHint": 2,
"threeYearAverageReturn": null,
"lastSplitDate": "2014-06-09",
"lastSplitFactor": "1/7",
"legalType": null,
"morningStarOverallRating": null,
"earningsQuarterlyGrowth": 0.318,
"priceToSalesTrailing12Months": null,
"dateShortInterest": 1543536000,
"pegRatio": 0.98,
"ytdReturn": null,
"forwardPE": 11.289103,
"maxAge": 1,
"lastCapGain": null,
"shortPercentOfFloat": 0.0088,
"sharesShortPriorMonth": 36469092,
"category": null,
"fiveYearAverageReturn": null
}
}
12. Apple and Wells Fargo Daily Dividend Data:
.. code-block:: python
start_date = '1987-09-15'
end_date = '1988-09-15'
yahoo_financials = YahooFinancials(['AAPL', 'WFC'])
print(yahoo_financials.get_daily_dividend_data(start_date, end_date))
.. code-block:: javascript
{
"AAPL": [
{
"date": 564157800,
"formatted_date": "1987-11-17",
"amount": 0.08
},
{
"date": 571674600,
"formatted_date": "1988-02-12",
"amount": 0.08
},
{
"date": 579792600,
"formatted_date": "1988-05-16",
"amount": 0.08
},
{
"date": 587655000,
"formatted_date": "1988-08-15",
"amount": 0.08
}
],
"WFC": [
{
"date": 562861800,
"formatted_date": "1987-11-02",
"amount": 0.3008
},
{
"date": 570724200,
"formatted_date": "1988-02-01",
"amount": 0.3008
},
{
"date": 578583000,
"formatted_date": "1988-05-02",
"amount": 0.3344
},
{
"date": 586445400,
"formatted_date": "1988-08-01",
"amount": 0.3344
}
]
}
13. Apple key Financial Data:
.. code-block:: python
yahoo_financials = YahooFinancials("AAPL")
print(yahoo_financials.get_financial_data())
.. code-block:: javascript
{
'AAPL': {
'ebitdaMargins': 0.29395,
'profitMargins': 0.21238,
'grossMargins': 0.37818,
'operatingCashflow': 69390999552,
'revenueGrowth': 0.018,
'operatingMargins': 0.24572,
'ebitda': 76476997632,
'targetLowPrice': 150,
'recommendationKey': 'buy',
'grossProfits': 98392000000,
'freeCashflow': 42914250752,
'targetMedianPrice': 270,
'currentPrice': 261.78,
'earningsGrowth': 0.039,
'currentRatio': 1.54,
'returnOnAssets': 0.11347,
'numberOfAnalystOpinions': 40,
'targetMeanPrice': 255.51,
'debtToEquity': 119.405,
'returnOnEquity': 0.55917,
'targetHighPrice': 300,
'totalCash': 100556996608,
'totalDebt': 108046999552,
'totalRevenue': 260174004224,
'totalCashPerShare': 22.631,
'financialCurrency': 'USD',
'maxAge': 86400,
'revenuePerShare': 56.341,
'quickRatio': 1.384,
'recommendationMean': 2.2
}
}
Raw data
{
"_id": null,
"home_page": "https://github.com/JECSand/yahoofinancials",
"name": "yahoofinancials",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "finance data,stocks,commodities,cryptocurrencies,currencies,forex,yahoo finance",
"author": "Connor Sanders",
"author_email": "connor@exceleri.com",
"download_url": "https://files.pythonhosted.org/packages/02/0c/20f6018aeb08903b4efc6f8aff1bc988c4da1be28adda21fb84bb863f58b/yahoofinancials-1.20.tar.gz",
"platform": null,
"description": "===============\nyahoofinancials\n===============\n\nA python module that returns stock, cryptocurrency, forex, mutual fund, commodity futures, ETF, and US Treasury financial data from Yahoo Finance.\n\n.. image:: https://github.com/JECSand/yahoofinancials/actions/workflows/test.yml/badge.svg?branch=master\n :target: https://github.com/JECSand/yahoofinancials/actions/workflows/test.yml\n\n.. image:: https://static.pepy.tech/badge/yahoofinancials\n :target: https://pepy.tech/project/yahoofinancials\n\n.. image:: https://static.pepy.tech/badge/yahoofinancials/month\n :target: https://pepy.tech/project/yahoofinancials\n\n.. image:: https://static.pepy.tech/badge/yahoofinancials/week\n :target: https://pepy.tech/project/yahoofinancials\n\nCurrent Version: v1.20\n\nVersion Released: 12/17/2023\n\nReport any bugs by opening an issue here: https://github.com/JECSand/yahoofinancials/issues\n\nOverview\n--------\nA powerful financial data module used for pulling both fundamental and technical data from Yahoo Finance.\n\n- New analytic methods in v1.20:\n - get_insights()\n - returns data for:\n - 'instrumentInfo'\n - 'companySnapshot'\n - 'recommendation'\n - 'sigDevs'\n - 'secReports'\n - get_recommendations()\n\n- Example:\n\n.. code-block:: python\n\n print(YahooFinancials('C').get_recommendations())\n\n- Example Output:\n\n.. code-block:: javascript\n\n {\n \"C\": [\n {\n \"recommendedSymbols\": [\n {\n \"score\": 0.239602,\n \"symbol\": \"BAC\"\n },\n {\n \"score\": 0.225134,\n \"symbol\": \"JPM\"\n },\n {\n \"score\": 0.167669,\n \"symbol\": \"WFC\"\n },\n {\n \"score\": 0.145864,\n \"symbol\": \"GS\"\n },\n {\n \"score\": 0.134071,\n \"symbol\": \"F\"\n }\n ],\n \"symbol\": \"C\"\n }\n ]\n }\n\n- As of Version 1.20, YahooFinancials supports a new optional parameter called flat_format.\n - When `YahooFinancials(flat_format=True)`, financial statement data will return in a dict instead of a list. The keys of the dict will be the reporting dates.\n - Default is False, to ensure backwards compatibility.\n\n\n- As of Version 1.9, YahooFinancials supports optional parameters for asynchronous execution, proxies, and international requests.\n\n.. code-block:: python\n\n from yahoofinancials import YahooFinancials\n tickers = ['AAPL', 'GOOG', 'C']\n yahoo_financials = YahooFinancials(tickers, concurrent=True, max_workers=8, country=\"US\")\n balance_sheet_data_qt = yahoo_financials.get_financial_stmts('quarterly', 'balance')\n print(balance_sheet_data_qt)\n\n proxy_addresses = [ \"mysuperproxy.com:5000\", \"mysuperproxy.com:5001\"]\n yahoo_financials = YahooFinancials(tickers, concurrent=True, proxies=proxy_addresses)\n balance_sheet_data_qt = yahoo_financials.get_financial_stmts('quarterly', 'balance')\n print(balance_sheet_data_qt)\n\nInstallation\n-------------\n- yahoofinancials runs on Python 3.7, 3.8, 3.9, 3.10, 3.11, and 3.12\n\n1. Installation using pip:\n\n- Linux/Mac:\n\n.. code-block:: bash\n\n $ pip install yahoofinancials\n\n- Windows (If python doesn't work for you in cmd, try running the following command with just py):\n\n.. code-block::\n\n > python -m pip install yahoofinancials\n\n2. Installation using github (Mac/Linux):\n\n.. code-block:: bash\n\n $ git clone https://github.com/JECSand/yahoofinancials.git\n $ cd yahoofinancials\n $ python setup.py install\n\n3. Demo using the included demo script:\n\n.. code-block:: bash\n\n $ cd yahoofinancials\n $ python demo.py -h\n $ python demo.py\n $ python demo.py WFC C BAC\n\n4. Test using the included unit testing script:\n\n.. code-block:: bash\n\n $ cd yahoofinancials\n $ python test/test_yahoofinancials.py\n\nModule Methods\n--------------\n- The financial data from all methods is returned as JSON.\n- You can run multiple symbols at once using an inputted array or run an individual symbol using an inputted string.\n- YahooFinancials works with Python 3.7, 3.8, 3.9, 3.10, 3.11 and 3.12 and runs on all operating systems. (Windows, Mac, Linux).\n\nFeatured Methods\n^^^^^^^^^^^^^^^^\n1. get_financial_stmts(frequency, statement_type, reformat=True)\n\n - frequency can be either 'annual' or 'quarterly'.\n - statement_type can be 'income', 'balance', 'cash' or a list of several.\n - reformat optional value defaulted to true. Enter False for unprocessed raw data from Yahoo Finance.\n2. get_stock_price_data(reformat=True)\n\n3. get_stock_earnings_data()\n\n - reformat optional value defaulted to true. Enter False for unprocessed raw data from Yahoo Finance.\n4. get_summary_data(reformat=True)\n\n - Returns financial summary data for cryptocurrencies, stocks, currencies, ETFs, mutual funds, U.S. Treasuries, commodity futures, and indexes.\n - reformat optional value defaulted to true. Enter False for unprocessed raw data from Yahoo Finance.\n5. get_stock_quote_type_data()\n\n6. get_historical_price_data(start_date, end_date, time_interval)\n\n - This method will pull historical pricing data for stocks, currencies, ETFs, mutual funds, U.S. Treasuries, cryptocurrencies, commodities, and indexes.\n - start_date should be entered in the 'YYYY-MM-DD' format and is the first day that data will be pulled for.\n - end_date should be entered in the 'YYYY-MM-DD' format and is the last day that data will be pulled for.\n - time_interval can be either 'daily', 'weekly', or 'monthly'. This variable determines the time period interval for your pull.\n - Data response includes relevant pricing event data such as dividends and stock splits.\n7. get_num_shares_outstanding(price_type='current')\n\n - price_type can also be set to 'average' to calculate the shares outstanding with the daily average price.\n\nAdditional Module Methods\n^^^^^^^^^^^^^^^^^^^^^^^^^\n- get_daily_dividend_data(start_date, end_date)\n- get_stock_profile_data()\n- get_financial_data()\n- get_interest_expense()\n- get_operating_income()\n- get_total_operating_expense()\n- get_total_revenue()\n- get_cost_of_revenue()\n- get_income_before_tax()\n- get_income_tax_expense()\n- get_esg_score_data()\n- get_gross_profit()\n- get_net_income_from_continuing_ops()\n- get_research_and_development()\n- get_current_price()\n- get_current_change()\n- get_current_percent_change()\n- get_current_volume()\n- get_prev_close_price()\n- get_open_price()\n- get_ten_day_avg_daily_volume()\n- get_stock_exchange()\n- get_market_cap()\n- get_daily_low()\n- get_daily_high()\n- get_currency()\n- get_yearly_high()\n- get_yearly_low()\n- get_dividend_yield()\n- get_annual_avg_div_yield()\n- get_five_yr_avg_div_yield()\n- get_dividend_rate()\n- get_annual_avg_div_rate()\n- get_50day_moving_avg()\n- get_200day_moving_avg()\n- get_beta()\n- get_payout_ratio()\n- get_pe_ratio()\n- get_price_to_sales()\n- get_exdividend_date()\n- get_book_value()\n- get_ebit()\n- get_net_income()\n- get_earnings_per_share()\n- get_key_statistics_data()\n- get_stock_profile_data()\n- get_financial_data()\n\nUsage Examples\n--------------\n- The class constructor can take either a single ticker or a list of tickers as it's parameter.\n- This makes it easy to initiate multiple classes for different groupings of financial assets.\n- Quarterly statement data returns the last 4 periods of data, while annual returns the last 3.\n\nSingle Ticker Example\n^^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n from yahoofinancials import YahooFinancials\n\n ticker = 'AAPL'\n yahoo_financials = YahooFinancials(ticker)\n\n balance_sheet_data_qt = yahoo_financials.get_financial_stmts('quarterly', 'balance')\n income_statement_data_qt = yahoo_financials.get_financial_stmts('quarterly', 'income')\n all_statement_data_qt = yahoo_financials.get_financial_stmts('quarterly', ['income', 'cash', 'balance'])\n apple_earnings_data = yahoo_financials.get_stock_earnings_data()\n apple_net_income = yahoo_financials.get_net_income()\n historical_stock_prices = yahoo_financials.get_historical_price_data('2008-09-15', '2018-09-15', 'weekly')\n\nLists of Tickers Example\n^^^^^^^^^^^^^^^^^^^^^^^^\n\n.. code-block:: python\n\n from yahoofinancials import YahooFinancials\n\n tech_stocks = ['AAPL', 'MSFT', 'INTC']\n bank_stocks = ['WFC', 'BAC', 'C']\n commodity_futures = ['GC=F', 'SI=F', 'CL=F']\n cryptocurrencies = ['BTC-USD', 'ETH-USD', 'XRP-USD']\n currencies = ['EURUSD=X', 'JPY=X', 'GBPUSD=X']\n mutual_funds = ['PRLAX', 'QASGX', 'HISFX']\n us_treasuries = ['^TNX', '^IRX', '^TYX']\n\n yahoo_financials_tech = YahooFinancials(tech_stocks)\n yahoo_financials_banks = YahooFinancials(bank_stocks)\n yahoo_financials_commodities = YahooFinancials(commodity_futures)\n yahoo_financials_cryptocurrencies = YahooFinancials(cryptocurrencies)\n yahoo_financials_currencies = YahooFinancials(currencies)\n yahoo_financials_mutualfunds = YahooFinancials(mutual_funds)\n yahoo_financials_treasuries = YahooFinancials(us_treasuries)\n\n tech_cash_flow_data_an = yahoo_financials_tech.get_financial_stmts('annual', 'cash')\n bank_cash_flow_data_an = yahoo_financials_banks.get_financial_stmts('annual', 'cash')\n\n banks_net_ebit = yahoo_financials_banks.get_ebit()\n tech_stock_price_data = yahoo_financials_tech.get_stock_price_data()\n daily_bank_stock_prices = yahoo_financials_banks.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')\n daily_commodity_prices = yahoo_financials_commodities.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')\n daily_crypto_prices = yahoo_financials_cryptocurrencies.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')\n daily_currency_prices = yahoo_financials_currencies.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')\n daily_mutualfund_prices = yahoo_financials_mutualfunds.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')\n daily_treasury_prices = yahoo_financials_treasuries.get_historical_price_data('2008-09-15', '2018-09-15', 'daily')\n\nExamples of Returned JSON Data\n------------------------------\n\n1. Annual Income Statement Data for Apple:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials('AAPL')\n print(yahoo_financials.get_financial_stmts('annual', 'income'))\n\n\n.. code-block:: javascript\n\n {\n \"incomeStatementHistory\": {\n \"AAPL\": [\n {\n \"2016-09-24\": {\n \"minorityInterest\": null,\n \"otherOperatingExpenses\": null,\n \"netIncomeFromContinuingOps\": 45687000000,\n \"totalRevenue\": 215639000000,\n \"totalOtherIncomeExpenseNet\": 1348000000,\n \"discontinuedOperations\": null,\n \"incomeTaxExpense\": 15685000000,\n \"extraordinaryItems\": null,\n \"grossProfit\": 84263000000,\n \"netIncome\": 45687000000,\n \"sellingGeneralAdministrative\": 14194000000,\n \"interestExpense\": null,\n \"costOfRevenue\": 131376000000,\n \"researchDevelopment\": 10045000000,\n \"netIncomeApplicableToCommonShares\": 45687000000,\n \"effectOfAccountingCharges\": null,\n \"incomeBeforeTax\": 61372000000,\n \"otherItems\": null,\n \"operatingIncome\": 60024000000,\n \"ebit\": 61372000000,\n \"nonRecurring\": null,\n \"totalOperatingExpenses\": 0\n }\n }\n ]\n }\n }\n\n2. Annual Balance Sheet Data for Apple:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials('AAPL')\n print(yahoo_financials.get_financial_stmts('annual', 'balance'))\n\n\n.. code-block:: javascript\n\n {\n \"balanceSheetHistory\": {\n \"AAPL\": [\n {\n \"2016-09-24\": {\n \"otherCurrentLiab\": 8080000000,\n \"otherCurrentAssets\": 8283000000,\n \"goodWill\": 5414000000,\n \"shortTermInvestments\": 46671000000,\n \"longTermInvestments\": 170430000000,\n \"cash\": 20484000000,\n \"netTangibleAssets\": 119629000000,\n \"totalAssets\": 321686000000,\n \"otherLiab\": 36074000000,\n \"totalStockholderEquity\": 128249000000,\n \"inventory\": 2132000000,\n \"retainedEarnings\": 96364000000,\n \"intangibleAssets\": 3206000000,\n \"totalCurrentAssets\": 106869000000,\n \"otherStockholderEquity\": 634000000,\n \"shortLongTermDebt\": 11605000000,\n \"propertyPlantEquipment\": 27010000000,\n \"deferredLongTermLiab\": 2930000000,\n \"netReceivables\": 29299000000,\n \"otherAssets\": 8757000000,\n \"longTermDebt\": 75427000000,\n \"totalLiab\": 193437000000,\n \"commonStock\": 31251000000,\n \"accountsPayable\": 59321000000,\n \"totalCurrentLiabilities\": 79006000000\n }\n }\n ]\n }\n }\n\n3. Quarterly Cash Flow Statement Data for Citigroup:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials('C')\n print(yahoo_financials.get_financial_stmts('quarterly', 'cash'))\n\n\n.. code-block:: javascript\n\n {\n \"cashflowStatementHistoryQuarterly\": {\n \"C\": [\n {\n \"2017-06-30\": {\n \"totalCashFromOperatingActivities\": -18505000000,\n \"effectOfExchangeRate\": -117000000,\n \"totalCashFromFinancingActivities\": 39798000000,\n \"netIncome\": 3872000000,\n \"dividendsPaid\": -760000000,\n \"salePurchaseOfStock\": -1781000000,\n \"capitalExpenditures\": -861000000,\n \"changeToLiabilities\": -7626000000,\n \"otherCashflowsFromInvestingActivities\": 82000000,\n \"totalCashflowsFromInvestingActivities\": -22508000000,\n \"netBorrowings\": 33586000000,\n \"depreciation\": 901000000,\n \"changeInCash\": -1332000000,\n \"changeToNetincome\": 1444000000,\n \"otherCashflowsFromFinancingActivities\": 8753000000,\n \"changeToOperatingActivities\": -17096000000,\n \"investments\": -23224000000\n }\n }\n ]\n }\n }\n\n4. Monthly Historical Stock Price Data for Wells Fargo:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials('WFC')\n print(yahoo_financials.get_historical_price_data(\"2018-07-10\", \"2018-08-10\", \"monthly\"))\n\n\n.. code-block:: javascript\n\n {\n \"WFC\": {\n \"currency\": \"USD\",\n \"eventsData\": {\n \"dividends\": {\n \"2018-08-01\": {\n \"amount\": 0.43,\n \"date\": 1533821400,\n \"formatted_date\": \"2018-08-09\"\n }\n }\n },\n \"firstTradeDate\": {\n \"date\": 76233600,\n \"formatted_date\": \"1972-06-01\"\n },\n \"instrumentType\": \"EQUITY\",\n \"prices\": [\n {\n \"adjclose\": 57.19147872924805,\n \"close\": 57.61000061035156,\n \"date\": 1533096000,\n \"formatted_date\": \"2018-08-01\",\n \"high\": 59.5,\n \"low\": 57.08000183105469,\n \"open\": 57.959999084472656,\n \"volume\": 138922900\n }\n ],\n \"timeZone\": {\n \"gmtOffset\": -14400\n }\n }\n }\n\n5. Monthly Historical Price Data for EURUSD:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials('EURUSD=X')\n print(yahoo_financials.get_historical_price_data(\"2018-07-10\", \"2018-08-10\", \"monthly\"))\n\n\n.. code-block:: javascript\n\n {\n \"EURUSD=X\": {\n \"currency\": \"USD\",\n \"eventsData\": {},\n \"firstTradeDate\": {\n \"date\": 1070236800,\n \"formatted_date\": \"2003-12-01\"\n },\n \"instrumentType\": \"CURRENCY\",\n \"prices\": [\n {\n \"adjclose\": 1.1394712924957275,\n \"close\": 1.1394712924957275,\n \"date\": 1533078000,\n \"formatted_date\": \"2018-07-31\",\n \"high\": 1.169864296913147,\n \"low\": 1.1365960836410522,\n \"open\": 1.168961763381958,\n \"volume\": 0\n }\n ],\n \"timeZone\": {\n \"gmtOffset\": 3600\n }\n }\n }\n\n6. Monthly Historical Price Data for BTC-USD:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials('BTC-USD')\n print(yahoo_financials.get_historical_price_data(\"2018-07-10\", \"2018-08-10\", \"monthly\"))\n\n\n.. code-block:: javascript\n\n {\n \"BTC-USD\": {\n \"currency\": \"USD\",\n \"eventsData\": {},\n \"firstTradeDate\": {\n \"date\": 1279321200,\n \"formatted_date\": \"2010-07-16\"\n },\n \"instrumentType\": \"CRYPTOCURRENCY\",\n \"prices\": [\n {\n \"adjclose\": 6285.02001953125,\n \"close\": 6285.02001953125,\n \"date\": 1533078000,\n \"formatted_date\": \"2018-07-31\",\n \"high\": 7760.740234375,\n \"low\": 6133.02978515625,\n \"open\": 7736.25,\n \"volume\": 4334347882\n }\n ],\n \"timeZone\": {\n \"gmtOffset\": 3600\n }\n }\n }\n\n7. Weekly Historical Price Data for Crude Oil Futures:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials('CL=F')\n print(yahoo_financials.get_historical_price_data(\"2018-08-01\", \"2018-08-10\", \"weekly\"))\n\n\n.. code-block:: javascript\n\n {\n \"CL=F\": {\n \"currency\": \"USD\",\n \"eventsData\": {},\n \"firstTradeDate\": {\n \"date\": 1522555200,\n \"formatted_date\": \"2018-04-01\"\n },\n \"instrumentType\": \"FUTURE\",\n \"prices\": [\n {\n \"adjclose\": 68.58999633789062,\n \"close\": 68.58999633789062,\n \"date\": 1532923200,\n \"formatted_date\": \"2018-07-30\",\n \"high\": 69.3499984741211,\n \"low\": 66.91999816894531,\n \"open\": 68.37000274658203,\n \"volume\": 683048039\n },\n {\n \"adjclose\": 67.75,\n \"close\": 67.75,\n \"date\": 1533528000,\n \"formatted_date\": \"2018-08-06\",\n \"high\": 69.91999816894531,\n \"low\": 66.13999938964844,\n \"open\": 68.76000213623047,\n \"volume\": 1102357981\n }\n ],\n \"timeZone\": {\n \"gmtOffset\": -14400\n }\n }\n }\n\n8. Apple Stock Quote Data:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials('AAPL')\n print(yahoo_financials.get_stock_quote_type_data())\n\n\n.. code-block:: javascript\n\n {\n \"AAPL\": {\n \"underlyingExchangeSymbol\": null,\n \"exchangeTimezoneName\": \"America/New_York\",\n \"underlyingSymbol\": null,\n \"headSymbol\": null,\n \"shortName\": \"Apple Inc.\",\n \"symbol\": \"AAPL\",\n \"uuid\": \"8b10e4ae-9eeb-3684-921a-9ab27e4d87aa\",\n \"gmtOffSetMilliseconds\": \"-14400000\",\n \"exchange\": \"NMS\",\n \"exchangeTimezoneShortName\": \"EDT\",\n \"messageBoardId\": \"finmb_24937\",\n \"longName\": \"Apple Inc.\",\n \"market\": \"us_market\",\n \"quoteType\": \"EQUITY\"\n }\n }\n\n9. U.S. Treasury Current Pricing Data:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials(['^TNX', '^IRX', '^TYX'])\n print(yahoo_financials.get_current_price())\n\n\n.. code-block:: javascript\n\n {\n \"^IRX\": 2.033,\n \"^TNX\": 2.895,\n \"^TYX\": 3.062\n }\n\n10. BTC-USD Summary Data:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials('BTC-USD')\n print(yahoo_financials.get_summary_data())\n\n\n.. code-block:: javascript\n\n {\n \"BTC-USD\": {\n \"algorithm\": \"SHA256\",\n \"ask\": null,\n \"askSize\": null,\n \"averageDailyVolume10Day\": 545573809,\n \"averageVolume\": 496761640,\n \"averageVolume10days\": 545573809,\n \"beta\": null,\n \"bid\": null,\n \"bidSize\": null,\n \"circulatingSupply\": 17209812,\n \"currency\": \"USD\",\n \"dayHigh\": 6266.5,\n \"dayLow\": 5891.87,\n \"dividendRate\": null,\n \"dividendYield\": null,\n \"exDividendDate\": \"-\",\n \"expireDate\": \"-\",\n \"fiftyDayAverage\": 6989.074,\n \"fiftyTwoWeekHigh\": 19870.62,\n \"fiftyTwoWeekLow\": 2979.88,\n \"fiveYearAvgDividendYield\": null,\n \"forwardPE\": null,\n \"fromCurrency\": \"BTC\",\n \"lastMarket\": \"CCCAGG\",\n \"marketCap\": 106325663744,\n \"maxAge\": 1,\n \"maxSupply\": 21000000,\n \"navPrice\": null,\n \"open\": 6263.2,\n \"openInterest\": null,\n \"payoutRatio\": null,\n \"previousClose\": 6263.2,\n \"priceHint\": 2,\n \"priceToSalesTrailing12Months\": null,\n \"regularMarketDayHigh\": 6266.5,\n \"regularMarketDayLow\": 5891.87,\n \"regularMarketOpen\": 6263.2,\n \"regularMarketPreviousClose\": 6263.2,\n \"regularMarketVolume\": 755834368,\n \"startDate\": \"2009-01-03\",\n \"strikePrice\": null,\n \"totalAssets\": null,\n \"tradeable\": false,\n \"trailingAnnualDividendRate\": null,\n \"trailingAnnualDividendYield\": null,\n \"twoHundredDayAverage\": 8165.154,\n \"volume\": 755834368,\n \"volume24Hr\": 750196480,\n \"volumeAllCurrencies\": 2673437184,\n \"yield\": null,\n \"ytdReturn\": null\n }\n }\n\n11. Apple Key Statistics Data:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials('AAPL')\n print(yahoo_financials.get_key_statistics_data())\n\n\n.. code-block:: javascript\n\n {\n \"AAPL\": {\n \"annualHoldingsTurnover\": null,\n \"enterpriseToRevenue\": 2.973,\n \"beta3Year\": null,\n \"profitMargins\": 0.22413999,\n \"enterpriseToEbitda\": 9.652,\n \"52WeekChange\": -0.12707871,\n \"morningStarRiskRating\": null,\n \"forwardEps\": 13.49,\n \"revenueQuarterlyGrowth\": null,\n \"sharesOutstanding\": 4729800192,\n \"fundInceptionDate\": \"-\",\n \"annualReportExpenseRatio\": null,\n \"totalAssets\": null,\n \"bookValue\": 22.534,\n \"sharesShort\": 44915125,\n \"sharesPercentSharesOut\": 0.0095,\n \"fundFamily\": null,\n \"lastFiscalYearEnd\": 1538179200,\n \"heldPercentInstitutions\": 0.61208,\n \"netIncomeToCommon\": 59531001856,\n \"trailingEps\": 11.91,\n \"lastDividendValue\": null,\n \"SandP52WeekChange\": -0.06475246,\n \"priceToBook\": 6.7582316,\n \"heldPercentInsiders\": 0.00072999997,\n \"nextFiscalYearEnd\": 1601337600,\n \"yield\": null,\n \"mostRecentQuarter\": 1538179200,\n \"shortRatio\": 1,\n \"sharesShortPreviousMonthDate\": \"2018-10-31\",\n \"floatShares\": 4489763410,\n \"beta\": 1.127094,\n \"enterpriseValue\": 789555511296,\n \"priceHint\": 2,\n \"threeYearAverageReturn\": null,\n \"lastSplitDate\": \"2014-06-09\",\n \"lastSplitFactor\": \"1/7\",\n \"legalType\": null,\n \"morningStarOverallRating\": null,\n \"earningsQuarterlyGrowth\": 0.318,\n \"priceToSalesTrailing12Months\": null,\n \"dateShortInterest\": 1543536000,\n \"pegRatio\": 0.98,\n \"ytdReturn\": null,\n \"forwardPE\": 11.289103,\n \"maxAge\": 1,\n \"lastCapGain\": null,\n \"shortPercentOfFloat\": 0.0088,\n \"sharesShortPriorMonth\": 36469092,\n \"category\": null,\n \"fiveYearAverageReturn\": null\n }\n }\n\n12. Apple and Wells Fargo Daily Dividend Data:\n\n\n.. code-block:: python\n\n start_date = '1987-09-15'\n end_date = '1988-09-15'\n yahoo_financials = YahooFinancials(['AAPL', 'WFC'])\n print(yahoo_financials.get_daily_dividend_data(start_date, end_date))\n\n\n.. code-block:: javascript\n\n {\n \"AAPL\": [\n {\n \"date\": 564157800,\n \"formatted_date\": \"1987-11-17\",\n \"amount\": 0.08\n },\n {\n \"date\": 571674600,\n \"formatted_date\": \"1988-02-12\",\n \"amount\": 0.08\n },\n {\n \"date\": 579792600,\n \"formatted_date\": \"1988-05-16\",\n \"amount\": 0.08\n },\n {\n \"date\": 587655000,\n \"formatted_date\": \"1988-08-15\",\n \"amount\": 0.08\n }\n ],\n \"WFC\": [\n {\n \"date\": 562861800,\n \"formatted_date\": \"1987-11-02\",\n \"amount\": 0.3008\n },\n {\n \"date\": 570724200,\n \"formatted_date\": \"1988-02-01\",\n \"amount\": 0.3008\n },\n {\n \"date\": 578583000,\n \"formatted_date\": \"1988-05-02\",\n \"amount\": 0.3344\n },\n {\n \"date\": 586445400,\n \"formatted_date\": \"1988-08-01\",\n \"amount\": 0.3344\n }\n ]\n }\n\n13. Apple key Financial Data:\n\n\n.. code-block:: python\n\n yahoo_financials = YahooFinancials(\"AAPL\")\n print(yahoo_financials.get_financial_data())\n\n\n.. code-block:: javascript\n\n {\n 'AAPL': {\n 'ebitdaMargins': 0.29395,\n 'profitMargins': 0.21238,\n 'grossMargins': 0.37818,\n 'operatingCashflow': 69390999552,\n 'revenueGrowth': 0.018,\n 'operatingMargins': 0.24572,\n 'ebitda': 76476997632,\n 'targetLowPrice': 150,\n 'recommendationKey': 'buy',\n 'grossProfits': 98392000000,\n 'freeCashflow': 42914250752,\n 'targetMedianPrice': 270,\n 'currentPrice': 261.78,\n 'earningsGrowth': 0.039,\n 'currentRatio': 1.54,\n 'returnOnAssets': 0.11347,\n 'numberOfAnalystOpinions': 40,\n 'targetMeanPrice': 255.51,\n 'debtToEquity': 119.405,\n 'returnOnEquity': 0.55917,\n 'targetHighPrice': 300,\n 'totalCash': 100556996608,\n 'totalDebt': 108046999552,\n 'totalRevenue': 260174004224,\n 'totalCashPerShare': 22.631,\n 'financialCurrency': 'USD',\n 'maxAge': 86400,\n 'revenuePerShare': 56.341,\n 'quickRatio': 1.384,\n 'recommendationMean': 2.2\n }\n }\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A powerful financial data module used for pulling both fundamental and technical data from Yahoo Finance",
"version": "1.20",
"project_urls": {
"Download": "https://github.com/JECSand/yahoofinancials/archive/1.20.tar.gz",
"Homepage": "https://github.com/JECSand/yahoofinancials"
},
"split_keywords": [
"finance data",
"stocks",
"commodities",
"cryptocurrencies",
"currencies",
"forex",
"yahoo finance"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7e849e8fdb506e4646bc929db852eb53e1031a0cce91fbb12029d76b6baedf19",
"md5": "57d678d3600011e201814f7c0d5db721",
"sha256": "913145aed13f716ac25c7acec182ccd10d7a4deb32db634bf63ca18316cf4b8f"
},
"downloads": -1,
"filename": "yahoofinancials-1.20-py2-none-any.whl",
"has_sig": false,
"md5_digest": "57d678d3600011e201814f7c0d5db721",
"packagetype": "bdist_wheel",
"python_version": "py2",
"requires_python": null,
"size": 46652,
"upload_time": "2023-12-17T08:03:40",
"upload_time_iso_8601": "2023-12-17T08:03:40.122894Z",
"url": "https://files.pythonhosted.org/packages/7e/84/9e8fdb506e4646bc929db852eb53e1031a0cce91fbb12029d76b6baedf19/yahoofinancials-1.20-py2-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "020c20f6018aeb08903b4efc6f8aff1bc988c4da1be28adda21fb84bb863f58b",
"md5": "c67242487926acf427d97874ea0d8e62",
"sha256": "015dd48d5518f3dd822a7eebf2b26ae3c4de22392bc4a1303ded73b85f6b6228"
},
"downloads": -1,
"filename": "yahoofinancials-1.20.tar.gz",
"has_sig": false,
"md5_digest": "c67242487926acf427d97874ea0d8e62",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 51867,
"upload_time": "2023-12-17T08:03:42",
"upload_time_iso_8601": "2023-12-17T08:03:42.827171Z",
"url": "https://files.pythonhosted.org/packages/02/0c/20f6018aeb08903b4efc6f8aff1bc988c4da1be28adda21fb84bb863f58b/yahoofinancials-1.20.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-17 08:03:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "JECSand",
"github_project": "yahoofinancials",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "yahoofinancials"
}