mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-02 07:23:25 +00:00
refactored PriceTargetConsensus for stocks.fa.pt
This commit is contained in:
@@ -1,10 +1,8 @@
|
||||
"""FMP Price Target Consensus fetcher."""
|
||||
|
||||
|
||||
from enum import Enum
|
||||
from typing import Any, Dict, List, Optional
|
||||
|
||||
from openbb_provider.abstract.data import Data
|
||||
from openbb_provider.abstract.fetcher import Fetcher
|
||||
from openbb_provider.models.price_target_consensus import (
|
||||
PriceTargetConsensusData,
|
||||
@@ -14,34 +12,23 @@ from openbb_provider.models.price_target_consensus import (
|
||||
from openbb_fmp.utils.helpers import create_url, get_data_many
|
||||
|
||||
|
||||
class Interval(str, Enum):
|
||||
oneminute = "1min"
|
||||
fiveminute = "5min"
|
||||
fifteenminute = "15min"
|
||||
thirtyminute = "30min"
|
||||
onehour = "1hour"
|
||||
fourhour = "4hour"
|
||||
day = "day"
|
||||
|
||||
|
||||
class FMPPriceTargetConsensusQueryParams(PriceTargetConsensusQueryParams):
|
||||
"""FMP Price Target Consensus query.
|
||||
"""FMP Price Target Consensus Query.
|
||||
|
||||
Source: https://site.financialmodelingprep.com/developer/docs/price-target-consensus-api/
|
||||
|
||||
Parameter
|
||||
---------
|
||||
symbol : str
|
||||
The symbol of the company.
|
||||
"""
|
||||
|
||||
|
||||
class FMPPriceTargetConsensusData(Data):
|
||||
symbol: str
|
||||
targetHigh: float
|
||||
targetLow: float
|
||||
targetConsensus: float
|
||||
targetMedian: float
|
||||
class FMPPriceTargetConsensusData(PriceTargetConsensusData):
|
||||
"""FMP Price Target Consensus Data."""
|
||||
|
||||
class Config:
|
||||
fields = {
|
||||
"target_high": "targetHigh",
|
||||
"target_low": "targetLow",
|
||||
"target_consensus": "targetConsensus",
|
||||
"target_median": "targetMedian",
|
||||
}
|
||||
|
||||
|
||||
class FMPPriceTargetConsensusFetcher(
|
||||
|
||||
@@ -5,36 +5,25 @@ from openbb_provider.abstract.data import Data
|
||||
from openbb_provider.abstract.query_params import QueryParams
|
||||
from openbb_provider.models.base import BaseSymbol
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
|
||||
class PriceTargetConsensusQueryParams(QueryParams, BaseSymbol):
|
||||
"""Price Target Consensus query.
|
||||
|
||||
Parameter
|
||||
---------
|
||||
symbol : str
|
||||
The symbol of the company.
|
||||
"""
|
||||
"""Price Target Consensus Query."""
|
||||
|
||||
|
||||
class PriceTargetConsensusData(Data):
|
||||
"""Price target consensus data.
|
||||
class PriceTargetConsensusData(Data, BaseSymbol):
|
||||
"""Price target consensus Data."""
|
||||
|
||||
Returns
|
||||
-------
|
||||
symbol : str
|
||||
The symbol of the asset.
|
||||
target_high : float
|
||||
The high target of the price target consensus.
|
||||
target_low : float
|
||||
The low target of the price target consensus.
|
||||
target_consensus : float
|
||||
The consensus target of the price target consensus.
|
||||
target_median : float
|
||||
The median target of the price target consensus.
|
||||
"""
|
||||
|
||||
symbol: str
|
||||
target_high: float
|
||||
target_low: float
|
||||
target_consensus: float
|
||||
target_median: float
|
||||
target_high: float = Field(
|
||||
description="The high target of the price target consensus."
|
||||
)
|
||||
target_low: float = Field(
|
||||
description="The low target of the price target consensus."
|
||||
)
|
||||
target_consensus: float = Field(
|
||||
description="The consensus target of the price target consensus."
|
||||
)
|
||||
target_median: float = Field(
|
||||
description="The median target of the price target consensus."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user