-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Direct TTM Financial Data Retrieval Feature #2321
Conversation
Discard the mostly-nan columns, more that one column doesn't make sense with TTM. Then open question about the user interface. Separate function like you've done? New argument on existing fetchers, prepending TTM to table? @victoryg739 @amigobrewbrew |
Just double checking what you mean by discarding NaN. The ttm_cash_flow returns only the TTM column as Yahoo only returns one column. You would like to see same for the ttm_income_stmt where yahoo currently returns the TTM with all the values and then preceding 4 quarters with only some values and mostly NaN? Meaning that we should implement a special if block in the get_financials_time_series to check if it was called with trailing timescale then it should return only one column and skip the rest (different behaviour than yearly and quarterly time scales)? |
@ValueRaider Added now in get_financials_time_series that it drops the NaN columns and only returns exactly one column. Is this what you meant by removing the most-nan columns? |
@JanMkl @ValueRaider I would do separate functions like in PR: ttm_cashflow and ttm_income_stmt with single column. I did a quick test seems to be good like this! |
Perfect. Finally can you git squash? #1084 |
@ValueRaider squashed into single commit. |
I almost forgot, can you update the web docs: https://github.com/ranaroussi/yfinance/blob/main/doc/source/reference/yfinance.financials.rst Instructions in guide |
- Fetches the TTM values for cash flow and income statement from Yahoo. - Added tests test_ttm_income_statement and test_ttm_cash_flow. - When trailing 12 months income statement is fetched Yahoo returns income statement for last 5 quarters out of which only the latest is fully populated. Rest have NaN values and can be ignored. - get_financials_time_series when called with timescale trailing removes from data frame the extra columns. - Added quarterly_income_stmt to financials documentation - Added ttm_income_stmt to financials documentation - Added quarterly_cashflow to financials documentation - Added ttm_cashflow to financials documentation
@ValueRaider Added quarterly_income_stmt, ttm_income_stmt, quaterly_cashflow, ttm_cashflow to the docs. I added also the quarterly ones as those seemed to be missing from the docs although implemented. Let me know if you still see need for further modifications. |
This PR completes the earlier #1643 and moves the PR in to the dev branch.
This feature was also requested in #2287
Obsoletes PR #2320