mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-26 11:12:50 +00:00
feat: revenue business line
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
"""Revenue by Business Line Standard Model."""
|
||||
|
||||
import warnings
|
||||
from datetime import date as dateType
|
||||
from typing import Dict, Literal, Optional
|
||||
|
||||
@@ -12,8 +11,6 @@ from openbb_core.provider.utils.descriptions import (
|
||||
QUERY_DESCRIPTIONS,
|
||||
)
|
||||
|
||||
_warn = warnings.warn
|
||||
|
||||
|
||||
class RevenueBusinessLineQueryParams(QueryParams):
|
||||
"""Revenue by Business Line Query."""
|
||||
@@ -30,11 +27,7 @@ class RevenueBusinessLineQueryParams(QueryParams):
|
||||
@classmethod
|
||||
def upper_symbol(cls, v: str):
|
||||
"""Convert symbol to uppercase."""
|
||||
if "," in v:
|
||||
_warn(
|
||||
f"{QUERY_DESCRIPTIONS.get('symbol_list_warning', '')} {v.split(',')[0].upper()}"
|
||||
)
|
||||
return v.split(",")[0].upper() if "," in v else v.upper()
|
||||
return v.upper()
|
||||
|
||||
|
||||
class RevenueBusinessLineData(Data):
|
||||
|
||||
@@ -9,6 +9,7 @@ from openbb_core.provider.standard_models.revenue_business_line import (
|
||||
RevenueBusinessLineData,
|
||||
RevenueBusinessLineQueryParams,
|
||||
)
|
||||
from openbb_core.provider.utils.validators import check_single
|
||||
from openbb_fmp.models.cash_flow import FMPCashFlowStatementFetcher
|
||||
from openbb_fmp.utils.helpers import create_url, get_data_many
|
||||
from pydantic import field_validator
|
||||
@@ -20,6 +21,11 @@ class FMPRevenueBusinessLineQueryParams(RevenueBusinessLineQueryParams):
|
||||
Source: https://site.financialmodelingprep.com/developer/docs/sales-revenue-by-segments-api/
|
||||
"""
|
||||
|
||||
@field_validator("symbol", mode="before", check_fields=False)
|
||||
@classmethod
|
||||
def validate_symbol(cls, v: str) -> str:
|
||||
return check_single(v)
|
||||
|
||||
|
||||
class FMPRevenueBusinessLineData(RevenueBusinessLineData):
|
||||
"""FMP Revenue by Business Line Data."""
|
||||
|
||||
Reference in New Issue
Block a user