Skip to content
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

Bug fixes in financial statements #5537

Merged
merged 43 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ec3d4ee
`validator` to `field_validator` in standard models
the-praxs Oct 9, 2023
2282c17
Polygon add `ttm` to `period` param
the-praxs Oct 9, 2023
4e63887
Revert "Polygon add `ttm` to `period` param"
the-praxs Oct 9, 2023
8a4a54d
Polygon add `ttm` to param `period`
the-praxs Oct 9, 2023
90b33cb
`EarningsCallTranscript` standard model removed `quarter` param
the-praxs Oct 9, 2023
5952ee5
Merge branch 'feature/openbb-sdk-v4' into hotfix/fix-financials
the-praxs Oct 17, 2023
e846a3a
use `tag` instead of `name` for correct field name
the-praxs Oct 17, 2023
6c63b06
fix url for intrinio income statement
the-praxs Oct 17, 2023
2c5d4bc
modified intrinio cash flow `transform_data` function
the-praxs Oct 17, 2023
f7fdf47
set optional data fields and validate dates
the-praxs Oct 17, 2023
0f0d234
fix insider trading not fetching recent data
the-praxs Oct 17, 2023
16e3009
linting
the-praxs Oct 17, 2023
3e3059a
refactoring
the-praxs Oct 17, 2023
971579a
refactoring
the-praxs Oct 17, 2023
7c2fadc
set param alias in fmp stock insider provider model
the-praxs Oct 17, 2023
9644fb1
get all quarter data for intrinio
the-praxs Oct 17, 2023
84b3f2b
Merge branch 'feature/openbb-sdk-v4' into hotfix/fix-financials
the-praxs Oct 18, 2023
1951cae
Merge branch 'feature/openbb-sdk-v4' into hotfix/fix-financials
the-praxs Oct 18, 2023
41711d2
add `limit` param to `stocks.fa.ins`
the-praxs Oct 18, 2023
a2839c6
refactoring and linting
the-praxs Oct 18, 2023
212a6cf
removed additional comment
the-praxs Oct 18, 2023
36e05cb
linting
the-praxs Oct 18, 2023
e52f5b6
re-recorded and fix tests
the-praxs Oct 18, 2023
5a901f5
Merge branch 'feature/openbb-sdk-v4' into hotfix/fix-financials
the-praxs Oct 18, 2023
1fb3bb0
cash flow standard model field type to `StrictFloat`
the-praxs Oct 18, 2023
21f592c
Intrinio cash flow model fixed to get all quarters' data
the-praxs Oct 18, 2023
d8aa574
linting
the-praxs Oct 18, 2023
549bb77
refactoring
the-praxs Oct 18, 2023
153103d
financial statement standard model field type to `StrictFloat`
the-praxs Oct 18, 2023
e71895b
Intrinio financial statement model get all quarter data
the-praxs Oct 18, 2023
b037189
set `period` type to `Optional[str]`
the-praxs Oct 19, 2023
4ec1be2
add `period` param to balance sheet provider models
the-praxs Oct 19, 2023
5dee515
add `period` param to cash flow provider models
the-praxs Oct 19, 2023
0c0796a
Merge branch 'feature/openbb-sdk-v4' into hotfix/fix-financials
the-praxs Oct 19, 2023
0259a5f
use alias in model dump
the-praxs Oct 19, 2023
3d3927d
remove `ttm` from `period` param
the-praxs Oct 19, 2023
d8bdf91
Merge branch 'feature/openbb-sdk-v4' into hotfix/fix-financials
the-praxs Oct 30, 2023
9db3322
revamped intrinio financials
the-praxs Nov 1, 2023
4a325bc
Merge branch 'feature/openbb-sdk-v4' into hotfix/fix-financials
the-praxs Nov 1, 2023
e266e50
fixed incorrect description for `limit` param
the-praxs Nov 1, 2023
707b4fc
modified tests for `balance`, `cash` and `income`
the-praxs Nov 1, 2023
1c33b82
re-recorded tests
the-praxs Nov 1, 2023
7cc83cb
skipped intrinio financial statement fetcher tests
the-praxs Nov 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions openbb_platform/extensions/stocks/integration/test_stocks_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ def headers():
({"symbol": "AAPL", "period": "annual", "limit": 12, "provider": "fmp"}),
(
{
"type": "reported",
"year": 2022,
"provider": "intrinio",
"symbol": "AAPL",
"period": "annual",
Expand Down Expand Up @@ -117,8 +115,6 @@ def test_stocks_fa_cal(params, headers):
({"symbol": "AAPL", "period": "annual", "limit": 12, "provider": "fmp"}),
(
{
"type": "reported",
"year": 2022,
"provider": "intrinio",
"symbol": "AAPL",
"period": "annual",
Expand Down Expand Up @@ -290,8 +286,6 @@ def test_stocks_fa_est(params, headers):
({"symbol": "AAPL", "period": "annual", "limit": 12, "provider": "fmp"}),
(
{
"type": "reported",
"year": 2022,
"provider": "intrinio",
"symbol": "AAPL",
"period": "annual",
Expand Down Expand Up @@ -373,8 +367,8 @@ def test_stocks_fa_income_growth(params, headers):
(
{
"symbol": "AAPL",
"transactionType": "P-Purchase",
"page": 1,
"transaction_type": "P-Purchase",
"limit": 10,
"provider": "fmp",
}
)
Expand Down Expand Up @@ -609,7 +603,7 @@ def test_stocks_fa_split(params, headers):

@pytest.mark.parametrize(
"params",
[({"symbol": "AAPL", "year": 2023, "quarter": 1})],
[({"symbol": "AAPL", "year": 2023})],
)
@pytest.mark.integration
def test_stocks_fa_transcript(params, headers):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ def obb(pytestconfig):
({"symbol": "AAPL", "period": "annual", "limit": 12}),
(
{
"type": "reported",
"year": 2022,
"provider": "intrinio",
"symbol": "AAPL",
"period": "annual",
Expand Down Expand Up @@ -121,8 +119,6 @@ def test_stocks_fa_cal(params, obb):
({"symbol": "AAPL", "period": "annual", "limit": 12}),
(
{
"type": "reported",
"year": 2022,
"provider": "intrinio",
"symbol": "AAPL",
"period": "annual",
Expand Down Expand Up @@ -289,8 +285,6 @@ def test_stocks_fa_est(params, obb):
({"symbol": "AAPL", "period": "annual", "limit": 12}),
(
{
"type": "reported",
"year": 2022,
"provider": "intrinio",
"symbol": "AAPL",
"period": "annual",
Expand Down Expand Up @@ -366,8 +360,8 @@ def test_stocks_fa_income_growth(params, obb):
(
{
"symbol": "AAPL",
"transactionType": "P-Purchase",
"page": 1,
"transaction_type": ["P-Purchase"],
"limit": 10,
}
),
],
Expand Down Expand Up @@ -580,7 +574,7 @@ def test_stocks_fa_split(params, obb):
@pytest.mark.parametrize(
"params",
[
({"symbol": "AAPL", "year": 2023, "quarter": 1}),
({"symbol": "AAPL", "year": 2023}),
],
)
@pytest.mark.integration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
)
from typing import List, Literal, Optional, Set, Union

from pydantic import Field, NonNegativeInt, field_validator
from pydantic import Field, NonNegativeInt, StrictFloat, field_validator

from openbb_provider.abstract.data import Data, StrictInt
from openbb_provider.abstract.data import Data
from openbb_provider.abstract.query_params import QueryParams
from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS

Expand All @@ -18,14 +18,16 @@ class BalanceSheetQueryParams(QueryParams):
"""Balance Sheet query."""

symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", ""))
period: Literal["annual", "quarter"] = Field(
default="annual", description=QUERY_DESCRIPTIONS.get("period", "")
period: Optional[Literal["annual", "quarter"]] = Field(
default="annual",
description=QUERY_DESCRIPTIONS.get("period", ""),
)
limit: NonNegativeInt = Field(
default=12, description=QUERY_DESCRIPTIONS.get("limit", "")
limit: Optional[NonNegativeInt] = Field(
default=5, description=QUERY_DESCRIPTIONS.get("limit", "")
)

@field_validator("symbol", mode="before", check_fields=False)
@classmethod
def upper_symbol(cls, v: Union[str, List[str], Set[str]]):
"""Convert symbol to uppercase."""
if isinstance(v, str):
Expand All @@ -52,127 +54,132 @@ class BalanceSheetData(Data):
default=None, description="Reporting period of the statement."
)

cash_and_cash_equivalents: Optional[StrictInt] = Field(
cash_and_cash_equivalents: Optional[StrictFloat] = Field(
default=None, description="Cash and cash equivalents"
)
short_term_investments: Optional[StrictInt] = Field(
short_term_investments: Optional[StrictFloat] = Field(
default=None, description="Short-term investments"
)
long_term_investments: Optional[StrictInt] = Field(
long_term_investments: Optional[StrictFloat] = Field(
default=None, description="Long-term investments"
)

inventory: Optional[StrictInt] = Field(default=None, description="Inventory")
net_receivables: Optional[StrictInt] = Field(
inventory: Optional[StrictFloat] = Field(default=None, description="Inventory")
net_receivables: Optional[StrictFloat] = Field(
default=None, description="Receivables, net"
)

marketable_securities: Optional[StrictInt] = Field(
marketable_securities: Optional[StrictFloat] = Field(
default=None, description="Marketable securities"
)
property_plant_equipment_net: Optional[StrictInt] = Field(
property_plant_equipment_net: Optional[StrictFloat] = Field(
default=None, description="Property, plant and equipment, net"
)
goodwill: Optional[StrictInt] = Field(default=None, description="Goodwill")
goodwill: Optional[StrictFloat] = Field(default=None, description="Goodwill")

assets: Optional[StrictInt] = Field(default=None, description="Total assets")
current_assets: Optional[StrictInt] = Field(
assets: Optional[StrictFloat] = Field(default=None, description="Total assets")
current_assets: Optional[StrictFloat] = Field(
default=None, description="Total current assets"
)
other_current_assets: Optional[StrictInt] = Field(
other_current_assets: Optional[StrictFloat] = Field(
default=None, description="Other current assets"
)
intangible_assets: Optional[StrictInt] = Field(
intangible_assets: Optional[StrictFloat] = Field(
default=None, description="Intangible assets"
)
tax_assets: Optional[StrictInt] = Field(
tax_assets: Optional[StrictFloat] = Field(
default=None, description="Accrued income taxes"
)
other_assets: Optional[StrictInt] = Field(default=None, description="Other assets")
non_current_assets: Optional[StrictInt] = Field(
non_current_assets: Optional[StrictFloat] = Field(
default=None, description="Total non-current assets"
)
other_non_current_assets: Optional[StrictInt] = Field(
other_non_current_assets: Optional[StrictFloat] = Field(
default=None, description="Other non-current assets"
)

account_payables: Optional[StrictInt] = Field(
account_payables: Optional[StrictFloat] = Field(
default=None, description="Accounts payable"
)
tax_payables: Optional[StrictInt] = Field(
tax_payables: Optional[StrictFloat] = Field(
default=None, description="Accrued income taxes"
)
deferred_revenue: Optional[StrictInt] = Field(
deferred_revenue: Optional[StrictFloat] = Field(
default=None, description="Accrued income taxes, other deferred revenue"
)
other_assets: Optional[StrictInt] = Field(default=None, description="Other assets")
total_assets: Optional[StrictInt] = Field(default=None, description="Total assets")
other_assets: Optional[StrictFloat] = Field(
default=None, description="Other assets"
)
total_assets: Optional[StrictFloat] = Field(
default=None, description="Total assets"
)

long_term_debt: Optional[StrictInt] = Field(
long_term_debt: Optional[StrictFloat] = Field(
default=None,
description="Long-term debt, Operating lease obligations, Long-term finance lease obligations",
)
short_term_debt: Optional[StrictInt] = Field(
short_term_debt: Optional[StrictFloat] = Field(
default=None,
description="Short-term borrowings, Long-term debt due within one year, "
"Operating lease obligations due within one year, "
"Finance lease obligations due within one year",
)

liabilities: Optional[StrictInt] = Field(
liabilities: Optional[StrictFloat] = Field(
default=None, description="Total liabilities"
)
other_current_liabilities: Optional[StrictInt] = Field(
other_current_liabilities: Optional[StrictFloat] = Field(
default=None, description="Other current liabilities"
)
current_liabilities: Optional[StrictInt] = Field(
current_liabilities: Optional[StrictFloat] = Field(
default=None, description="Total current liabilities"
)
total_liabilities_and_total_equity: Optional[StrictInt] = Field(
total_liabilities_and_total_equity: Optional[StrictFloat] = Field(
default=None, description="Total liabilities and total equity"
)
other_liabilities: Optional[StrictInt] = Field(
default=None, description="Other liabilities"
)
other_non_current_liabilities: Optional[StrictInt] = Field(
other_non_current_liabilities: Optional[StrictFloat] = Field(
default=None, description="Other non-current liabilities"
)
non_current_liabilities: Optional[StrictInt] = Field(
non_current_liabilities: Optional[StrictFloat] = Field(
default=None, description="Total non-current liabilities"
)
total_liabilities_and_stockholders_equity: Optional[StrictInt] = Field(
total_liabilities_and_stockholders_equity: Optional[StrictFloat] = Field(
default=None, description="Total liabilities and stockholders' equity"
)
other_stockholder_equity: Optional[StrictInt] = Field(
other_stockholder_equity: Optional[StrictFloat] = Field(
default=None, description="Other stockholders equity"
)
total_stockholders_equity: Optional[StrictInt] = Field(
total_stockholders_equity: Optional[StrictFloat] = Field(
default=None, description="Total stockholders' equity"
)
other_liabilities: Optional[StrictInt] = Field(
other_liabilities: Optional[StrictFloat] = Field(
default=None, description="Other liabilities"
)
total_liabilities: Optional[StrictInt] = Field(
total_liabilities: Optional[StrictFloat] = Field(
default=None, description="Total liabilities"
)

common_stock: Optional[StrictInt] = Field(default=None, description="Common stock")
preferred_stock: Optional[StrictInt] = Field(
common_stock: Optional[StrictFloat] = Field(
default=None, description="Common stock"
)
preferred_stock: Optional[StrictFloat] = Field(
default=None, description="Preferred stock"
)

accumulated_other_comprehensive_income_loss: Optional[StrictInt] = Field(
accumulated_other_comprehensive_income_loss: Optional[StrictFloat] = Field(
default=None, description="Accumulated other comprehensive income (loss)"
)
retained_earnings: Optional[StrictInt] = Field(
retained_earnings: Optional[StrictFloat] = Field(
default=None, description="Retained earnings"
)
minority_interest: Optional[StrictInt] = Field(
minority_interest: Optional[StrictFloat] = Field(
default=None, description="Minority interest"
)
total_equity: Optional[StrictInt] = Field(default=None, description="Total equity")
total_equity: Optional[StrictFloat] = Field(
default=None, description="Total equity"
)

@field_validator("symbol", mode="before", check_fields=False)
@classmethod
def upper_symbol(cls, v: Union[str, List[str], Set[str]]):
"""Convert symbol to uppercase."""
if isinstance(v, str):
Expand Down
Loading
Loading