mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-12-01 13:44:16 +00:00
refactored HistoricalStockSplits for stocks.fa.split
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""FMP Historical Stock Splits fetcher."""
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from openbb_provider.abstract.fetcher import Fetcher
|
||||
@@ -11,21 +12,22 @@ from openbb_provider.models.historical_stock_splits import (
|
||||
|
||||
from openbb_fmp.utils.helpers import create_url, get_data_many
|
||||
|
||||
from pydantic import validator
|
||||
|
||||
|
||||
class FMPHistoricalStockSplitsQueryParams(HistoricalStockSplitsQueryParams):
|
||||
"""FMP Historical Stock Splits query.
|
||||
"""FMP Historical Stock Splits Query.
|
||||
|
||||
Source: https://site.financialmodelingprep.com/developer/docs/historical-stock-splits-api/
|
||||
|
||||
Parameter
|
||||
---------
|
||||
symbol : str
|
||||
The symbol of the company.
|
||||
"""
|
||||
|
||||
|
||||
class FMPHistoricalStockSplitsData(HistoricalStockSplitsData):
|
||||
"""FMP Historical Stock Splits data."""
|
||||
"""FMP Historical Stock Splits Data."""
|
||||
|
||||
@validator("date", pre=True, check_fields=False)
|
||||
def date_validate(cls, v: str): # pylint: disable=E0213
|
||||
return datetime.strptime(v, "%Y-%m-%d") if v else None
|
||||
|
||||
|
||||
class FMPHistoricalStockSplitsFetcher(
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
"""Historical stock splits data model."""
|
||||
"""Historical Stock Splits data model."""
|
||||
|
||||
|
||||
from datetime import date as dateType
|
||||
@@ -6,34 +6,23 @@ from datetime import date as dateType
|
||||
from openbb_provider.abstract.data import Data
|
||||
from openbb_provider.abstract.query_params import QueryParams
|
||||
from openbb_provider.models.base import BaseSymbol
|
||||
from openbb_provider.metadata import DATA_DESCRIPTIONS
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
|
||||
class HistoricalStockSplitsQueryParams(QueryParams, BaseSymbol):
|
||||
"""Historical Stock Splits query model.
|
||||
|
||||
Parameter
|
||||
---------
|
||||
symbol : str
|
||||
The symbol of the company.
|
||||
"""
|
||||
"""Historical Stock Splits Query."""
|
||||
|
||||
|
||||
class HistoricalStockSplitsData(Data):
|
||||
"""Historical stock splits data.
|
||||
"""Historical Stock Splits Data."""
|
||||
|
||||
Returns
|
||||
-------
|
||||
date : date
|
||||
The date of the historical stock splits.
|
||||
label : str
|
||||
The label of the historical stock splits.
|
||||
numerator : float
|
||||
The numerator of the historical stock splits.
|
||||
denominator : float
|
||||
The denominator of the historical stock splits.
|
||||
"""
|
||||
|
||||
date: dateType
|
||||
label: str
|
||||
numerator: float
|
||||
denominator: float
|
||||
date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", ""))
|
||||
label: str = Field(description="The label of the historical stock splits.")
|
||||
numerator: float = Field(
|
||||
description="The numerator of the historical stock splits."
|
||||
)
|
||||
denominator: float = Field(
|
||||
description="The denominator of the historical stock splits."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user