refactored CompanyOverview for stocks.fa.overview

This commit is contained in:
Pratyush Shukla
2023-07-25 23:31:34 +05:30
parent 00d63a1253
commit dcc6c8606b
3 changed files with 73 additions and 169 deletions

View File

@@ -3,7 +3,6 @@
from typing import Dict, Optional
from openbb_provider.abstract.data import Data
from openbb_provider.abstract.fetcher import Fetcher
from openbb_provider.helpers import data_transformer
from openbb_provider.models.company_overview import (
@@ -17,58 +16,35 @@ from openbb_fmp.utils.helpers import get_data
class FMPCompanyOverviewQueryParams(CompanyOverviewQueryParams):
"""FMP Company Overview query.
"""FMP Company Overview Query.
Source: https://site.financialmodelingprep.com/developer/docs/companies-key-stats-free-api/
Parameter
---------
symbol : str
The symbol of the company.
"""
class FMPCompanyOverviewData(Data):
symbol: str
price: float
beta: float
volAvg: int
mktCap: int
lastDiv: float
range: str
changes: float
companyName: str
currency: str
cik: Optional[str]
isin: Optional[str]
cusip: Optional[str]
exchange: str
exchangeShortName: str
industry: str
website: str
description: str
ceo: str
sector: str
country: str
fullTimeEmployees: str
phone: str
address: str
city: str
state: str
zip: str
dcfDiff: float
dcf: float
image: str
ipoDate: str
defaultImage: bool
isEtf: bool
isActivelyTrading: bool
isAdr: bool
isFund: bool
class FMPCompanyOverviewData(CompanyOverviewData):
"""FMP Company Overview Data."""
class Config:
fields = {
"vol_avg": "volAvg",
"mkt_cap": "mktCap",
"last_div": "lastDiv",
"company_name": "companyName",
"exchange_short_name": "exchangeShortName",
"full_time_employees": "fullTimeEmployees",
"dcf_diff": "dcfDiff",
"ipo_date": "ipoDate",
"default_image": "defaultImage",
"is_etf": "isEtf",
"is_actively_trading": "isActivelyTrading",
"is_adr": "isAdr",
"is_fund": "isFund",
}
class FMPCompanyProfileFetcher(
Fetcher[ # type: ignore
class FMPCompanyOverviewFetcher(
Fetcher[
CompanyOverviewQueryParams,
CompanyOverviewData,
FMPCompanyOverviewQueryParams,

View File

@@ -7,7 +7,7 @@ from openbb_fmp.models.analyst_estimates import FMPAnalystEstimatesFetcher
from openbb_fmp.models.available_indices import FMPAvailableIndicesFetcher
from openbb_fmp.models.balance_sheet import FMPBalanceSheetFetcher
from openbb_fmp.models.cash_flow import FMPCashFlowStatementFetcher
from openbb_fmp.models.company_profile import FMPCompanyProfileFetcher
from openbb_fmp.models.company_overview import FMPCompanyOverviewFetcher
from openbb_fmp.models.crypto_eod import FMPCryptoEODFetcher
from openbb_fmp.models.crypto_price import FMPCryptoPriceFetcher
from openbb_fmp.models.dividend_calendar import FMPDividendCalendarFetcher
@@ -69,7 +69,7 @@ fmp_provider = Provider(
FMPRevenueGeographicFetcher,
FMPRevenueBusinessLineFetcher,
FMPInstitutionalOwnershipFetcher,
FMPCompanyProfileFetcher,
FMPCompanyOverviewFetcher,
FMPStockInsiderTradingFetcher,
FMPStockOwnershipFetcher,
FMPESGScoreFetcher,

View File

@@ -7,129 +7,57 @@ from typing import Optional
from openbb_provider.abstract.data import Data, QueryParams
from openbb_provider.models.base import BaseSymbol
from pydantic import Field
class CompanyOverviewQueryParams(QueryParams, BaseSymbol):
"""Company overview query.
"""Company overview Query."""
Parameter
---------
symbol : str
The symbol of the company.
class CompanyOverviewData(Data, BaseSymbol):
"""Company Overview Data.
Returns the profile of a given company.
"""
class CompanyOverviewData(Data):
"""Company Overview data.
Returns
-------
symbol : str
The symbol of the company.
price : float
The price of the company.
beta : float
The beta of the company.
vol_avg : int
The volume average of the company.
mkt_cap : int
The market capitalization of the company.
last_div : float
The last dividend of the company.
range : str
The range of the company.
changes : float
The changes of the company.
company_name : str
The company name of the company.
currency : str
The currency of the company.
cik : Optional[str]
The CIK of the company.
isin : Optional[str]
The ISIN of the company.
cusip : Optional[str]
The CUSIP of the company.
exchange : str
The exchange of the company.
exchange_short_name : str
The exchange short name of the company.
industry : str
The industry of the company.
website : str
The website of the company.
description : str
The description of the company.
ceo : str
The CEO of the company.
sector : str
The sector of the company.
country : str
The country of the company.
full_time_employees : str
The full time employees of the company.
phone : str
The phone of the company.
address : str
The address of the company.
city : str
The city of the company.
state : str
The state of the company.
zip : str
The zip of the company.
dcf_diff : float
The discounted cash flow difference of the company.
dcf : float
The discounted cash flow of the company.
image : str
The image of the company.
ipo_date : date
The IPO date of the company.
default_image : bool
If the image is the default image.
is_etf : bool
If the company is an ETF.
is_actively_trading : bool
If the company is actively trading.
is_adr : bool
If the company is an ADR.
is_fund : bool
If the company is a fund.
"""
symbol: str
price: float
beta: float
vol_avg: int
mkt_cap: int
last_div: float
range: str
changes: float
company_name: str
currency: str
cik: Optional[str]
isin: Optional[str]
cusip: Optional[str]
exchange: str
exchange_short_name: str
industry: str
website: str
description: str
ceo: str
sector: str
country: str
full_time_employees: str
phone: str
address: str
city: str
state: str
zip: str
dcf_diff: float
dcf: float
image: str
ipo_date: date
default_image: bool
is_etf: bool
is_actively_trading: bool
is_adr: bool
is_fund: bool
price: float = Field(description="The price of the company.")
beta: float = Field(description="The beta of the company.")
vol_avg: int = Field(description="The volume average of the company.")
mkt_cap: int = Field(description="The market capitalization of the company.")
last_div: float = Field(description="The last dividend of the company.")
range: str = Field(description="The range of the company.")
changes: float = Field(description="The changes of the company.")
company_name: str = Field(description="The company name of the company.")
currency: str = Field(description="The currency of the company.")
cik: Optional[str] = Field(description="The CIK of the company.")
isin: Optional[str] = Field(description="The ISIN of the company.")
cusip: Optional[str] = Field(description="The CUSIP of the company.")
exchange: str = Field(description="The exchange of the company.")
exchange_short_name: str = Field(
description="The exchange short name of the company."
)
industry: str = Field(description="The industry of the company.")
website: str = Field(description="The website of the company.")
description: str = Field(description="The description of the company.")
ceo: str = Field(description="The CEO of the company.")
sector: str = Field(description="The sector of the company.")
country: str = Field(description="The country of the company.")
full_time_employees: str = Field(
description="The full time employees of the company."
)
phone: str = Field(description="The phone of the company.")
address: str = Field(description="The address of the company.")
city: str = Field(description="The city of the company.")
state: str = Field(description="The state of the company.")
zip: str = Field(description="The zip of the company.")
dcf_diff: float = Field(
description="The discounted cash flow difference of the company."
)
dcf: float = Field(description="The discounted cash flow of the company.")
image: str = Field(description="The image of the company.")
ipo_date: date = Field(description="The IPO date of the company.")
default_image: bool = Field(description="If the image is the default image.")
is_etf: bool = Field(description="If the company is an ETF.")
is_actively_trading: bool = Field(description="If the company is actively trading.")
is_adr: bool = Field(description="If the company is an ADR.")
is_fund: bool = Field(description="If the company is a fund.")