Yahoo Finance (API)¶
Following functions will extract data from Yahoo Finance API. The data includes price, corporate actions, financial statements, valuation measures, company profile, analyst estimates, ownership, SEC filings, ETF and fund data, options and search.
Important
In each result dataframe, only the first 5 rows of the DataFrame are shown at most to keep the documentation concise. The actual DataFrame returned by each function may contain more rows.
Price¶
Parameters:
range: The time period over which to retrieve historical data.Options include:
1d: 1 day5d: 5 days1mo: 1 month3mo: 3 months6mo: 6 months1y: 1 year2y: 2 years5y: 5 years10y: 10 yearsytd: Year to datemax: Maximum available data
dataGranularity: The frequency of the data points.Options include:
1m: 1 minute2m: 2 minutes5m: 5 minutes15m: 15 minutes30m: 30 minutes60m: 60 minutes90m: 90 minutes1h: 1 hour1d: 1 day5d: 5 days1wk: 1 week1mo: 1 month3mo: 3 months
from stockdex import Ticker
ticker = Ticker(ticker="AMZN")
result = ticker.yahoo_api_price(range='1y', dataGranularity='1d')
Results:
timestamp |
volume |
close |
open |
high |
low |
currency |
timezone |
exchangeTimezoneName |
exchangeName |
instrumentType |
|
|---|---|---|---|---|---|---|---|---|---|---|---|
0 |
2024-10-04 13:30:00 |
40890300 |
186.51 |
185.75 |
187.6 |
183.6 |
USD |
EDT |
America/New_York |
NMS |
EQUITY |
1 |
2024-10-07 13:30:00 |
42364200 |
180.8 |
182.95 |
183.6 |
180.25 |
USD |
EDT |
America/New_York |
NMS |
EQUITY |
2 |
2024-10-08 13:30:00 |
26372100 |
182.72 |
181.92 |
183.09 |
180.92 |
USD |
EDT |
America/New_York |
NMS |
EQUITY |
3 |
2024-10-09 13:30:00 |
26343100 |
185.17 |
182.82 |
185.85 |
182.05 |
USD |
EDT |
America/New_York |
NMS |
EQUITY |
4 |
2024-10-10 13:30:00 |
27785000 |
186.65 |
187.13 |
188.13 |
185.83 |
USD |
EDT |
America/New_York |
NMS |
EQUITY |
Current Trading Period¶
from stockdex import Ticker
ticker = Ticker(ticker="AMZN")
result = ticker.yahoo_api_current_trading_period
Results:
pre |
regular |
post |
|
|---|---|---|---|
timezone |
EDT |
EDT |
EDT |
start |
2025-10-03 08:00:00 |
2025-10-03 13:30:00 |
2025-10-03 20:00:00 |
end |
2025-10-03 13:30:00 |
2025-10-03 20:00:00 |
2025-10-04 00:00:00 |
gmtoffset |
-14400 |
-14400 |
-14400 |
Income Statement¶
Get the income statement for the stock
Parameters:
frequency: The frequency of the income statement data.Options include:
annual: Annual income statement dataquarterly: Quarterly income statement data
format: The format of the returned data.Options include:
fmt: Formatted data with human-readable valuesraw: Raw data with numerical values
period1: The start date for the data retrieval (default is 5 years ago from today).period2: The end date for the data retrieval (default is today).
from stockdex import Ticker
ticker = Ticker(ticker="NVDA")
result = ticker.yahoo_api_income_statement(frequency='quarterly')
Results:
annualDilutedNIAvailtoComStockholders |
annualNetIncome |
annualPretaxIncome |
annualInterestExpense |
annualTotalUnusualItems |
annualDilutedEPS |
annualTotalUnusualItemsExcludingGoodwill |
annualInterestExpenseNonOperating |
annualWriteOff |
annualCostOfRevenue |
annualTotalRevenue |
annualTaxRateForCalcs |
annualInterestIncome |
annualTotalExpenses |
annualNetIncomeCommonStockholders |
annualResearchAndDevelopment |
annualOperatingRevenue |
annualGrossProfit |
annualOtherNonOperatingIncomeExpenses |
annualSellingGeneralAndAdministration |
annualNetIncomeIncludingNoncontrollingInterests |
annualSpecialIncomeCharges |
annualOtherGandA |
annualNormalizedEBITDA |
annualBasicAverageShares |
annualInterestIncomeNonOperating |
annualReconciledDepreciation |
annualNormalizedIncome |
annualNetIncomeContinuousOperations |
annualNetIncomeFromContinuingOperationNetMinorityInterest |
annualEBITDA |
annualOperatingExpense |
annualNetIncomeFromContinuingAndDiscontinuedOperation |
annualNetInterestIncome |
annualNetNonOperatingInterestIncomeExpense |
annualOtherIncomeExpense |
annualBasicEPS |
annualTotalOperatingIncomeAsReported |
annualDilutedAverageShares |
annualOperatingIncome |
annualEBIT |
annualReconciledCostOfRevenue |
annualGainOnSaleOfSecurity |
annualTaxEffectOfUnusualItems |
annualGeneralAndAdministrativeExpense |
annualTaxProvision |
annualSellingAndMarketingExpense |
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2022-06-30 |
72.74B |
72.74B |
83.72B |
2.06B |
334.00M |
9.65 |
334.00M |
2.06B |
101.00M |
62.65B |
198.27B |
0.13 |
2.09B |
114.89B |
72.74B |
24.51B |
198.27B |
135.62B |
-32.00M |
27.73B |
72.74B |
-101.00M |
5.90B |
99.91B |
7.50B |
2.09B |
14.46B |
72.45B |
72.74B |
72.74B |
100.24B |
52.24B |
72.74B |
31.00M |
31.00M |
302.00M |
9.7 |
83.38B |
7.54B |
83.38B |
85.78B |
62.65B |
435.00M |
43.75M |
5.90B |
10.98B |
21.82B |
2023-06-30 |
72.36B |
72.36B |
89.31B |
1.97B |
-15.00M |
9.68 |
-15.00M |
1.97B |
30.00M |
65.86B |
211.91B |
0.19 |
2.99B |
123.39B |
72.36B |
27.20B |
211.91B |
146.05B |
-223.00M |
30.33B |
72.36B |
-30.00M |
7.58B |
105.16B |
7.45B |
2.99B |
13.86B |
72.37B |
72.36B |
72.36B |
105.14B |
57.53B |
72.36B |
1.03B |
1.03B |
-238.00M |
9.72 |
88.52B |
7.47B |
88.52B |
91.28B |
65.86B |
15.00M |
-2.85M |
7.58B |
16.95B |
22.76B |
2024-06-30 |
88.14B |
88.14B |
107.79B |
2.94B |
-549.00M |
11.8 |
-549.00M |
2.94B |
206.00M |
74.11B |
245.12B |
0.18 |
3.16B |
135.69B |
88.14B |
29.51B |
245.12B |
171.01B |
-1.32B |
32.06B |
88.14B |
-206.00M |
7.61B |
133.56B |
7.43B |
3.16B |
22.29B |
88.59B |
88.14B |
88.14B |
133.01B |
61.58B |
88.14B |
222.00M |
222.00M |
-1.87B |
11.86 |
109.43B |
7.47B |
109.43B |
110.72B |
74.11B |
-343.00M |
-99.92M |
7.61B |
19.65B |
24.46B |
2025-06-30 |
101.83B |
101.83B |
123.63B |
2.38B |
-438.00M |
13.64 |
-438.00M |
2.38B |
943.00M |
87.83B |
281.72B |
0.18 |
2.65B |
153.20B |
101.83B |
32.49B |
281.72B |
193.89B |
-4.72B |
32.88B |
101.83B |
-943.00M |
7.22B |
160.60B |
7.43B |
2.65B |
34.15B |
102.19B |
101.83B |
101.83B |
160.16B |
65.36B |
101.83B |
262.00M |
262.00M |
-5.16B |
13.7 |
128.53B |
7.46B |
128.53B |
126.01B |
87.83B |
505.00M |
-77.09M |
7.22B |
21.80B |
25.65B |
Cash Flow¶
Get the cash flow statement for the stock
Parameters:
frequency: The frequency of the cash flow data.Options include:
annual: Annual cash flow dataquarterly: Quarterly cash flow data
format: The format of the returned data.Options include: -
fmt: Formatted data with human-readable values -raw: Raw data with numerical values
period1: The start date for the data retrieval (default is 5 years ago from today).period2: The end date for the data retrieval (default is today).
from stockdex import Ticker
ticker = Ticker(ticker="MSFT")
result = ticker.cash_flow = ticker.yahoo_api_cash_flow(format='raw')
Results:
annualChangeInPayablesAndAccruedExpense |
annualCashDividendsPaid |
annualOperatingGainsLosses |
annualChangesInAccountReceivables |
annualPurchaseOfInvestment |
annualBeginningCashPosition |
annualNetPPEPurchaseAndSale |
annualDeferredIncomeTax |
annualChangesInCash |
annualNetIssuancePaymentsOfDebt |
annualCashFlowFromContinuingInvestingActivities |
annualPurchaseOfPPE |
annualLongTermDebtPayments |
annualSaleOfInvestment |
annualAssetImpairmentCharge |
annualNetBusinessPurchaseAndSale |
annualEffectOfExchangeRateChanges |
annualNetIncomeFromContinuingOperations |
annualGainLossOnInvestmentSecurities |
annualCashFlowFromContinuingOperatingActivities |
annualRepaymentOfDebt |
annualNetCommonStockIssuance |
annualInvestingCashFlow |
annualCapitalExpenditure |
annualChangeInOtherCurrentLiabilities |
annualDepreciationAndAmortization |
annualCashFlowFromContinuingFinancingActivities |
annualChangeInTaxPayable |
annualDepreciation |
annualEndCashPosition |
annualCommonStockDividendPaid |
annualChangeInOtherCurrentAssets |
annualChangeInPayable |
annualNetShortTermDebtIssuance |
annualChangeInIncomeTaxPayable |
annualOperatingCashFlow |
annualShortTermDebtIssuance |
annualChangeInAccountPayable |
annualChangeInOtherWorkingCapital |
annualFreeCashFlow |
annualStockBasedCompensation |
annualFinancingCashFlow |
annualCommonStockIssuance |
annualIssuanceOfDebt |
annualNetOtherFinancingCharges |
annualRepurchaseOfCapitalStock |
annualDepreciationAmortizationDepletion |
annualPurchaseOfBusiness |
annualChangeInWorkingCapital |
annualChangeInReceivables |
annualCommonStockPayments |
annualUnrealizedGainLossOnInvestmentSecurities |
annualNetLongTermDebtIssuance |
annualNetOtherInvestingChanges |
annualLongTermDebtIssuance |
annualIssuanceOfCapitalStock |
annualNetInvestmentPurchaseAndSale |
annualDeferredTax |
annualChangeInInventory |
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2022-06-30 |
2.943e+09 |
-1.8135e+10 |
-1e+06 |
-6.834e+09 |
-2.6456e+10 |
1.4224e+10 |
-2.3886e+10 |
-5.702e+09 |
-1.52e+08 |
-9.023e+09 |
-3.0311e+10 |
-2.3886e+10 |
-9.023e+09 |
4.4894e+10 |
1.01e+08 |
-2.2038e+10 |
-1.41e+08 |
7.2738e+10 |
-1e+06 |
8.9035e+10 |
-9.023e+09 |
-3.0855e+10 |
-3.0311e+10 |
-2.3886e+10 |
3.169e+09 |
1.446e+10 |
-5.8876e+10 |
6.96e+08 |
1.446e+10 |
1.3931e+10 |
-1.8135e+10 |
-3.514e+09 |
2.943e+09 |
0 |
6.96e+08 |
8.9035e+10 |
0 |
2.943e+09 |
5.805e+09 |
6.5149e+10 |
7.502e+09 |
-5.8876e+10 |
1.841e+09 |
0 |
-8.63e+08 |
-3.2696e+10 |
1.446e+10 |
-2.2038e+10 |
4.46e+08 |
-6.834e+09 |
-3.2696e+10 |
-5.09e+08 |
-9.023e+09 |
-2.825e+09 |
0 |
1.841e+09 |
1.8438e+10 |
-5.702e+09 |
-1.123e+09 |
2023-06-30 |
-2.721e+09 |
-1.98e+10 |
4.69e+08 |
-4.087e+09 |
-3.7651e+10 |
1.3931e+10 |
-2.8107e+10 |
-6.059e+09 |
2.0967e+10 |
-2.75e+09 |
-2.268e+10 |
-2.8107e+10 |
-2.75e+09 |
4.7864e+10 |
3e+07 |
-1.67e+09 |
-1.94e+08 |
7.2361e+10 |
4.69e+08 |
8.7582e+10 |
-2.75e+09 |
-2.0379e+10 |
-2.268e+10 |
-2.8107e+10 |
2.825e+09 |
1.3861e+10 |
-4.3935e+10 |
-3.58e+08 |
1.3861e+10 |
3.4704e+10 |
-1.98e+10 |
-4.824e+09 |
-2.721e+09 |
0 |
-3.58e+08 |
8.7582e+10 |
0 |
-2.721e+09 |
5.177e+09 |
5.9475e+10 |
9.611e+09 |
-4.3935e+10 |
1.866e+09 |
0 |
-1.006e+09 |
-2.2245e+10 |
1.3861e+10 |
-1.67e+09 |
-2.388e+09 |
-4.087e+09 |
-2.2245e+10 |
-3.03e+08 |
-2.75e+09 |
-3.116e+09 |
0 |
1.866e+09 |
1.0213e+10 |
-6.059e+09 |
1.242e+09 |
2024-06-30 |
3.545e+09 |
-2.1771e+10 |
2.45e+08 |
-7.191e+09 |
-1.7732e+10 |
3.4704e+10 |
-4.4477e+10 |
-4.738e+09 |
-1.6179e+10 |
5.75e+08 |
-9.697e+10 |
-4.4477e+10 |
-2.907e+10 |
3.5669e+10 |
2.06e+08 |
-6.9132e+10 |
-2.1e+08 |
8.8136e+10 |
2.45e+08 |
1.18548e+11 |
-2.907e+10 |
-1.5252e+10 |
-9.697e+10 |
-4.4477e+10 |
5.616e+09 |
2.2287e+10 |
-3.7757e+10 |
1.687e+09 |
2.2287e+10 |
1.8315e+10 |
-2.1771e+10 |
-8.465e+09 |
3.545e+09 |
5.25e+09 |
1.687e+09 |
1.18548e+11 |
5.25e+09 |
3.545e+09 |
7.035e+09 |
7.4071e+10 |
1.0734e+10 |
-3.7757e+10 |
2.002e+09 |
2.4395e+10 |
-1.309e+09 |
-1.7254e+10 |
2.2287e+10 |
-6.9132e+10 |
1.824e+09 |
-7.191e+09 |
-1.7254e+10 |
-1.46e+08 |
-4.675e+09 |
-1.298e+09 |
2.4395e+10 |
2.002e+09 |
1.7937e+10 |
-4.738e+09 |
1.284e+09 |
2025-06-30 |
5.69e+08 |
-2.4082e+10 |
2.02e+08 |
-1.0581e+10 |
-2.9775e+10 |
1.8315e+10 |
-6.4551e+10 |
-7.056e+09 |
1.1864e+10 |
-8.962e+09 |
-7.2599e+10 |
-6.4551e+10 |
-3.216e+09 |
2.5388e+10 |
9.43e+08 |
-5.978e+09 |
6.3e+07 |
1.01832e+11 |
2.02e+08 |
1.36162e+11 |
-3.216e+09 |
-1.6364e+10 |
-7.2599e+10 |
-6.4551e+10 |
4.947e+09 |
3.4153e+10 |
-5.1699e+10 |
nan |
3.4153e+10 |
3.0242e+10 |
-2.4082e+10 |
-5.994e+09 |
5.69e+08 |
-5.746e+09 |
nan |
1.36162e+11 |
nan |
5.69e+08 |
5.4e+09 |
7.1611e+10 |
1.1974e+10 |
-5.1699e+10 |
2.056e+09 |
0 |
-2.291e+09 |
-1.842e+10 |
3.4153e+10 |
-5.978e+09 |
-5.35e+09 |
-1.0581e+10 |
-1.842e+10 |
-5.36e+08 |
-3.216e+09 |
2.317e+09 |
0 |
2.056e+09 |
-4.387e+09 |
-7.056e+09 |
3.09e+08 |
Balance Sheet¶
Get the balance sheet for the stock
Parameters:
frequency: The frequency of the balance sheet data.Options include:
annual: Annual balance sheet dataquarterly: Quarterly balance sheet data
format: The format of the returned data.Options include: -
fmt: Formatted data with human-readable values -raw: Raw data with numerical values
period1: The start date for the data retrieval (default is 5 years ago from today).period2: The end date for the data retrieval (default is today).
from stockdex import Ticker
from datetime import datetime
ticker = Ticker(ticker="MSFT")
result = ticker.yahoo_api_balance_sheet(period1=datetime(2020, 1, 1))
Results:
annualNetTangibleAssets |
annualPayablesAndAccruedExpenses |
annualCashFinancial |
annualNonCurrentDeferredRevenue |
annualOtherCurrentBorrowings |
annualInvestedCapital |
annualAccountsReceivable |
annualTotalEquityGrossMinorityInterest |
annualLongTermDebt |
annualTangibleBookValue |
annualOtherProperties |
annualNetDebt |
annualCurrentAssets |
annualGrossPPE |
annualRawMaterials |
annualAccumulatedDepreciation |
annualGoodwill |
annualIncomeTaxPayable |
annualReceivables |
annualCurrentDeferredLiabilities |
annualStockholdersEquity |
annualNonCurrentDeferredLiabilities |
annualAllowanceForDoubtfulAccountsReceivable |
annualLongTermCapitalLeaseObligation |
annualOtherEquityAdjustments |
annualProperties |
annualOtherCurrentLiabilities |
annualRetainedEarnings |
annualCommonStock |
annualAvailableForSaleSecurities |
annualTotalAssets |
annualOrdinarySharesNumber |
annualLandAndImprovements |
annualWorkingCapital |
annualCurrentDebtAndCapitalLeaseObligation |
annualGrossAccountsReceivable |
annualCurrentDebt |
annualLongTermDebtAndCapitalLeaseObligation |
annualInventory |
annualTotalCapitalization |
annualShareIssued |
annualCapitalStock |
annualCommercialPaper |
annualPayables |
annualCurrentDeferredRevenue |
annualHedgingAssetsCurrent |
annualOtherCurrentAssets |
annualWorkInProcess |
annualLongTermEquityInvestment |
annualNetPPE |
annualMachineryFurnitureEquipment |
annualLeases |
annualTotalNonCurrentLiabilitiesNetMinorityInterest |
annualTotalNonCurrentAssets |
annualAccountsPayable |
annualCurrentLiabilities |
annualFinishedGoods |
annualTotalDebt |
annualOtherShortTermInvestments |
annualOtherIntangibleAssets |
annualCashEquivalents |
annualBuildingsAndImprovements |
annualInvestmentsAndAdvances |
annualNonCurrentDeferredTaxesLiabilities |
annualPensionandOtherPostRetirementBenefitPlansCurrent |
annualOtherNonCurrentLiabilities |
annualOtherNonCurrentAssets |
annualGainsLossesNotAffectingRetainedEarnings |
annualInvestmentinFinancialAssets |
annualCashAndCashEquivalents |
annualTotalTaxPayable |
annualCapitalLeaseObligations |
annualTradeandOtherPayablesNonCurrent |
annualCashCashEquivalentsAndShortTermInvestments |
annualFinancialAssets |
annualCommonStockEquity |
annualGoodwillAndOtherIntangibleAssets |
annualTotalLiabilitiesNetMinorityInterest |
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2022-06-30 |
87.72B |
23.07B |
8.26B |
2.87B |
nan |
216.32B |
44.26B |
166.54B |
47.03B |
87.72B |
13.15B |
35.85B |
169.68B |
147.21B |
1.14B |
-59.66B |
67.52B |
4.07B |
44.26B |
45.54B |
166.54B |
3.10B |
-633.00M |
11.49B |
-4.68B |
0 |
13.07B |
84.28B |
86.94B |
nan |
364.84B |
7.46B |
4.73B |
74.60B |
2.75B |
44.89B |
2.75B |
58.52B |
3.74B |
213.57B |
7.46B |
86.94B |
nan |
23.07B |
45.54B |
8.00M |
16.92B |
82.00M |
6.89B |
87.55B |
66.49B |
7.82B |
103.22B |
195.16B |
19.00B |
95.08B |
2.52B |
61.27B |
90.82B |
11.30B |
5.67B |
55.01B |
6.89B |
230.00M |
10.66B |
15.53B |
21.90B |
-4.68B |
0.00 |
13.93B |
4.07B |
11.49B |
26.07B |
104.75B |
0.00 |
166.54B |
78.82B |
198.30B |
2023-06-30 |
128.97B |
22.25B |
8.48B |
2.91B |
5.25B |
253.46B |
48.69B |
206.22B |
41.99B |
128.97B |
14.35B |
12.53B |
184.26B |
178.24B |
709.00M |
-68.25B |
67.89B |
4.15B |
48.69B |
50.90B |
206.22B |
3.35B |
-650.00M |
12.73B |
-6.34B |
0 |
14.74B |
118.85B |
93.72B |
nan |
411.98B |
7.43B |
5.68B |
80.11B |
5.25B |
49.34B |
5.25B |
54.72B |
2.50B |
248.21B |
7.43B |
93.72B |
0.00 |
22.25B |
50.90B |
6.00M |
21.81B |
23.00M |
9.88B |
109.99B |
81.21B |
8.54B |
101.60B |
227.72B |
18.09B |
104.15B |
1.77B |
59.97B |
76.55B |
9.37B |
26.23B |
68.47B |
9.88B |
433.00M |
11.01B |
17.98B |
30.60B |
-6.34B |
0.00 |
34.70B |
4.15B |
12.73B |
25.56B |
111.26B |
0.00 |
206.22B |
77.25B |
205.75B |
2024-06-30 |
121.66B |
27.01B |
11.57B |
2.60B |
2.25B |
320.11B |
56.92B |
268.48B |
42.69B |
121.66B |
18.96B |
33.31B |
159.73B |
230.97B |
394.00M |
-76.42B |
119.22B |
5.02B |
56.92B |
57.58B |
268.48B |
5.22B |
-830.00M |
15.50B |
-5.59B |
0 |
19.18B |
173.14B |
100.92B |
1.50B |
512.16B |
7.43B |
8.16B |
34.45B |
8.94B |
57.75B |
8.94B |
58.19B |
1.25B |
311.17B |
7.43B |
100.92B |
6.69B |
27.01B |
57.58B |
12.00M |
26.02B |
7.00M |
13.10B |
154.55B |
100.31B |
9.59B |
118.40B |
352.43B |
22.00B |
125.29B |
845.00M |
67.13B |
57.22B |
27.60B |
6.74B |
93.94B |
14.60B |
2.62B |
12.56B |
27.06B |
36.46B |
-5.59B |
1.50B |
18.32B |
5.02B |
15.50B |
27.93B |
75.53B |
0.00 |
268.48B |
146.82B |
243.69B |
2025-06-30 |
201.37B |
34.94B |
11.71B |
2.71B |
3.00B |
386.63B |
69.91B |
343.48B |
40.15B |
201.37B |
24.82B |
12.91B |
191.13B |
323.44B |
nan |
-93.65B |
119.51B |
7.21B |
69.91B |
64.56B |
343.48B |
5.54B |
-944.00M |
17.44B |
-3.35B |
0 |
25.02B |
237.73B |
109.09B |
2.46B |
619.00B |
7.43B |
9.34B |
49.91B |
3.00B |
70.85B |
3.00B |
57.59B |
938.00M |
383.63B |
7.43B |
109.09B |
0.00 |
34.94B |
64.56B |
10.00M |
25.72B |
nan |
12.67B |
229.79B |
139.24B |
12.12B |
134.31B |
427.87B |
27.72B |
141.22B |
nan |
60.59B |
64.31B |
22.60B |
18.53B |
137.92B |
15.13B |
2.83B |
13.71B |
45.19B |
40.56B |
-3.35B |
2.46B |
30.24B |
7.21B |
17.44B |
25.99B |
94.56B |
272.00M |
343.48B |
142.11B |
275.52B |
Financials¶
Get the financials for the stock
Parameters:
frequency: The frequency of the financial data.Options include:
annual: Annual financial dataquarterly: Quarterly financial data
format: The format of the returned data.Options include: -
fmt: Formatted data with human-readable values -raw: Raw data with numerical values
period1: The start date for the data retrieval (default is 5 yearsago from today).
period2: The end date for the data retrieval (default is today).
from stockdex import Ticker
from datetime import datetime
ticker = Ticker(ticker="GOOG")
result = ticker.yahoo_api_financials(period1=datetime(2022, 1, 1), period2=datetime.today())
Results:
annualNetIncomeFromContinuingAndDiscontinuedOperation |
annualOtherIncomeExpense |
annualGrossProfit |
annualOperatingExpense |
annualOtherNonOperatingIncomeExpenses |
annualInterestIncome |
annualResearchAndDevelopment |
annualSellingGeneralAndAdministration |
annualGeneralAndAdministrativeExpense |
annualNormalizedIncome |
annualSellingAndMarketingExpense |
annualNormalizedEBITDA |
annualGainOnSaleOfSecurity |
annualEBITDA |
annualInterestExpenseNonOperating |
annualNetNonOperatingInterestIncomeExpense |
annualReconciledCostOfRevenue |
annualTotalOperatingIncomeAsReported |
annualOperatingIncome |
annualNetInterestIncome |
annualOperatingRevenue |
annualWriteOff |
annualBasicAverageShares |
annualEBIT |
annualTotalUnusualItemsExcludingGoodwill |
annualDilutedAverageShares |
annualTotalExpenses |
annualEarningsFromEquityInterest |
annualSpecialIncomeCharges |
annualTaxEffectOfUnusualItems |
annualTotalUnusualItems |
annualNetIncomeIncludingNoncontrollingInterests |
annualInterestIncomeNonOperating |
annualTaxProvision |
annualDilutedNIAvailtoComStockholders |
annualNetIncomeCommonStockholders |
annualPretaxIncome |
annualInterestExpense |
annualReconciledDepreciation |
annualDilutedEPS |
annualNetIncomeContinuousOperations |
annualOtherGandA |
annualCostOfRevenue |
annualTotalRevenue |
annualBasicEPS |
annualTaxRateForCalcs |
annualNetIncomeFromContinuingOperationNetMinorityInterest |
annualNetIncome |
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2022-12-31 |
59.97B |
-5.33B |
156.63B |
81.79B |
1.18B |
2.17B |
39.50B |
42.29B |
15.72B |
65.45B |
26.57B |
91.67B |
-6.17B |
85.16B |
357.00M |
1.82B |
126.20B |
74.84B |
74.84B |
1.82B |
282.84B |
337.00M |
13.06B |
71.69B |
-6.51B |
13.16B |
207.99B |
-337.00M |
-337.00M |
-1.04B |
-6.51B |
59.97B |
2.17B |
11.36B |
59.97B |
59.97B |
71.33B |
357.00M |
13.47B |
4.56 |
59.97B |
15.72B |
126.20B |
282.84B |
4.59 |
0.16 |
59.97B |
59.97B |
2023-12-31 |
73.80B |
-2.13B |
174.06B |
89.77B |
556.00M |
3.87B |
45.43B |
44.34B |
16.43B |
76.11B |
27.92B |
100.66B |
-2.06B |
97.97B |
308.00M |
3.56B |
133.33B |
84.29B |
84.29B |
3.56B |
307.39B |
628.00M |
12.63B |
86.03B |
-2.69B |
12.72B |
223.10B |
-628.00M |
-628.00M |
-373.77M |
-2.69B |
73.80B |
3.87B |
11.92B |
73.80B |
73.80B |
85.72B |
308.00M |
11.95B |
5.8 |
73.80B |
16.43B |
133.33B |
307.39B |
5.84 |
0.14 |
73.80B |
73.80B |
2024-12-31 |
100.12B |
3.21B |
203.71B |
91.32B |
1.14B |
4.48B |
49.33B |
42.00B |
14.19B |
98.38B |
27.81B |
133.32B |
2.26B |
135.39B |
268.00M |
4.21B |
146.31B |
112.39B |
112.39B |
4.21B |
350.02B |
188.00M |
12.32B |
120.08B |
2.07B |
12.45B |
237.63B |
-188.00M |
-188.00M |
340.14M |
2.07B |
100.12B |
4.48B |
19.70B |
100.12B |
100.12B |
119.81B |
268.00M |
15.31B |
8.04 |
100.12B |
14.19B |
146.31B |
350.02B |
8.13 |
0.16 |
100.12B |
100.12B |
Dividends, Splits and Capital Gains¶
Corporate actions from the Yahoo chart endpoint. Each returns one row per event, indexed by the event date (UTC), oldest first, and an empty DataFrame if there are none.
yahoo_api_dividends:amountandcurrencyper ex-dividend dateyahoo_api_splits:numerator,denominatorandsplitRatio(e.g.4:1)yahoo_api_capital_gains: distributions for ETFs and mutual funds
Parameters:
range:1y,2y,5y,10y,ytdormax(default)
from stockdex import Ticker
ticker = Ticker(ticker="KO")
dividends = ticker.yahoo_api_dividends(range="5y")
splits = Ticker(ticker="AAPL").yahoo_api_splits()
Valuation Measures¶
Market cap, enterprise value, trailing and forward P/E, PEG, price/sales,
price/book, EV/revenue and EV/EBITDA over time, indexed by as-of date.
Column names carry the frequency prefix, e.g. quarterlyPeRatio.
Parameters:
frequency:annual,quarterly(default) ortrailing(recent trailing-twelve-month snapshots)format:fmt(default, e.g.3.5T) orraw(numbers)period1/period2: start and end dates (default: the last five years)
from stockdex import Ticker
ticker = Ticker(ticker="AAPL")
valuation = ticker.yahoo_api_valuation_measures(frequency="quarterly", format="raw")
Quote Summary¶
yahoo_api_quote_summary returns one or more raw modules from Yahoo’s
quoteSummary endpoint as a dictionary. The methods below are built on it.
Valid module names are listed in stockdex.config.QUOTE_SUMMARY_MODULES.
Modules that do not apply to a security are left out, and an unknown symbol
raises NoDataError.
Parameters:
modules: one module name or a list, e.g.["price", "financialData"]format:raw(default, numbers and epoch timestamps) orfmt(display strings)
from stockdex import Ticker
ticker = Ticker(ticker="AAPL")
data = ticker.yahoo_api_quote_summary(["price", "financialData"])
data["financialData"]["targetMeanPrice"]
Company and Market Data¶
Single-record methods return one column named after the ticker, with one row per field. Known date fields are converted to UTC timestamps.
yahoo_api_profile: address, website, sector, industry, employees, business summary, governance risk scoresyahoo_api_officers: key executives with title, age and total pay (one row per person)yahoo_api_market_price: regular, pre- and post-market price and change, market state, currencyyahoo_api_summary_detail: day and 52-week ranges, volume, market cap, beta, P/E, dividend rate and yieldyahoo_api_key_statistics: enterprise value, forward P/E, PEG, shares outstanding and float, short interestyahoo_api_financial_data: analyst price targets and recommendation, revenue, margins, cash flow, debt, ROEyahoo_api_calendar_events: next earnings date(s), EPS and revenue estimates, ex-dividend and payment datesyahoo_api_company_name: the company’s full name as a string, e.g."Apple Inc."
yahoo_api_market_price, yahoo_api_summary_detail,
yahoo_api_key_statistics and yahoo_api_financial_data accept
format="fmt" for display strings.
from stockdex import Ticker
ticker = Ticker(ticker="AAPL")
profile = ticker.yahoo_api_profile()
targets = ticker.yahoo_api_financial_data().loc[
["targetLowPrice", "targetMeanPrice", "targetHighPrice"]
]
Analyst Estimates and Earnings¶
yahoo_api_earnings_history: reported vs estimated EPS and surprise for the last four quartersyahoo_api_earnings_trend: EPS and revenue estimates, EPS trend and revisions for the current and next quarter and year, with flattened columns such asearningsEstimate_avgyahoo_api_recommendation_trend: strong buy to strong sell counts per monthyahoo_api_upgrades_downgrades: analyst rating changes and price target moves, newest first
from stockdex import Ticker
ticker = Ticker(ticker="MSFT")
trend = ticker.yahoo_api_earnings_trend()
ratings = ticker.yahoo_api_upgrades_downgrades().head(10)
Ownership, Insiders and Filings¶
yahoo_api_institutional_holdersandyahoo_api_fund_holders: top holders with percent held, shares, value and changeyahoo_api_major_holders: insider and institutional ownership percentagesyahoo_api_insider_holders: insiders and their direct positionsyahoo_api_insider_transactions: recent insider buys, sales and grants, newest firstyahoo_api_insider_purchase_activity: net insider buying vs selling over the reporting periodyahoo_api_sec_filings: recent SEC filings with type, title and links (US-listed companies)
from stockdex import Ticker
ticker = Ticker(ticker="NVDA")
holders = ticker.yahoo_api_institutional_holders()
filings = ticker.yahoo_api_sec_filings()
ETF and Mutual Fund Data¶
These return empty DataFrames for individual stocks.
yahoo_api_fund_top_holdings: top holdings with fraction of the fundyahoo_api_fund_sector_weightings: weight per sector, largest firstyahoo_api_fund_asset_allocation: stock, bond, cash and other positionsyahoo_api_fund_profile: fund family, category, expense ratio, turnover and net assets, with category averagesyahoo_api_fund_performance: trailing and calendar-year total returns, fund vs category
from stockdex import Ticker
etf = Ticker(ticker="SPY", security_type="etf")
holdings = etf.yahoo_api_fund_top_holdings()
performance = etf.yahoo_api_fund_performance()
Options, Quotes, Search and Similar Symbols¶
yahoo_api_option_expirations: listed option expiration dates (UTC)yahoo_api_options_chain: calls and puts for one expiration. Parameters:expiration(default nearest) andoption_type(calls,putsorboth)yahoo_api_quotes: current quotes for many symbols in one request (static method)yahoo_api_search: find symbols by company name or partial ticker (static method). Parameters:queryandlimit(1–50)yahoo_api_similar_symbols: related symbols with a relevance score
from stockdex import Ticker
ticker = Ticker(ticker="AAPL")
expirations = ticker.yahoo_api_option_expirations()
chain = ticker.yahoo_api_options_chain(expirations[0], option_type="calls")
quotes = Ticker.yahoo_api_quotes(["AAPL", "MSFT", "NVDA"])
matches = Ticker.yahoo_api_search("bayerische motoren", limit=5)