Comments (4)
@promexio I don’t think it’s a mistake on your end. We recently refactored to get around changes on yahoo’s end. I’ll get this fixed by tomorrow. Thanks for reporting the issue!
from yahoofinancials.
I'm running some tests and here's what I found:
When I run:
from yahoofinancials import YahooFinancials
ticker = 'AAPL'
yahoo_financials = YahooFinancials(ticker)
balanceSheet = yahoo_financials.get_financial_stmts('annual', 'balance')['balanceSheetHistory'][ticker][0]
print(balanceSheet)
I get:
{'2019-09-30': {'cashAndCashEquivalents': 48844000000.0, 'stockholdersEquity': 90488000000.0, 'machineryFurnitureEquipment': 69797000000.0, 'properties': 0.0, 'commonStockEquity': 90488000000.0, 'investmentsAndAdvances': 105341000000.0, 'availableForSaleSecurities': 105341000000.0, 'landAndImprovements': 17085000000.0, 'investmentinFinancialAssets': 105341000000.0, 'currentDeferredRevenue': 5522000000.0, 'totalCapitalization': 182295000000.0, 'capitalStock': 45174000000.0, 'otherInvestments': 105341000000.0, 'accountsReceivable': 22926000000.0, 'shareIssued': 17772944000.0, 'payablesAndAccruedExpenses': 46236000000.0, 'totalNonCurrentLiabilitiesNetMinorityInterest': 142310000000.0, 'otherCurrentBorrowings': 10260000000.0, 'cashFinancial': 12204000000.0, 'longTermDebtAndCapitalLeaseObligation': 91807000000.0, 'otherShortTermInvestments': 51713000000.0, 'cashCashEquivalentsAndShortTermInvestments': 100557000000.0, 'receivables': 45804000000.0, 'inventory': 4106000000.0, 'accumulatedDepreciation': -58579000000.0, 'currentLiabilities': 105718000000.0, 'totalDebt': 108047000000.0, 'netPPE': 37378000000.0, 'tangibleBookValue': 90488000000.0, 'leases': 9075000000.0, 'otherNonCurrentAssets': 32978000000.0, 'currentAssets': 162819000000.0, 'otherNonCurrentLiabilities': 20958000000.0, 'otherCurrentLiabilities': 37720000000.0, 'currentDeferredLiabilities': 5522000000.0, 'workingCapital': 57101000000.0, 'totalLiabilitiesNetMinorityInterest': 248028000000.0, 'tradeandOtherPayablesNonCurrent': 29545000000.0, 'currentDebtAndCapitalLeaseObligation': 16240000000.0, 'retainedEarnings': 45898000000.0, 'commonStock': 45174000000.0, 'gainsLossesNotAffectingRetainedEarnings': -584000000.0, 'totalEquityGrossMinorityInterest': 90488000000.0, 'otherCurrentAssets': 12352000000.0, 'payables': 46236000000.0, 'accountsPayable': 46236000000.0, 'commercialPaper': 5980000000.0, 'longTermDebt': 91807000000.0, 'investedCapital': 198535000000.0, 'currentDebt': 16240000000.0, 'netTangibleAssets': 90488000000.0, 'totalAssets': 338516000000.0, 'ordinarySharesNumber': 17772944000.0, 'otherReceivables': 22878000000.0, 'cashEquivalents': 36640000000.0, 'grossPPE': 95957000000.0, 'totalNonCurrentAssets': 175697000000.0, 'netDebt': 59203000000.0}}
However when I run:
from yahoofinancials import YahooFinancials
ticker = 'AAPL'
yahoo_financials = YahooFinancials(ticker)
balanceSheet = yahoo_financials.get_financial_stmts('annual', 'balance')['balanceSheetHistory'][ticker][3]
print(balanceSheet)
I get:
{'2022-09-30': {'cashAndCashEquivalents': 23646000000.0, 'stockholdersEquity': 50672000000.0, 'machineryFurnitureEquipment': 81060000000.0, 'properties': 0.0, 'commonStockEquity': 50672000000.0, 'investmentsAndAdvances': 120805000000.0, 'availableForSaleSecurities': 120805000000.0, 'landAndImprovements': 22126000000.0, 'investmentinFinancialAssets': 120805000000.0, 'currentDeferredRevenue': 7912000000.0, 'totalCapitalization': 149631000000.0, 'capitalStock': 64849000000.0, 'otherInvestments': 120805000000.0, 'accountsReceivable': 28184000000.0, 'shareIssued': 15943425000.0, 'payablesAndAccruedExpenses': 64115000000.0, 'totalNonCurrentLiabilitiesNetMinorityInterest': 148101000000.0, 'otherCurrentBorrowings': 11128000000.0, 'cashFinancial': 18546000000.0, 'longTermDebtAndCapitalLeaseObligation': 98959000000.0, 'otherShortTermInvestments': 24658000000.0, 'cashCashEquivalentsAndShortTermInvestments': 48304000000.0, 'receivables': 60932000000.0, 'inventory': 4946000000.0, 'accumulatedDepreciation': -72340000000.0, 'currentLiabilities': 153982000000.0, 'totalDebt': 120069000000.0, 'netPPE': 42117000000.0, 'tangibleBookValue': 50672000000.0, 'leases': 11271000000.0, 'currentAssets': 135405000000.0, 'otherNonCurrentAssets': 54428000000.0, 'otherNonCurrentLiabilities': 32485000000.0, 'otherCurrentLiabilities': 60845000000.0, 'currentDeferredLiabilities': 7912000000.0, 'workingCapital': -18577000000.0, 'totalLiabilitiesNetMinorityInterest': 302083000000.0, 'tradeandOtherPayablesNonCurrent': 16657000000.0, 'currentDebtAndCapitalLeaseObligation': 21110000000.0, 'retainedEarnings': -3068000000.0, 'commonStock': 64849000000.0, 'gainsLossesNotAffectingRetainedEarnings': -11109000000.0, 'totalEquityGrossMinorityInterest': 50672000000.0, 'otherCurrentAssets': 21223000000.0, 'payables': 64115000000.0, 'accountsPayable': 64115000000.0, 'commercialPaper': 9982000000.0, 'longTermDebt': 98959000000.0, 'investedCapital': 170741000000.0, 'currentDebt': 21110000000.0, 'netTangibleAssets': 50672000000.0, 'totalAssets': 352755000000.0, 'ordinarySharesNumber': 15943425000.0, 'otherReceivables': 32748000000.0, 'cashEquivalents': 5100000000.0, 'grossPPE': 114457000000.0, 'totalNonCurrentAssets': 217350000000.0, 'netDebt': 96423000000.0}}
So I'm thinking the issue is:
balanceSheet = yahoo_financials.get_financial_stmts('annual', 'balance')['balanceSheetHistory'][ticker][0]
Should be:
balanceSheet = yahoo_financials.get_financial_stmts('annual', 'balance')['balanceSheetHistory'][ticker][3]
from yahoofinancials.
Thx for your decent tests. You're right. Only, I don't understand, why it's working for the P&L and the CF ... also, if I look to the datasheets on the yahoo finance website, the data presentation seems to be slightly different for the balance sheet, like very bizarre. I'll adapt my script.
from yahoofinancials.
on the CF-statement I need to put 4:
cashflowStatement = yahoo_financials.get_financial_stmts('annual', 'cash')['cashflowStatementHistory'][ticker][4][last_quarter_reported]
And the big question is: is that always true or do I need more "intelligence code" in the background...?
from yahoofinancials.
Related Issues (20)
- KeyError: 'incomeBeforeTax
- Get the last trading hour
- get_stock_earnings_data always fails HOT 8
- .get_key_statistics_data() results in a HTTP 401 code HOT 9
- Error when running test script HOT 4
- .get_key_statistics_data() http 401 yahoofinancials version 1.19 HOT 2
- get_key_statistic_data: 401 error HOT 2
- Problem with Demo.py HOT 4
- TypeError: can only concatenate str (not "NoneType") to str HOT 2
- get_net_income() provides the Net Income of 9/29/2020 (for AAPL) HOT 1
- get_historical_price_data() end_date HOT 4
- Can't fetch anything HOT 1
- unsupported operand type(s) for -: 'datetime.datetime' and 'str' HOT 5
- sessions.py _get_crumb does not get the crumb, it's empty HOT 6
- not working - get_financial_data() HOT 4
- TypeError: 'NoneType' object is not subscriptable
- Sleeping and retrying for a long time HOT 1
- get_historical_price_data() error HOT 1
- get_summary_data() freezes the application with a delisted stock symbol
- Unable to get any examples working.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yahoofinancials.