feat: revenue business line

This commit is contained in:
Diogo Sousa
2024-02-09 15:43:00 +00:00
parent e4ca7ad037
commit 160b5a146b
2 changed files with 7 additions and 8 deletions

View File

@@ -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):

View File

@@ -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."""