mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-26 11:12:50 +00:00
feat: share statistics
This commit is contained in:
@@ -20,11 +20,9 @@ class ShareStatisticsQueryParams(QueryParams):
|
||||
|
||||
@field_validator("symbol", mode="before", check_fields=False)
|
||||
@classmethod
|
||||
def upper_symbol(cls, v: Union[str, List[str], Set[str]]):
|
||||
def upper_symbol(cls, v: str) -> str:
|
||||
"""Convert symbol to uppercase."""
|
||||
if isinstance(v, str):
|
||||
return v.upper()
|
||||
return ",".join([symbol.upper() for symbol in list(v)])
|
||||
return v.upper()
|
||||
|
||||
|
||||
class ShareStatisticsData(Data):
|
||||
|
||||
@@ -4,9 +4,12 @@ from typing import Optional
|
||||
|
||||
|
||||
def check_single(v: Optional[str]) -> Optional[str]:
|
||||
"""Check that string is not comma-separated string"""
|
||||
if v and "," in v:
|
||||
raise ValueError("comma-separated values are not allowed")
|
||||
"""Check that string is a single value."""
|
||||
if v:
|
||||
if "," in v:
|
||||
raise ValueError("comma-separated values are not allowed")
|
||||
if ";" in v:
|
||||
raise ValueError("semicolon-separated values are not allowed")
|
||||
return v
|
||||
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ class FMPShareStatisticsQueryParams(ShareStatisticsQueryParams):
|
||||
Source: https://site.financialmodelingprep.com/developer/docs/shares-float-api/
|
||||
"""
|
||||
|
||||
__validator_dict__ = {"check_single": ("symbol",)}
|
||||
|
||||
|
||||
class FMPShareStatisticsData(ShareStatisticsData):
|
||||
"""FMP Share Statistics Data."""
|
||||
|
||||
@@ -23,6 +23,8 @@ class IntrinioShareStatisticsQueryParams(ShareStatisticsQueryParams):
|
||||
https://data.intrinio.com/data-tag/public_float
|
||||
"""
|
||||
|
||||
__validator_dict__ = {"check_single": ("symbol",)}
|
||||
|
||||
|
||||
class IntrinioShareStatisticsData(ShareStatisticsData):
|
||||
"""Intrinio Share Statistics Data."""
|
||||
|
||||
Reference in New Issue
Block a user