mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-27 11:41:32 +00:00
refactored AvailableIndices for economy.available_indices
This commit is contained in:
@@ -3,34 +3,31 @@
|
||||
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from openbb_provider.abstract.data import Data, QueryParams
|
||||
from openbb_provider.abstract.fetcher import Fetcher
|
||||
from openbb_provider.helpers import data_transformer
|
||||
from openbb_provider.models.available_indices import (
|
||||
AvailableIndicesData,
|
||||
AvailableIndicesQueryParams,
|
||||
)
|
||||
from pydantic import Field
|
||||
|
||||
from openbb_fmp.utils.helpers import get_data_many
|
||||
|
||||
|
||||
class FMPAvailableIndicesQueryParams(QueryParams):
|
||||
"""FMP Available Indices query.
|
||||
class FMPAvailableIndicesQueryParams(AvailableIndicesQueryParams):
|
||||
"""FMP Available Indices Query.
|
||||
|
||||
Source: https://site.financialmodelingprep.com/developer/docs/#Historical-stock-index-prices
|
||||
|
||||
"""
|
||||
|
||||
|
||||
class FMPAvailableIndicesData(Data):
|
||||
"""FMP Available Indices data."""
|
||||
class FMPAvailableIndicesData(AvailableIndicesData):
|
||||
"""FMP Available Indices Data."""
|
||||
|
||||
symbol: str
|
||||
name: Optional[str]
|
||||
currency: Optional[str]
|
||||
stockExchange: str = Field(alias="stock_exchange")
|
||||
exchangeShortName: str = Field(alias="exchange_short_name")
|
||||
class Config:
|
||||
fields = {
|
||||
"stock_exchange": "stockExchange",
|
||||
"exchange_short_name": "exchangeShortName",
|
||||
}
|
||||
|
||||
|
||||
class FMPAvailableIndicesFetcher(
|
||||
|
||||
@@ -4,33 +4,26 @@
|
||||
from typing import Optional
|
||||
|
||||
from openbb_provider.abstract.data import Data, QueryParams
|
||||
from openbb_provider.models.base import BaseSymbol
|
||||
|
||||
from pydantic import Field
|
||||
|
||||
|
||||
class AvailableIndicesQueryParams(QueryParams):
|
||||
"""Available Indices query."""
|
||||
"""Available Indices Query."""
|
||||
|
||||
|
||||
class AvailableIndicesData(Data):
|
||||
"""Available Indices data.
|
||||
class AvailableIndicesData(Data, BaseSymbol):
|
||||
"""Available Indices Data.
|
||||
|
||||
Returns the major indices from Dow Jones, Nasdaq and, S&P 500.
|
||||
|
||||
Returns
|
||||
-------
|
||||
symbol : str
|
||||
The symbol of the index.
|
||||
name : Optional[str]
|
||||
The name of the index.
|
||||
currency : Optional[str]
|
||||
The currency the index is traded in.
|
||||
stock_exchange : str
|
||||
The stock exchange where the index is listed.
|
||||
exchange_short_name : str
|
||||
The short name of the stock exchange where the index is listed.
|
||||
"""
|
||||
|
||||
symbol: str
|
||||
name: Optional[str]
|
||||
currency: Optional[str]
|
||||
stock_exchange: str
|
||||
exchange_short_name: str
|
||||
name: Optional[str] = Field(description="The name of the index.")
|
||||
currency: Optional[str] = Field(description="The currency the index is traded in.")
|
||||
stock_exchange: str = Field(
|
||||
description="The stock exchange where the index is listed."
|
||||
)
|
||||
exchange_short_name: str = Field(
|
||||
description="The short name of the stock exchange where the index is listed."
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user