Coder Social home page Coder Social logo

Comments (4)

JECSand avatar JECSand commented on June 3, 2024

@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.

JECSand avatar JECSand commented on June 3, 2024

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.

promexio avatar promexio commented on June 3, 2024

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.

promexio avatar promexio commented on June 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.