Fix income statement and lint

This commit is contained in:
Igor Radovanovic
2023-07-12 14:11:25 +02:00
parent 228ab0b529
commit c469ca3853
20 changed files with 41 additions and 27 deletions

View File

@@ -87,7 +87,7 @@ class FMPIncomeStatementData(Data):
netIncome: Optional[int]
netIncomeRatio: Optional[float]
eps: Optional[float]
epsdiluted: Optional[float]
epsdiluted: Optional[float] = Field(alias="eps_diluted")
weightedAverageShsOut: Optional[int] = Field(
alias="weighted_average_shares_outstanding"
)

View File

@@ -27,16 +27,15 @@ class PolygonIncomeStatementQueryParams(PolygonFundamentalQueryParams):
class PolygonIncomeStatementData(Data):
start_date: dateType = Field(alias="date")
tickers: Optional[List[str]] = Field(alias="symbol")
tickers: Optional[List[str]]
cik: Optional[str]
filing_date: dateType
filing_date: Optional[dateType]
acceptance_datetime: Optional[datetime] = Field(alias="accepted_date")
fiscal_period: Optional[str] = Field(alias="period")
revenues: Optional[float] = Field(alias="revenue")
cost_of_revenue: Optional[float]
gross_profit: Optional[float]
operating_expenses: Optional[float]
costs_and_expenses: Optional[float]
income_loss_from_continuing_operations_before_tax: Optional[float] = Field(
alias="income_before_tax"
)
@@ -91,16 +90,14 @@ class PolygonIncomeStatementFetcher(
new = {"acceptance_datetime": item.get("acceptance_datetime")}
new["start_date"] = item["start_date"]
new["filing_date"] = item.get("filing_date")
new["cik"] = item["cik"]
new["fiscal_period"] = item["fiscal_period"]
new["tickers"] = item["tickers"]
to_return.append(PolygonIncomeStatementData(**new))
new["cik"] = item["cik"]
incs = item["financials"]["income_statement"]
new["revenues"] = incs["revenues"].get("value")
new["cost_of_revenue"] = incs["cost_of_revenue"].get("value")
new["gross_profit"] = incs["gross_profit"].get("value")
new["cost_of_revenue"] = incs.get("cost_of_revenue", {}).get("value", 0)
new["gross_profit"] = incs.get("gross_profit", {}).get("value", 0)
new["operating_expenses"] = incs["operating_expenses"].get("value")
new["costs_and_expenses"] = incs["costs_and_expenses"].get("value")
new["income_loss_from_continuing_operations_before_tax"] = incs[
"income_loss_from_continuing_operations_before_tax"
].get("value")
@@ -140,9 +137,9 @@ class PolygonIncomeStatementFetcher(
new["benefits_costs_expenses"] = incs["benefits_costs_expenses"].get(
"value"
)
new["interest_expense_operating"] = incs["interest_expense_operating"].get(
"value"
)
new["interest_expense_operating"] = incs.get(
"interest_expense_operating", {}
).get("value", 0)
to_return.append(PolygonIncomeStatementData(**new))
return to_return

View File

@@ -52,19 +52,21 @@ class IncomeStatementData(Data):
selling_and_marketing_expenses : Optional[float]
The selling and marketing expenses of the income statement.
selling_general_and_administrative_expenses : Optional[int]
The selling general and administrative expenses of the income statement.
The selling, general and administrative expenses of the income statement.
other_expenses : Optional[int]
The other expenses of the income statement.
operating_expenses : Optional[int]
The operating expenses of the income statement.
cost_and_expenses : Optional[int]
The cost and expenses of the income statement.
depreciation_and_amortization : Optional[int]
The depreciation and amortization of the income statement.
ebitda : Optional[int]
The earnings before interest, taxes, depreciation, and amortization of the income statement.
The earnings before interest, taxes, depreciation and amortization of the income statement.
operating_income : Optional[int]
The operating income of the income statement.
interest_income : Optional[int]
The interest income of the income statement.
interest_expense : Optional[int]
The interest expense of the income statement.
total_other_income_expenses_net : Optional[int]
The total other income expenses net of the income statement.
income_before_tax : Optional[int]
@@ -76,11 +78,7 @@ class IncomeStatementData(Data):
eps : Optional[float]
The earnings per share of the income statement.
eps_diluted : Optional[float]
The earnings per share diluted of the income statement.
interest_expense : Optional[int]
The interest expense of the income statement.
interest_income : Optional[int]
The interest income of the income statement.
The diluted earnings per share of the income statement.
weighted_average_shares_outstanding : Optional[int]
The weighted average shares outstanding of the income statement.
weighted_average_shares_outstanding_dil : Optional[int]
@@ -88,32 +86,34 @@ class IncomeStatementData(Data):
"""
date: dateType
symbol: str
currency: Optional[str] = None
cik: Optional[int]
filing_date: dateType
filing_date: Optional[dateType] = None
accepted_date: Optional[dateType] = None
period: Optional[str]
revenue: Optional[int]
cost_of_revenue: Optional[int]
gross_profit: Optional[int]
research_and_development_expenses: Optional[int] = None
general_and_administrative_expenses: Optional[int] = None
selling_and_marketing_expenses: Optional[float] = None
selling_general_and_administrative_expenses: Optional[int] = None
other_expenses: Optional[int] = None
operating_expenses: Optional[int]
cost_and_expenses: Optional[int]
depreciation_and_amortization: Optional[int] = None
ebitda: Optional[int] = None
operating_income: Optional[int] = None
interest_income: Optional[int] = None
interest_expense: Optional[int] = None
total_other_income_expenses_net: Optional[int] = None
income_before_tax: Optional[int]
income_tax_expense: Optional[int]
net_income: Optional[int]
eps: Optional[float]
eps_diluted: Optional[float]
interest_expense: Optional[int] = None
interest_income: Optional[int] = None
weighted_average_shares_outstanding: Optional[int] = None
weighted_average_shares_outstanding_dil: Optional[int] = None

View File

@@ -9,6 +9,7 @@ import pytest
from openbb_terminal.alternative.covid import covid_controller
from openbb_terminal.core.session.current_user import PreferencesModel, copy_user
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -9,6 +9,7 @@ import pytest
from openbb_terminal.alternative.oss import oss_controller
from openbb_terminal.core.session.current_user import PreferencesModel, copy_user
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -12,6 +12,7 @@ from openbb_terminal.core.session.current_user import (
copy_user,
)
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -12,6 +12,7 @@ from openbb_terminal.core.session.current_user import (
)
from openbb_terminal.cryptocurrency.defi import defi_controller
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -9,6 +9,7 @@ import pytest
from openbb_terminal.core.session.current_user import PreferencesModel, copy_user
from openbb_terminal.cryptocurrency.discovery import discovery_controller
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -12,6 +12,7 @@ from openbb_terminal.core.session.current_user import (
)
from openbb_terminal.cryptocurrency.nft import nft_controller
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -12,6 +12,7 @@ from openbb_terminal.core.session.current_user import (
)
from openbb_terminal.cryptocurrency.onchain import onchain_controller
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -12,6 +12,7 @@ from openbb_terminal.core.session.current_user import (
)
from openbb_terminal.cryptocurrency.tools import tools_controller
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -12,6 +12,7 @@ from openbb_terminal.core.session.current_user import (
)
from openbb_terminal.futures import futures_controller
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -10,6 +10,7 @@ from openbb_terminal.core.session.current_user import PreferencesModel, copy_use
# IMPORTATION INTERNAL
from openbb_terminal.mutual_funds import mutual_fund_controller
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -12,6 +12,7 @@ from openbb_terminal.core.session.current_user import (
)
from openbb_terminal.portfolio.brokers.degiro import degiro_controller
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -12,6 +12,7 @@ from openbb_terminal.core.session.current_user import (
)
from openbb_terminal.portfolio import portfolio_controller
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -12,6 +12,7 @@ from openbb_terminal.core.session.current_user import (
)
from openbb_terminal.reports import reports_controller, reports_model
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -10,6 +10,7 @@ import pytest
from openbb_terminal.core.session.current_user import PreferencesModel, copy_user
from openbb_terminal.stocks.discovery import disc_controller
# pylint: disable=E1101,W0603,E1111

View File

@@ -11,6 +11,7 @@ import pytest
from openbb_terminal.core.session.current_user import PreferencesModel, copy_user
from openbb_terminal.stocks.fundamental_analysis import fa_controller
# pylint: disable=E1101
# pylint: disable=W0603
# pylint: disable=E1111

View File

@@ -7,6 +7,7 @@ import pytest
# IMPORTATION INTERNAL
from openbb_terminal.stocks.insider import openinsider_view
# pylint: disable=E1101

View File

@@ -6,6 +6,7 @@ import pytest
# IMPORTATION INTERNAL
from openbb_terminal.stocks.technical_analysis import rsp_view
# pylint: disable=E1101