mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-02 07:23:25 +00:00
Added stocks.fa.emp from FMP
This commit is contained in:
@@ -60,10 +60,15 @@ def earning(
|
||||
return CommandOutput(results=Query(**locals()).execute())
|
||||
|
||||
|
||||
@router.command
|
||||
def emp() -> CommandOutput[Empty]: # type: ignore
|
||||
@router.command(query="HistoricalEmployees")
|
||||
def emp(
|
||||
cc: CommandContext,
|
||||
provider_choices: ProviderChoices,
|
||||
standard_params: StandardParams,
|
||||
extra_params: ExtraParams,
|
||||
) -> CommandOutput[BaseModel]:
|
||||
"""Number of Employees."""
|
||||
return CommandOutput(results=Empty())
|
||||
return CommandOutput(results=Query(**locals()).execute())
|
||||
|
||||
|
||||
@router.command(query="AnalystEstimates")
|
||||
|
||||
73
openbb_sdk/providers/fmp/openbb_fmp/historical_employees.py
Normal file
73
openbb_sdk/providers/fmp/openbb_fmp/historical_employees.py
Normal file
@@ -0,0 +1,73 @@
|
||||
"""FMP Historical Employees fetcher."""
|
||||
|
||||
# IMPORT STANDARD
|
||||
from datetime import date, datetime
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
# IMPORT INTERNAL
|
||||
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.historical_employees import (
|
||||
HistoricalEmployeesData,
|
||||
HistoricalEmployeesQueryParams,
|
||||
)
|
||||
|
||||
# IMPORT THIRD-PARTY
|
||||
from pydantic import Field
|
||||
|
||||
from .helpers import create_url, get_data_many
|
||||
|
||||
|
||||
class FMPHistoricalEmployeesQueryParams(HistoricalEmployeesQueryParams):
|
||||
"""FMP Historical Employees query.
|
||||
|
||||
Source: https://site.financialmodelingprep.com/developer/docs/historical-numer-of-employees-api/
|
||||
|
||||
Parameter
|
||||
---------
|
||||
symbol : str
|
||||
The symbol of the company.
|
||||
"""
|
||||
|
||||
|
||||
class FMPHistoricalEmployeesData(Data):
|
||||
symbol: str = Field(min_length=1)
|
||||
cik: int
|
||||
acceptanceTime: datetime = Field(alias="acceptance_time")
|
||||
periodOfReport: date = Field(alias="period_of_report")
|
||||
companyName: str = Field(alias="company_name")
|
||||
formType: str = Field(alias="form_type")
|
||||
filingDate: date = Field(alias="filing_date")
|
||||
employeeCount: int = Field(alias="employee_count")
|
||||
source: str
|
||||
|
||||
|
||||
class FMPHistoricalEmployeesFetcher(
|
||||
Fetcher[
|
||||
HistoricalEmployeesQueryParams,
|
||||
HistoricalEmployeesData,
|
||||
FMPHistoricalEmployeesQueryParams,
|
||||
FMPHistoricalEmployeesData,
|
||||
]
|
||||
):
|
||||
@staticmethod
|
||||
def transform_query(
|
||||
query: HistoricalEmployeesQueryParams, extra_params: Optional[Dict] = None
|
||||
) -> FMPHistoricalEmployeesQueryParams:
|
||||
return FMPHistoricalEmployeesQueryParams(
|
||||
symbol=query.symbol, **extra_params or {}
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def extract_data(
|
||||
query: FMPHistoricalEmployeesQueryParams, api_key: str
|
||||
) -> List[FMPHistoricalEmployeesData]:
|
||||
url = create_url(4, "historical/employee_count", api_key, query)
|
||||
return get_data_many(url, FMPHistoricalEmployeesData)
|
||||
|
||||
@staticmethod
|
||||
def transform_data(
|
||||
data: List[FMPHistoricalEmployeesData],
|
||||
) -> List[HistoricalEmployeesData]:
|
||||
return data_transformer(data, HistoricalEmployeesData)
|
||||
@@ -25,6 +25,7 @@ from .forex_pairs import FMPForexPairsFetcher
|
||||
from .forex_price import FMPForexPriceFetcher
|
||||
from .global_news import FMPGlobalNewsFetcher
|
||||
from .historical_dividends import FMPHistoricalDividendsFetcher
|
||||
from .historical_employees import FMPHistoricalEmployeesFetcher
|
||||
from .historical_stock_splits import FMPHistoricalStockSplitsFetcher
|
||||
from .income_statement import FMPIncomeStatementFetcher
|
||||
from .institutional_ownership import FMPInstitutionalOwnershipFetcher
|
||||
@@ -92,5 +93,6 @@ fmp_provider = Provider(
|
||||
FMPForexPairsFetcher,
|
||||
FMPStockPeersFetcher,
|
||||
FMPStockMultiplesFetcher,
|
||||
FMPHistoricalEmployeesFetcher,
|
||||
],
|
||||
)
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
"""Historical Employees data model."""
|
||||
|
||||
|
||||
from datetime import date, datetime
|
||||
|
||||
from openbb_provider.abstract.data import Data, QueryParams
|
||||
from openbb_provider.models.base import BaseSymbol
|
||||
|
||||
|
||||
class HistoricalEmployeesQueryParams(QueryParams, BaseSymbol):
|
||||
"""Historical Employees query model.
|
||||
|
||||
Parameter
|
||||
---------
|
||||
symbol : str
|
||||
The symbol of the company.
|
||||
"""
|
||||
|
||||
|
||||
class HistoricalEmployeesData(Data):
|
||||
"""Historical Employees data.
|
||||
|
||||
Returns
|
||||
-------
|
||||
symbol : str
|
||||
The symbol of the company to retrieve the historical employees of.
|
||||
cik : int
|
||||
The CIK of the company to retrieve the historical employees of.
|
||||
acceptance_time : datetime
|
||||
The time of acceptance of the company employee.
|
||||
period_of_report : date
|
||||
The date of reporting of the company employee.
|
||||
company_name : str
|
||||
The registered name of the company to retrieve the historical employees of.
|
||||
form_type : float
|
||||
The form type of the company employee.
|
||||
filing_date : date
|
||||
The filing date of the company employee
|
||||
employee_count : int
|
||||
The count of employees of the company.
|
||||
source : str
|
||||
The source URL which retrieves this data for the company.
|
||||
"""
|
||||
|
||||
symbol: str
|
||||
cik: int
|
||||
acceptance_time: datetime
|
||||
period_of_report: date
|
||||
company_name: str
|
||||
form_type: str
|
||||
filing_date: date
|
||||
employee_count: int
|
||||
source: str
|
||||
Reference in New Issue
Block a user