### Install yahoofinancials Python Module from GitHub Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Steps to install the `yahoofinancials` library directly from its GitHub repository on Mac/Linux systems, involving cloning the repository and running the setup script. ```bash $ git clone https://github.com/JECSand/yahoofinancials.git $ cd yahoofinancials $ python setup.py install ``` -------------------------------- ### Run yahoofinancials Demo Script Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Commands to navigate to the `yahoofinancials` directory and execute the included demo script, showing how to get help and run it with or without specific stock symbols. ```bash $ cd yahoofinancials $ python demo.py -h $ python demo.py $ python demo.py WFC C BAC ``` -------------------------------- ### Install yahoofinancials Python Module via pip Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Instructions for installing the `yahoofinancials` library using the pip package manager on both Linux/Mac and Windows operating systems. ```bash $ pip install yahoofinancials ``` ```bash > python -m pip install yahoofinancials ``` -------------------------------- ### Retrieve Stock Recommendations using yahoofinancials Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Demonstrates how to use the `get_recommendations()` method of the `YahooFinancials` module to fetch stock recommendations for a given symbol, along with an example of the JSON output structure. ```python print(YahooFinancials('C').get_recommendations()) ``` ```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" } ] } ``` -------------------------------- ### Retrieve Historical Price Data for Financial Instruments using Python Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst This snippet demonstrates how to fetch historical price data for various financial instruments (stocks, currencies, cryptocurrencies, futures) using the `YahooFinancials` Python library. It shows examples for monthly and weekly data retrieval, specifying start date, end date, and interval. The output is a JSON object containing detailed historical price information. ```python yahoo_financials = YahooFinancials('WFC') print(yahoo_financials.get_historical_price_data("2018-07-10", "2018-08-10", "monthly")) ``` ```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 } } } ``` ```python yahoo_financials = YahooFinancials('EURUSD=X') print(yahoo_financials.get_historical_price_data("2018-07-10", "2018-08-10", "monthly")) ``` ```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 } } } ``` ```python yahoo_financials = YahooFinancials('BTC-USD') print(yahoo_financials.get_historical_price_data("2018-07-10", "2018-08-10", "monthly")) ``` ```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 } } } ``` ```python yahoo_financials = YahooFinancials('CL=F') print(yahoo_financials.get_historical_price_data("2018-08-01", "2018-08-10", "weekly")) ``` ```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": 3600 } } } ``` -------------------------------- ### Fetch Annual Balance Sheet and Example JSON Response Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Shows how to obtain annual balance sheet data for a stock (e.g., Apple) using the `get_financial_stmts` method. It also provides a sample JSON structure of the returned balance sheet data, detailing various assets, liabilities, and equity components for a given fiscal year. ```python yahoo_financials = YahooFinancials('AAPL') print(yahoo_financials.get_financial_stmts('annual', 'balance')) ``` ```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 } } ] } } ``` -------------------------------- ### Get BTC-USD Cryptocurrency Summary Data Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Shows how to obtain comprehensive summary data for the BTC-USD cryptocurrency pair. The Python code uses YahooFinancials, and the accompanying JSON output includes various metrics such as market cap, daily high/low, volume, and 52-week ranges. ```python yahoo_financials = YahooFinancials('BTC-USD') print(yahoo_financials.get_summary_data()) ``` ```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 } } ``` -------------------------------- ### Fetch Annual Income Statement and Example JSON Response Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Illustrates how to retrieve annual income statement data for a specific stock (e.g., Apple) using the `get_financial_stmts` method. It also provides a sample JSON structure of the returned income statement data, detailing various financial metrics for a given fiscal year. ```python yahoo_financials = YahooFinancials('AAPL') print(yahoo_financials.get_financial_stmts('annual', 'income')) ``` ```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 } } ] } } ``` -------------------------------- ### Fetch Quarterly Cash Flow Statement and Example JSON Response Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Demonstrates how to retrieve quarterly cash flow statement data for a specific company (e.g., Citigroup) using the `get_financial_stmts` method. It also provides a sample JSON structure of the returned cash flow data, detailing various cash inflows and outflows from operating, investing, and financing activities. ```python yahoo_financials = YahooFinancials('C') print(yahoo_financials.get_financial_stmts('quarterly', 'cash')) ``` ```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 } } ] } } ``` -------------------------------- ### Retrieve Historical Price Data with YahooFinancials Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Demonstrates how to fetch daily historical price data for various asset types (currencies, mutual funds, treasuries) using the `get_historical_price_data` method of the YahooFinancials library. It specifies start and end dates, and the frequency of the data. ```python 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') ``` -------------------------------- ### Retrieve Financial Data for a Single Ticker Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst This example demonstrates how to initialize the `YahooFinancials` class with a single ticker symbol and retrieve various financial data points, including balance sheets, income statements, cash flow statements, earnings data, net income, and historical stock prices. ```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') ``` -------------------------------- ### Retrieve Financial Data for Lists of Tickers Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst This example illustrates how to use the `YahooFinancials` class to fetch financial data for multiple ticker symbols by initializing separate instances for different groups of assets (e.g., tech stocks, bank stocks, commodities, cryptocurrencies). It shows how to retrieve annual cash flow data, EBIT, stock price data, and daily historical prices for various asset classes. ```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') ``` -------------------------------- ### Run yahoofinancials Unit Tests Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Instructions to execute the unit testing script provided with the `yahoofinancials` module to verify its functionality. ```bash $ cd yahoofinancials $ python test/test_yahoofinancials.py ``` -------------------------------- ### Initialize YahooFinancials for Concurrent and Proxy-Based Data Retrieval Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Illustrates how to initialize the `YahooFinancials` object for concurrent data fetching across multiple tickers and how to configure it to use a list of proxy addresses for requests. This improves performance and allows bypassing geo-restrictions. ```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) ``` ```python 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) ``` -------------------------------- ### YahooFinancials Module Methods Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Detailed documentation for key methods available in the `yahoofinancials` Python module, including parameters, return types, and usage notes. All methods return data in JSON format and support single or multiple symbols. ```APIDOC get_insights() - Returns data for: 'instrumentInfo', 'companySnapshot', 'recommendation', 'sigDevs', 'secReports' get_recommendations() get_financial_stmts(frequency: str, statement_type: str | list, reformat: bool = 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. Set to False for unprocessed raw data from Yahoo Finance. get_stock_price_data(reformat: bool = True) - reformat: Optional value, defaulted to True. Set to False for unprocessed raw data from Yahoo Finance. get_stock_earnings_data(reformat: bool = True) - reformat: Optional value, defaulted to True. Set to False for unprocessed raw data from Yahoo Finance. get_summary_data(reformat: bool = True) - reformat: Optional value, defaulted to True. Set to False for unprocessed raw data from Yahoo Finance. ``` -------------------------------- ### YahooFinancials Class Initialization and Core Methods Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst This API documentation describes the initialization of the `YahooFinancials` class and its primary methods for retrieving financial data. The class can be initialized with a single ticker symbol or a list of ticker symbols. Methods cover fetching financial statements, stock earnings, and historical price data. ```APIDOC YahooFinancials(ticker_or_tickers) - Initializes the YahooFinancials class. - Parameters: - ticker_or_tickers: A string representing a single ticker symbol (e.g., 'AAPL') or a list of ticker symbols (e.g., ['AAPL', 'MSFT']). get_financial_stmts(statement_type, statement_name) - 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. - Parameters: - statement_type: String, either 'quarterly' (returns last 4 periods) or 'annual' (returns last 3 periods). - statement_name: String, the type of financial statement, e.g., 'balance', 'income', 'cash', or a list of these. - Returns: Dictionary containing the requested financial statement data. get_stock_earnings_data() - Retrieves stock earnings data. - Returns: Dictionary containing stock earnings data. get_historical_price_data(start_date, end_date, time_interval) - Pulls historical pricing data for stocks, currencies, ETFs, mutual funds, U.S. Treasuries, cryptocurrencies, commodities, and indexes. - Data response includes relevant pricing event data such as dividends and stock splits. - Parameters: - start_date: String, the first day for data pull, in 'YYYY-MM-DD' format. - end_date: String, the last day for data pull, in 'YYYY-MM-DD' format. - time_interval: String, determines the time period interval, can be 'daily', 'weekly', or 'monthly'. - Returns: Dictionary containing historical price data. get_num_shares_outstanding(price_type='current') - Retrieves the number of shares outstanding. - Parameters: - price_type: String, can be 'current' (default) or 'average' to calculate shares outstanding with the daily average price. - Returns: Number of shares outstanding. get_stock_quote_type_data() - Retrieves stock quote type data. - Returns: Dictionary containing stock quote type data. ``` -------------------------------- ### YahooFinancials Additional Module Methods Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst This section documents various additional methods available in the `yahoofinancials` library for retrieving specific financial metrics and data points. These methods cover a wide range of financial indicators, from dividend information and market capitalization to key statistics and moving averages. ```APIDOC get_daily_dividend_data(start_date, end_date) - Retrieves daily dividend data. get_stock_profile_data() - Retrieves stock profile data. get_financial_data() - Retrieves general financial data. get_interest_expense() - Retrieves interest expense. get_operating_income() - Retrieves operating income. get_total_operating_expense() - Retrieves total operating expense. get_total_revenue() - Retrieves total revenue. get_cost_of_revenue() - Retrieves cost of revenue. get_income_before_tax() - Retrieves income before tax. get_income_tax_expense() - Retrieves income tax expense. get_esg_score_data() - Retrieves ESG (Environmental, Social, Governance) score data. get_gross_profit() - Retrieves gross profit. get_net_income_from_continuing_ops() - Retrieves net income from continuing operations. get_research_and_development() - Retrieves research and development expenses. get_current_price() - Retrieves the current price. get_current_change() - Retrieves the current change in price. get_current_percent_change() - Retrieves the current percentage change in price. get_current_volume() - Retrieves the current trading volume. get_prev_close_price() - Retrieves the previous close price. get_open_price() - Retrieves the opening price. get_ten_day_avg_daily_volume() - Retrieves the ten-day average daily volume. get_stock_exchange() - Retrieves the stock exchange. get_market_cap() - Retrieves the market capitalization. get_daily_low() - Retrieves the daily low price. get_daily_high() - Retrieves the daily high price. get_currency() - Retrieves the currency. get_yearly_high() - Retrieves the yearly high price. get_yearly_low() - Retrieves the yearly low price. get_dividend_yield() - Retrieves the dividend yield. get_annual_avg_div_yield() - Retrieves the annual average dividend yield. get_five_yr_avg_div_yield() - Retrieves the five-year average dividend yield. get_dividend_rate() - Retrieves the dividend rate. get_annual_avg_div_rate() - Retrieves the annual average dividend rate. get_50day_moving_avg() - Retrieves the 50-day moving average. get_200day_moving_avg() - Retrieves the 200-day moving average. get_beta() - Retrieves the beta value. get_payout_ratio() - Retrieves the payout ratio. get_pe_ratio() - Retrieves the Price-to-Earnings (P/E) ratio. get_price_to_sales() - Retrieves the Price-to-Sales ratio. get_exdividend_date() - Retrieves the ex-dividend date. get_book_value() - Retrieves the book value. get_ebit() - Retrieves Earnings Before Interest and Taxes (EBIT). get_net_income() - Retrieves net income. get_earnings_per_share() - Retrieves Earnings Per Share (EPS). get_key_statistics_data() - Retrieves key statistics data. ``` -------------------------------- ### Retrieve Key Financial Data for a Stock Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Illustrates how to fetch comprehensive key financial metrics for a single stock ticker (e.g., AAPL) using the YahooFinancials library. The output provides various financial ratios, growth rates, and balance sheet items such as EBITDA margins, profit margins, operating cash flow, and total revenue. ```python yahoo_financials = YahooFinancials("AAPL") print(yahoo_financials.get_financial_data()) ``` ```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 } } ``` -------------------------------- ### Fetch U.S. Treasury Current Pricing Data Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Illustrates how to retrieve the current pricing data for multiple U.S. Treasury bonds (e.g., ^TNX, ^IRX, ^TYX) using the YahooFinancials library. The output provides the current price for each specified treasury symbol. ```python yahoo_financials = YahooFinancials(['^TNX', '^IRX', '^TYX']) print(yahoo_financials.get_current_price()) ``` ```javascript { "^IRX": 2.033, "^TNX": 2.895, "^TYX": 3.062 } ``` -------------------------------- ### Retrieve Apple Key Statistics Data Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Demonstrates fetching key financial statistics for Apple Inc. (AAPL) using the YahooFinancials library. The JSON output provides a wide array of statistical data, including profit margins, shares outstanding, enterprise value, and various ratios. ```python yahoo_financials = YahooFinancials('AAPL') print(yahoo_financials.get_key_statistics_data()) ``` ```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" } } ``` -------------------------------- ### Fetch Daily Dividend Data for Stocks Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Demonstrates how to retrieve historical daily dividend data for specified stock tickers (e.g., AAPL, WFC) using the YahooFinancials library. The output shows the date, formatted date, and amount of dividends paid for each stock within the given date range. ```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)) ``` ```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 } ] } ``` -------------------------------- ### Retrieve Apple Stock Quote Type Data Source: https://github.com/jecsand/yahoofinancials/blob/master/README.rst Demonstrates how to fetch detailed stock quote type information for Apple Inc. (AAPL) using the YahooFinancials library in Python. The corresponding JSON output shows various attributes like exchange, timezone, short/long name, symbol, and quote type. ```python yahoo_financials = YahooFinancials('AAPL') print(yahoo_financials.get_stock_quote_type_data()) ``` ```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" } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.