feature/financials - PR for working on structure of financial statements. (#5794)

* balance sheet draft

* balance_sheet draft

* cash_flow draft

* income_statement draft

* intrinio financials

* description

* period field

* ruff

* income statement

* field

* label - gross profit ratio

* cash flow statement

* investing order

* add option for caching to cashflow

* add caching to balance and income

* typos and update order for financial institutions

* replace 0 values with None

* add financial ratios from intrinio

* black

* missing test params

* balance cassette

* query param description

* symbol list warning

* black

* handle BRK-A and symbols with a dash for Intrinio

* fix typo error

* add free cash flow to bottom of cash flow statement

* amortization_expense

* dev_install.py

* undo dev_install.. wrong branch

* cash flow order things

* standardized cash flow

* fields

* integration tests

* cash flow model validator

* more polygon cash

* black

* black

* Delete openbb_sdk/providers/polygon/openbb_polygon/utils/definitions.py

wrong file

* balance sheet

* some cleanup

* ruff

* income statement

* black

* test params

* financial ratios async update

* recapture fmp and polygon tests

* yFinance financials

* yfinance tests

* delete financial_statements standard model

* intrinio balance sheet order

* fiscal year standard param

* remove file accidentally committed

* add reported_financials end point

* fiscal_year param for reported_financials

* fix url

* fmp test cassette

* add safe-guard with warning for fiscal year before 2008

* periods can only be annual and quarter

* url in docstring correction

* add fiscal_year param to intrinio standardized financials and ratios

* fix fmp ratios

* black

* rename fields as per Minh

* rogue field

* black

* Fix typo in a docstring

* Resolve linting errors

* type ignore

* disable=unused-argument

* changing the arg name cc @minhhoang1023

---------

Co-authored-by: Igor Radovanovic <74266147+IgorWounds@users.noreply.github.com>
Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
Co-authored-by: hjoaquim <h.joaquim@campus.fct.unl.pt>
This commit is contained in:
Danglewood
2023-12-19 04:26:13 -08:00
committed by GitHub
parent ad8e13b346
commit 06e38834d0
38 changed files with 3706 additions and 1653 deletions

View File

@@ -26,8 +26,9 @@ def obb(pytestconfig):
{
"provider": "intrinio",
"symbol": "AAPL",
"period": "annual",
"limit": 12,
"period": "ttm",
"fiscal_year": 2014,
"limit": 2,
}
),
(
@@ -57,7 +58,6 @@ def obb(pytestconfig):
"period": "annual",
"limit": 12,
"provider": "fmp",
"cik": "0000320193",
}
),
(
@@ -139,13 +139,13 @@ def test_equity_calendar_earnings(params, obb):
@parametrize(
"params",
[
({"symbol": "AAPL", "period": "annual", "limit": 12}),
(
{
"provider": "intrinio",
"symbol": "AAPL",
"period": "annual",
"limit": 12,
"fiscal_year": None,
"limit": 2,
}
),
(
@@ -175,7 +175,6 @@ def test_equity_calendar_earnings(params, obb):
"period": "annual",
"limit": 12,
"provider": "fmp",
"cik": "0000320193",
}
),
(
@@ -296,8 +295,9 @@ def test_equity_estimates_historical(params, obb):
{
"provider": "intrinio",
"symbol": "AAPL",
"period": "annual",
"limit": 12,
"period": "quarter",
"fiscal_year": 2020,
"limit": 4,
}
),
(
@@ -327,7 +327,6 @@ def test_equity_estimates_historical(params, obb):
"symbol": "AAPL",
"limit": 12,
"period": "annual",
"cik": "0000320193",
}
),
(
@@ -555,7 +554,16 @@ def test_equity_estimates_consensus(params, obb):
@parametrize(
"params",
[
({"symbol": "AAPL", "period": "annual", "limit": 12}),
({"symbol": "AAPL", "period": "annual", "limit": 12, "provider": "fmp"}),
(
{
"symbol": "AAPL",
"period": "ttm",
"fiscal_year": None,
"limit": 12,
"provider": "intrinio",
}
),
],
)
@pytest.mark.integration
@@ -1363,3 +1371,48 @@ def test_equity_fundamental_trailing_dividend_yield(params, obb):
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0
@parametrize(
"params",
[
(
{
"symbol": "AAPL",
"statement_type": "income",
"period": "quarter",
"limit": 5,
"fiscal_year": None,
"provider": "intrinio",
}
),
(
{
"symbol": "AAPL",
"statement_type": "cash",
"period": "annual",
"limit": 1,
"fiscal_year": 2015,
"provider": "intrinio",
}
),
(
{
"symbol": "AAPL",
"statement_type": "balance",
"period": "annual",
"fiscal_year": None,
"limit": 10,
"provider": "intrinio",
}
),
],
)
@pytest.mark.integration
def test_equity_fundamental_reported_financials(params, obb):
params = {p: v for p, v in params.items() if v}
result = obb.equity.fundamental.reported_financials(**params)
assert result
assert isinstance(result, OBBject)
assert len(result.results) > 0