Stock leftover cleanup (#5745)

* change to equity in `.md` files

* `HistoricalStockSplits`->`HistoricalSplits`

* `StockInsiderTrading`->`InsiderTrading`

* sorry fmp

* `EquityHistorical` cleanup

* `EquityNBBO` cleanup

* .md leftover

* the last of stocks
This commit is contained in:
Pratyush Shukla
2023-11-17 03:33:18 +05:30
committed by GitHub
parent 757fc57174
commit 63fe4422fe
31 changed files with 326 additions and 341 deletions

View File

@@ -145,7 +145,7 @@ The standardization framework is a very powerful tool, but it has some caveats t
```python
class EquityHistoricalQueryParams(QueryParams):
"""Stock end of day Query."""
"""Equity Historical end of day Query."""
symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", ""))
start_date: Optional[date] = Field(
description=QUERY_DESCRIPTIONS.get("start_date", ""), default=None
@@ -163,7 +163,7 @@ The OpenBB Platform dynamically knows where the standard models begin in the inh
```python
class EquityHistoricalData(Data):
"""Stock end of day price Data."""
"""Equity Historical end of day price Data."""
date: datetime = Field(description=DATA_DESCRIPTIONS.get("date", ""))
open: PositiveFloat = Field(description=DATA_DESCRIPTIONS.get("open", ""))
@@ -294,7 +294,7 @@ In this section, we'll be adding a new data point to the OpenBB Platform. We wil
In this example, we'll be adding OHLC stock data that is used by the `obb.equity.price.historical` command.
Note that, if no command exists for your data, we need to add one under the right router.
Each router is categorized under different extensions (stocks, currency, crypto, etc.).
Each router is categorized under different extensions (equity, currency, crypto, etc.).
#### Check if the standard model exists
@@ -329,7 +329,7 @@ class <ProviderName>EquityHistoricalQueryParams(EquityHistoricalQueryParams):
##### Create Data Output model
The data output is the data that is returned by the API endpoint.
For the `StockHistorical` example, this would look like the following:
For the `EquityHistorical` example, this would look like the following:
```python

View File

@@ -235,14 +235,14 @@ def filings(
return OBBject(results=Query(**locals()).execute())
@router.command(model="HistoricalStockSplits")
@router.command(model="HistoricalSplits")
def historical_splits(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Historical Stock Splits. Historical stock splits data."""
"""Historical Splits. Historical splits data."""
return OBBject(results=Query(**locals()).execute())

View File

@@ -38,14 +38,14 @@ def institutional(
return OBBject(results=Query(**locals()).execute())
@router.command(model="StockInsiderTrading")
@router.command(model="InsiderTrading")
def insider_trading(
cc: CommandContext,
provider_choices: ProviderChoices,
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Stock Insider Trading. Information about insider trading."""
"""Insider Trading. Information about insider trading."""
return OBBject(results=Query(**locals()).execute())

View File

@@ -34,7 +34,7 @@ def nbbo(
standard_params: StandardParams,
extra_params: ExtraParams,
) -> OBBject[BaseModel]:
"""Equity Quote. Load National Best Bid and Offer for a specific equity."""
"""Equity NBBO. Load National Best Bid and Offer for a specific equity."""
return OBBject(results=Query(**locals()).execute())

View File

@@ -85,17 +85,17 @@ def some_command(
If your command only makes use of a standard model defined inside `openbb_provider/standard_models` directory, there is no need to repeat its structure in the parameters. Just pass the model name as an argument.
This is an example how we do it for `stocks.load` which only depends on `StockHistorical` model defined in `openbb-provider`:
This is an example how we do it for `equity.price.historical` which only depends on `EquityHistorical` model defined in `openbb-provider`:
```python
@router.command(model="StockHistorical")
def load(
@router.command(model="EquityHistorical")
def historical(
cc: CommandContext, # user settings inside
provider_choices: ProviderChoices, # available providers
standard_params: StandardParams, # symbol, start_date, etc.
extra_params: ExtraParams, # provider specific parameters
) -> OBBject[BaseModel]:
"""Load stock data for a specific ticker."""
"""Load equity data for a specific ticker."""
return OBBject(results=Query(**locals()).execute())
```
@@ -133,13 +133,13 @@ Update your credentials and default providers by modifying the `.openbb_platform
},
"defaults": {
"routes": {
"/stocks/fa/balance": {
"/equity/fundamental/balance": {
"provider": "polygon"
},
"/stocks/load": {
"/equity/price/historical": {
"provider": "fmp"
},
"/stocks/news": {
"/news/company": {
"provider": "benzinga"
}
}
@@ -163,7 +163,7 @@ Run your command:
```python
from openbb import obb
output = obb.stocks.load(
output = obb.equity.price.historical(
symbol="TSLA",
start_date="2023-01-01",
provider="fmp",
@@ -263,7 +263,7 @@ Steps to create an `OBBject` extension:
```shell
>>> from openbb import obb
>>> obbject = obb.stocks.load("AAPL")
>>> obbject = obb.equity.price.historical("AAPL")
>>> obbject.example.hello()
Hello, this is my credential: None!
```
@@ -585,7 +585,7 @@ base64_bytes = base64.b64encode(msg_bytes)
base64_msg = base64_bytes.decode('ascii')
requests.get(
url="http://127.0.0.1:8000/api/v1/stocks/load?provider=fmp&symbol=AAPL",
url="http://127.0.0.1:8000/api/v1/equity/price/historical?provider=fmp&symbol=AAPL",
headers={"Authorization": f"Basic {base64_msg}"}
)
``````

View File

@@ -421,9 +421,9 @@ def test_get_child_path_list(path_handler, path_list):
def test_clean_path(path_handler):
"""Test clean path."""
path = "/stocks/load"
path = "/equity/price/historical"
result = path_handler.clean_path(path=path)
assert result == "stocks_load"
assert result == "equity_price_historical"
def test_build_module_name(path_handler):
@@ -431,8 +431,8 @@ def test_build_module_name(path_handler):
module_name = path_handler.build_module_name(path="")
assert module_name == "__extensions__"
module_name = path_handler.build_module_name(path="/stocks/load")
assert module_name == "stocks_load"
module_name = path_handler.build_module_name(path="/equity/price/historical")
assert module_name == "equity_price_historical"
def test_build_module_class(path_handler):
@@ -440,8 +440,8 @@ def test_build_module_class(path_handler):
module_class = path_handler.build_module_class(path="")
assert module_class == "Extensions"
module_class = path_handler.build_module_class(path="/stocks/load")
assert module_class == "ROUTER_stocks_load"
module_class = path_handler.build_module_class(path="/equity/price/historical")
assert module_class == "ROUTER_equity_price_historical"
@pytest.fixture(scope="module")

View File

@@ -35,8 +35,8 @@ Data normalization, a bigger way of organizing data.
## Key Elements
- **QueryParams** : The input model for a particular query. To load stock market data, we would have `StockQueryParams`, which would have fields like `symbol`, `start_date`, and `end_date`. You can find the standard query params inside the `standard_models` directory.
- **Data** : The output model of a particular query. Stock market data would be `StockPriceData` and have fields such as `Open`, `High`, `Low`, `Close`, and `Volume`. You can find the standard data models inside the `standard_models` directory.
- **QueryParams** : The input model for a particular query. To load equity market data, we would have `EquityPriceQueryParams`, which would have fields like `symbol`, `start_date`, and `end_date`. You can find the standard query params inside the `standard_models` directory.
- **Data** : The output model of a particular query. Equity market data would be `EquityPriceData` and have fields such as `Open`, `High`, `Low`, `Close`, and `Volume`. You can find the standard data models inside the `standard_models` directory.
- **Fetcher** : Class containing a set of methods to receive query parameters, extract data and transform it. This class is responsible for implementing the standardization procedures.
- **Provider** : Entry point class for each provider extension. Contains information about the provider, it's required credentials and available fetchers.
- **RegistryLoader** : Loads the registry with the installed provider extensions.

View File

@@ -1,4 +1,4 @@
"""Stocks Fails to Deliver Data Model."""
"""Equity Fails to Deliver Data Model."""
from datetime import (
date as dateType,

View File

@@ -16,7 +16,7 @@ from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPT
class EquityHistoricalQueryParams(QueryParams):
"""Stock end of day Query."""
"""Equity Historical end of day Query."""
symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", ""))
interval: Optional[str] = Field(
@@ -42,7 +42,7 @@ class EquityHistoricalQueryParams(QueryParams):
class EquityHistoricalData(Data):
"""Stock end of day price Data."""
"""Equity Historical end of day price Data."""
date: datetime = Field(description=DATA_DESCRIPTIONS.get("date", ""))
open: PositiveFloat = Field(description=DATA_DESCRIPTIONS.get("open", ""))

View File

@@ -8,7 +8,7 @@ from openbb_provider.utils.descriptions import QUERY_DESCRIPTIONS
class EquityNBBOQueryParams(QueryParams):
"""Stock National Best Bid and Offer query model."""
"""Equity NBBO query model."""
symbol: str = Field(
description=QUERY_DESCRIPTIONS.get("symbol", ""),
@@ -22,7 +22,7 @@ class EquityNBBOQueryParams(QueryParams):
class EquityNBBOData(Data):
"""Stock National Best Bid and Offer data."""
"""Equity NBBO data."""
ask_exchange: str = Field(
description="The exchange ID for the ask.",

View File

@@ -1,4 +1,4 @@
"""Historical Stock Splits data model."""
"""Historical Splits data model."""
from datetime import date as dateType
@@ -11,8 +11,8 @@ from openbb_provider.abstract.query_params import QueryParams
from openbb_provider.utils.descriptions import DATA_DESCRIPTIONS, QUERY_DESCRIPTIONS
class HistoricalStockSplitsQueryParams(QueryParams):
"""Historical Stock Splits Query."""
class HistoricalSplitsQueryParams(QueryParams):
"""Historical Splits Query."""
symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", ""))
@@ -25,8 +25,8 @@ class HistoricalStockSplitsQueryParams(QueryParams):
return ",".join([symbol.upper() for symbol in list(v)])
class HistoricalStockSplitsData(Data):
"""Historical Stock Splits Data."""
class HistoricalSplitsData(Data):
"""Historical Splits Data."""
date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", ""))
label: str = Field(description="Label of the historical stock splits.")

View File

@@ -1,4 +1,4 @@
"""Stock insider trading data model."""
"""insider trading data model."""
from datetime import date, datetime, time
@@ -33,8 +33,8 @@ TRANSACTION_TYPES = Literal[
]
class StockInsiderTradingQueryParams(QueryParams):
"""Stock Insider Trading Query."""
class InsiderTradingQueryParams(QueryParams):
"""Insider Trading Query."""
symbol: str = Field(description=QUERY_DESCRIPTIONS.get("symbol", ""))
transaction_type: Optional[Union[List[TRANSACTION_TYPES], str]] = Field(
@@ -47,7 +47,7 @@ class StockInsiderTradingQueryParams(QueryParams):
@model_validator(mode="after")
@classmethod
def validate_transaction_type(cls, values: "StockInsiderTradingQueryParams"):
def validate_transaction_type(cls, values: "InsiderTradingQueryParams"):
"""Validate the transaction type."""
if isinstance(values.transaction_type, list):
values.transaction_type = ",".join(values.transaction_type)
@@ -62,48 +62,38 @@ class StockInsiderTradingQueryParams(QueryParams):
return ",".join([symbol.upper() for symbol in list(v)])
class StockInsiderTradingData(Data):
"""Stock Insider Trading Data."""
class InsiderTradingData(Data):
"""Insider Trading Data."""
symbol: str = Field(description=DATA_DESCRIPTIONS.get("symbol", ""))
filing_date: datetime = Field(
description="Filing date of the stock insider trading."
)
filing_date: datetime = Field(description="Filing date of the insider trading.")
transaction_date: date = Field(
description="Transaction date of the stock insider trading."
)
reporting_cik: int = Field(
description="Reporting CIK of the stock insider trading."
description="Transaction date of the insider trading."
)
reporting_cik: int = Field(description="Reporting CIK of the insider trading.")
transaction_type: str = Field(
description="Transaction type of the stock insider trading."
description="Transaction type of the insider trading."
)
securities_owned: StrictInt = Field(
description="Securities owned of the stock insider trading."
)
company_cik: int = Field(description="Company CIK of the stock insider trading.")
reporting_name: str = Field(
description="Reporting name of the stock insider trading."
)
type_of_owner: str = Field(
description="Type of owner of the stock insider trading."
description="Securities owned of the insider trading."
)
company_cik: int = Field(description="Company CIK of the insider trading.")
reporting_name: str = Field(description="Reporting name of the insider trading.")
type_of_owner: str = Field(description="Type of owner of the insider trading.")
acquisition_or_disposition: Optional[str] = Field(
default=None,
description="Acquisition or disposition of the stock insider trading.",
description="Acquisition or disposition of the insider trading.",
)
form_type: str = Field(description="Form type of the stock insider trading.")
form_type: str = Field(description="Form type of the insider trading.")
securities_transacted: float = Field(
description="Securities transacted of the stock insider trading."
description="Securities transacted of the insider trading."
)
price: Optional[float] = Field(
default=None,
description="Price of the stock insider trading.",
description="Price of the insider trading.",
)
security_name: str = Field(
description="Security name of the stock insider trading."
)
link: str = Field(description="Link of the stock insider trading.")
security_name: str = Field(description="Security name of the insider trading.")
link: str = Field(description="Link of the insider trading.")
@field_validator("symbol", mode="before", check_fields=False)
@classmethod

View File

@@ -12,10 +12,10 @@ To configure the default providers for each route, edit the `.openbb_platform/us
{
"defaults": {
"routes": {
"/stocks/load": {
"/equity/price/historical": {
"provider": "fmp"
},
"/stocks/fa/balance": {
"/equity/fundamental/balance": {
"provider": "polygon"
},
...

View File

@@ -1,4 +1,4 @@
"""Alpha Vantage Stock End of Day fetcher."""
"""Alpha Vantage Equity Historical End of Day fetcher."""
from datetime import datetime
@@ -24,7 +24,7 @@ from pydantic import (
class AVEquityHistoricalQueryParams(EquityHistoricalQueryParams):
"""Alpha Vantage Stock End of Day Query.
"""Alpha Vantage Equity Historical End of Day Query.
Source: https://www.alphavantage.co/documentation/#time-series-data
"""
@@ -108,7 +108,7 @@ class AVEquityHistoricalQueryParams(EquityHistoricalQueryParams):
class AVEquityHistoricalData(EquityHistoricalData):
"""Alpha Vantage Stock End of Day Data."""
"""Alpha Vantage Equity Historical End of Day Data."""
__alias_dict__ = {"date": "timestamp", "adj_close": "adjusted_close"}

View File

@@ -1,4 +1,4 @@
"""CBOE Equity Historical fetcher."""
"""CBOE Equity Historical End of Day fetcher."""
from datetime import datetime, timedelta
@@ -22,7 +22,7 @@ from pydantic import Field
class CboeEquityHistoricalQueryParams(EquityHistoricalQueryParams):
"""CBOE Stock end of day query.
"""CBOE Equity Historical End of Day query.
Source: https://www.cboe.com/
"""
@@ -34,7 +34,7 @@ class CboeEquityHistoricalQueryParams(EquityHistoricalQueryParams):
class CboeEquityHistoricalData(EquityHistoricalData):
"""CBOE Stocks End of Day Data."""
"""CBOE Equity Historical End of Day Data."""
calls_volume: Optional[float] = Field(
default=None,

View File

@@ -1,4 +1,4 @@
"""CBOE European Index Constituents fetcher."""
"""CBOE European Index Constituents Fetcher."""
from datetime import datetime
from typing import Any, Dict, List, Optional
@@ -15,7 +15,7 @@ from pydantic import Field, field_validator
class CboeEuropeanIndexConstituentsQueryParams(EuropeanIndexConstituentsQueryParams):
"""CBOE Stock end of day query.
"""CBOE European Index Constituents Query.
Source: https://www.cboe.com/
@@ -54,8 +54,7 @@ class CboeEuropeanIndexConstituentsData(EuropeanIndexConstituentsData):
@field_validator("last_trade_timestamp", mode="before", check_fields=False)
def date_validate(cls, v): # pylint: disable=E0213
"""Return the datetime object from the date string"""
"""Return the datetime object from the date string."""
return datetime.strftime(v, "%Y-%m-%d %H:%M:%S")
@@ -65,14 +64,13 @@ class CboeEuropeanIndexConstituentsFetcher(
List[CboeEuropeanIndexConstituentsData],
]
):
"""Transform the query, extract and transform the data from the CBOE endpoints"""
"""Transform the query, extract and transform the data from the CBOE endpoints."""
@staticmethod
def transform_query(
params: Dict[str, Any]
) -> CboeEuropeanIndexConstituentsQueryParams:
"""Transform the query."""
return CboeEuropeanIndexConstituentsQueryParams(**params)
@staticmethod
@@ -81,8 +79,7 @@ class CboeEuropeanIndexConstituentsFetcher(
credentials: Optional[Dict[str, str]],
**kwargs: Any,
) -> List[Dict]:
"""Return the raw data from the CBOE endpoint"""
"""Return the raw data from the CBOE endpoint."""
SYMBOLS = pd.DataFrame(Europe.list_indices())["symbol"].to_list()
query.symbol = query.symbol.upper()
@@ -115,6 +112,5 @@ class CboeEuropeanIndexConstituentsFetcher(
def transform_data(
query: CboeEuropeanIndexConstituentsQueryParams, data: List[Dict], **kwargs: Any
) -> List[CboeEuropeanIndexConstituentsData]:
"""Transform the data to the standard format"""
"""Transform the data to the standard format."""
return [CboeEuropeanIndexConstituentsData.model_validate(d) for d in data]

View File

@@ -1,4 +1,4 @@
"""European Indices End of Day fetcher for CBOE."""
"""CBOE European Indices Fetcher."""
from datetime import datetime
from typing import Any, Dict, List, Literal, Optional
@@ -16,7 +16,7 @@ from pydantic import Field, field_validator
class CboeEuropeanIndicesQueryParams(EuropeanIndicesQueryParams):
"""CBOE European Indices End of Day query.
"""CBOE European Indices Query.
Source: https://www.cboe.com/europe/indices/
"""
@@ -28,7 +28,7 @@ class CboeEuropeanIndicesQueryParams(EuropeanIndicesQueryParams):
class CboeEuropeanIndicesData(EuropeanIndicesData):
"""CBOE Stocks End of Day Data."""
"""CBOE European Indices Data."""
open: Optional[float] = Field(
default=None,

View File

@@ -1,4 +1,4 @@
"""CBOE Market Indices end of Day fetcher."""
"""CBOE Market Indices Fetcher."""
from datetime import datetime, timedelta
from typing import Any, Dict, List, Literal, Optional
@@ -19,7 +19,7 @@ from pydantic import Field
class CboeMarketIndicesQueryParams(MarketIndicesQueryParams):
"""CBOE Stock end of day query.
"""CBOE Market Indices Query.
Source: https://www.cboe.com/
"""
@@ -31,7 +31,7 @@ class CboeMarketIndicesQueryParams(MarketIndicesQueryParams):
class CboeMarketIndicesData(MarketIndicesData):
"""CBOE Stocks End of Day Data."""
"""CBOE Market Indices Data."""
calls_volume: Optional[float] = Field(
default=None,

View File

@@ -38,12 +38,13 @@ from openbb_fmp.models.financial_ratios import FMPFinancialRatiosFetcher
from openbb_fmp.models.global_news import FMPGlobalNewsFetcher
from openbb_fmp.models.historical_dividends import FMPHistoricalDividendsFetcher
from openbb_fmp.models.historical_employees import FMPHistoricalEmployeesFetcher
from openbb_fmp.models.historical_splits import FMPHistoricalStockSplitsFetcher
from openbb_fmp.models.historical_splits import FMPHistoricalSplitsFetcher
from openbb_fmp.models.income_statement import FMPIncomeStatementFetcher
from openbb_fmp.models.income_statement_growth import FMPIncomeStatementGrowthFetcher
from openbb_fmp.models.index_constituents import (
FMPIndexConstituentsFetcher,
)
from openbb_fmp.models.insider_trading import FMPInsiderTradingFetcher
from openbb_fmp.models.institutional_ownership import FMPInstitutionalOwnershipFetcher
from openbb_fmp.models.key_executives import FMPKeyExecutivesFetcher
from openbb_fmp.models.key_metrics import FMPKeyMetricsFetcher
@@ -56,7 +57,6 @@ from openbb_fmp.models.revenue_business_line import FMPRevenueBusinessLineFetche
from openbb_fmp.models.revenue_geographic import FMPRevenueGeographicFetcher
from openbb_fmp.models.risk_premium import FMPRiskPremiumFetcher
from openbb_fmp.models.share_statistics import FMPShareStatisticsFetcher
from openbb_fmp.models.stock_insider_trading import FMPStockInsiderTradingFetcher
from openbb_fmp.models.treasury_rates import FMPTreasuryRatesFetcher
from openbb_provider.abstract.provider import Provider
@@ -104,7 +104,7 @@ fmp_provider = Provider(
"GlobalNews": FMPGlobalNewsFetcher,
"HistoricalDividends": FMPHistoricalDividendsFetcher,
"HistoricalEmployees": FMPHistoricalEmployeesFetcher,
"HistoricalStockSplits": FMPHistoricalStockSplitsFetcher,
"HistoricalSplits": FMPHistoricalSplitsFetcher,
"IncomeStatement": FMPIncomeStatementFetcher,
"IncomeStatementGrowth": FMPIncomeStatementGrowthFetcher,
"InstitutionalOwnership": FMPInstitutionalOwnershipFetcher,
@@ -120,7 +120,7 @@ fmp_provider = Provider(
"RevenueGeographic": FMPRevenueGeographicFetcher,
"RiskPremium": FMPRiskPremiumFetcher,
"ShareStatistics": FMPShareStatisticsFetcher,
"StockInsiderTrading": FMPStockInsiderTradingFetcher,
"InsiderTrading": FMPInsiderTradingFetcher,
"TreasuryRates": FMPTreasuryRatesFetcher,
},
)

View File

@@ -1,5 +1,4 @@
"""FMP Stock Splits Calendar fetcher."""
"""FMP Calendar Splits fetcher."""
from datetime import date
from typing import Any, Dict, List, Optional

View File

@@ -1,4 +1,4 @@
"""FMP Stocks end of day fetcher."""
"""FMP Equity Historical end of day fetcher."""
from datetime import datetime
from typing import Any, Dict, List, Literal, Optional
@@ -15,7 +15,7 @@ from pydantic import Field, NonNegativeInt
class FMPEquityHistoricalQueryParams(EquityHistoricalQueryParams):
"""FMP Stock end of day Query.
"""FMP Equity Historical end of day Query.
Source: https://financialmodelingprep.com/developer/docs/#Stock-Historical-Price
"""
@@ -33,7 +33,7 @@ class FMPEquityHistoricalQueryParams(EquityHistoricalQueryParams):
class FMPEquityHistoricalData(EquityHistoricalData):
"""FMP Stock end of day Data."""
"""FMP Equity Historical end of day Data."""
label: Optional[str] = Field(
default=None, description="Human readable format of the date."

View File

@@ -1,4 +1,4 @@
"""FMP Stocks end of day fetcher."""
"""FMP Equity Quote fetcher."""
from datetime import datetime
@@ -15,14 +15,14 @@ from pydantic import Field, field_validator
class FMPEquityQuoteQueryParams(EquityQuoteQueryParams):
"""FMP Stock end of day Query.
"""FMP Equity Quote Query.
Source: https://financialmodelingprep.com/developer/docs/#Stock-Historical-Price
"""
class FMPEquityQuoteData(EquityQuoteData):
"""FMP Stock end of day Data."""
"""FMP Equity Quote Data."""
__alias_dict__ = {
"price_avg50": "priceAvg50",
@@ -33,58 +33,58 @@ class FMPEquityQuoteData(EquityQuoteData):
symbol: Optional[str] = Field(default=None, description="Symbol of the company.")
name: Optional[str] = Field(default=None, description="Name of the company.")
price: Optional[float] = Field(
default=None, description="Current trading price of the stock."
default=None, description="Current trading price of the equity."
)
changes_percentage: Optional[float] = Field(
default=None, description="Change percentage of the stock price."
default=None, description="Change percentage of the equity price."
)
change: Optional[float] = Field(
default=None, description="Change in the stock price."
default=None, description="Change in the equity price."
)
year_high: Optional[float] = Field(
default=None, description="Highest price of the stock in the last 52 weeks."
default=None, description="Highest price of the equity in the last 52 weeks."
)
year_low: Optional[float] = Field(
default=None, description="Lowest price of the stock in the last 52 weeks."
default=None, description="Lowest price of the equity in the last 52 weeks."
)
market_cap: Optional[float] = Field(
default=None, description="Market cap of the company."
)
price_avg50: Optional[float] = Field(
default=None, description="50 days average price of the stock."
default=None, description="50 days average price of the equity."
)
price_avg200: Optional[StrictInt] = Field(
default=None, description="200 days average price of the stock."
default=None, description="200 days average price of the equity."
)
volume: Optional[StrictInt] = Field(
default=None,
description="Volume of the stock in the current trading day.",
description="Volume of the equity in the current trading day.",
)
avg_volume: Optional[StrictInt] = Field(
default=None,
description="Average volume of the stock in the last 10 trading days.",
description="Average volume of the equity in the last 10 trading days.",
)
exchange: Optional[str] = Field(
default=None, description="Exchange the stock is traded on."
default=None, description="Exchange the equity is traded on."
)
open: Optional[float] = Field(
default=None,
description="Opening price of the stock in the current trading day.",
description="Opening price of the equity in the current trading day.",
)
previous_close: Optional[float] = Field(
default=None, description="Previous closing price of the stock."
default=None, description="Previous closing price of the equity."
)
eps: Optional[float] = Field(
default=None, description="Earnings per share of the stock."
default=None, description="Earnings per share of the equity."
)
pe: Optional[float] = Field(
default=None, description="Price earnings ratio of the stock."
default=None, description="Price earnings ratio of the equity."
)
earnings_announcement: Optional[str] = Field(
default=None, description="Earnings announcement date of the stock."
default=None, description="Earnings announcement date of the equity."
)
shares_outstanding: Optional[StrictInt] = Field(
default=None, description="Number of shares outstanding of the stock."
default=None, description="Number of shares outstanding of the equity."
)
@field_validator("timestamp", mode="before", check_fields=False)

View File

@@ -1,4 +1,4 @@
"""FMP Historical Stock Splits fetcher."""
"""FMP Historical Splits fetcher."""
from datetime import datetime
@@ -7,21 +7,21 @@ from typing import Any, Dict, List, Optional
from openbb_fmp.utils.helpers import create_url, get_data_many
from openbb_provider.abstract.fetcher import Fetcher
from openbb_provider.standard_models.historical_splits import (
HistoricalStockSplitsData,
HistoricalStockSplitsQueryParams,
HistoricalSplitsData,
HistoricalSplitsQueryParams,
)
from pydantic import field_validator
class FMPHistoricalStockSplitsQueryParams(HistoricalStockSplitsQueryParams):
"""FMP Historical Stock Splits Query.
class FMPHistoricalSplitsQueryParams(HistoricalSplitsQueryParams):
"""FMP Historical Splits Query.
Source: https://site.financialmodelingprep.com/developer/docs/historical-stock-splits-api/
"""
class FMPHistoricalStockSplitsData(HistoricalStockSplitsData):
"""FMP Historical Stock Splits Data."""
class FMPHistoricalSplitsData(HistoricalSplitsData):
"""FMP Historical Splits Data."""
@field_validator("date", mode="before", check_fields=False)
@classmethod
@@ -30,22 +30,22 @@ class FMPHistoricalStockSplitsData(HistoricalStockSplitsData):
return datetime.strptime(v, "%Y-%m-%d") if v else None
class FMPHistoricalStockSplitsFetcher(
class FMPHistoricalSplitsFetcher(
Fetcher[
FMPHistoricalStockSplitsQueryParams,
List[FMPHistoricalStockSplitsData],
FMPHistoricalSplitsQueryParams,
List[FMPHistoricalSplitsData],
]
):
"""Transform the query, extract and transform the data from the FMP endpoints."""
@staticmethod
def transform_query(params: Dict[str, Any]) -> FMPHistoricalStockSplitsQueryParams:
def transform_query(params: Dict[str, Any]) -> FMPHistoricalSplitsQueryParams:
"""Transform the query params."""
return FMPHistoricalStockSplitsQueryParams(**params)
return FMPHistoricalSplitsQueryParams(**params)
@staticmethod
def extract_data(
query: FMPHistoricalStockSplitsQueryParams,
query: FMPHistoricalSplitsQueryParams,
credentials: Optional[Dict[str, str]],
**kwargs: Any,
) -> List[Dict]:
@@ -60,7 +60,7 @@ class FMPHistoricalStockSplitsFetcher(
@staticmethod
def transform_data(
query: FMPHistoricalStockSplitsQueryParams, data: List[Dict], **kwargs: Any
) -> List[FMPHistoricalStockSplitsData]:
query: FMPHistoricalSplitsQueryParams, data: List[Dict], **kwargs: Any
) -> List[FMPHistoricalSplitsData]:
"""Return the transformed data."""
return [FMPHistoricalStockSplitsData.model_validate(d) for d in data]
return [FMPHistoricalSplitsData.model_validate(d) for d in data]

View File

@@ -1,19 +1,19 @@
"""FMP Stock Insider Trading fetcher."""
"""FMP Insider Trading fetcher."""
from typing import Any, Dict, List, Optional
from openbb_fmp.utils.helpers import get_data_many
from openbb_provider.abstract.fetcher import Fetcher
from openbb_provider.standard_models.stock_insider_trading import (
StockInsiderTradingData,
StockInsiderTradingQueryParams,
from openbb_provider.standard_models.insider_trading import (
InsiderTradingData,
InsiderTradingQueryParams,
)
from openbb_provider.utils.helpers import get_querystring
class FMPStockInsiderTradingQueryParams(StockInsiderTradingQueryParams):
"""FMP Stock Insider Trading Query.
class FMPInsiderTradingQueryParams(InsiderTradingQueryParams):
"""FMP Insider Trading Query.
Source: https://site.financialmodelingprep.com/developer/docs/#Stock-Insider-Trading
"""
@@ -23,8 +23,8 @@ class FMPStockInsiderTradingQueryParams(StockInsiderTradingQueryParams):
}
class FMPStockInsiderTradingData(StockInsiderTradingData):
"""FMP Stock Insider Trading Data."""
class FMPInsiderTradingData(InsiderTradingData):
"""FMP Insider Trading Data."""
__alias_dict__ = {
"acquisition_or_disposition": "acquistionOrDisposition",
@@ -32,22 +32,22 @@ class FMPStockInsiderTradingData(StockInsiderTradingData):
}
class FMPStockInsiderTradingFetcher(
class FMPInsiderTradingFetcher(
Fetcher[
FMPStockInsiderTradingQueryParams,
List[FMPStockInsiderTradingData],
FMPInsiderTradingQueryParams,
List[FMPInsiderTradingData],
]
):
"""Transform the query, extract and transform the data from the FMP endpoints."""
@staticmethod
def transform_query(params: Dict[str, Any]) -> FMPStockInsiderTradingQueryParams:
def transform_query(params: Dict[str, Any]) -> FMPInsiderTradingQueryParams:
"""Transform the query params."""
return FMPStockInsiderTradingQueryParams(**params)
return FMPInsiderTradingQueryParams(**params)
@staticmethod
def extract_data(
query: FMPStockInsiderTradingQueryParams,
query: FMPInsiderTradingQueryParams,
credentials: Optional[Dict[str, str]],
**kwargs: Any,
) -> List[Dict]:
@@ -72,8 +72,8 @@ class FMPStockInsiderTradingFetcher(
@staticmethod
def transform_data(
query: FMPStockInsiderTradingQueryParams, data: List[Dict], **kwargs: Any
) -> List[FMPStockInsiderTradingData]:
query: FMPInsiderTradingQueryParams, data: List[Dict], **kwargs: Any
) -> List[FMPInsiderTradingData]:
"""Return the transformed data."""
data = sorted(data, key=lambda x: x["filingDate"], reverse=True)
return [FMPStockInsiderTradingData.model_validate(d) for d in data]
return [FMPInsiderTradingData.model_validate(d) for d in data]

View File

@@ -0,0 +1,171 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Connection:
- keep-alive
method: GET
uri: https://financialmodelingprep.com/api/v4/insider-trading?apikey=MOCK_API_KEY&limit=100&page=0&symbol=AAPL&transactionType=P-Purchase
response:
body:
string: !!binary |
H4sIAAAAAAAAA+3ZT1PbOBQA8Hs/hSbnWtGTrH++pSHbzUyADKH00OnBmxjwlNhZ25TNdPrdKzk4
BOymJbs2JGsGDlGeZUnvN8+S+fQGoW/mD6FOupz/Fd90PNTp9cajzttV62V4E0ZXR34W2G8oAe4Q
6VCFQHkMPCKKwCzxo9SfZmEclaLdIigJFnGSmQ774RcbQQgBwjVlvKKb8+Ui72bsjG+T6bWfBkVQ
GkxvkzALg/T0LgpmJogJV9x/OY3nCz9aPtyBMDMQzUpjOPHnef8fe+9PBmdo8mHSO1kPw9z79NL2
ntiQWZgE0yxOiq/96d+3YWoHeZochekiTkP7IV+89crFybyYglse+fn9RPPhUzPK+4hFEk7tNUAp
1o+vWhYj7sfzeRyhSRZPvxQ9mzTlE77OskXqdbt3d3fYXIev4q/dnlm+8GuQdoPZlZ90Z37md1eL
0rXro7SmLgNukqEI2WhybP7yRieMZsE/+Dqbd8ztvr89EDZ2znvMZmP4D2xcDLR1U7Ob/WZTqYax
w1FDHQCHklwN93hVup9Gg96mhhLJtFvRzXPUuIbermyG7w2as9N3g7NztE56027UUzdccEwUbabe
AFApCDW5YCA532hyTApXjYcqx13X9L2UI0oVhwsXU/H4qtbNf+2Gqf1241a4YZhwyls5Ncs5wIpD
MTSzx2nEDVgJzLjRHlEel9vd5NG0fjdUyJ23xq/BDbASHCY5ZnS9dauDzsPirKwoMDtkMGcVRRjf
aLJJXDUeKB9g+85Hlvm42FW8zr1O83zMMRuIQwUiwgPqueusVPIhwjGlj6ptfEDZn3/Jh+rdD+b9
3vH43WA0Qh+Ho9Gwd4wuXsgQKz+7JGDeeP0hkgimXLUJyOR91dgwIHNbU3/Wb39aQNsAbUyiAKQ4
1nW+TX71gEwF0mbz1QL6LUAVFYhiqQ4LUE6CSHvwMoB+8Wr5PpqXkre5A3KpK6ocPgcQABewq6BJ
/8/j4dE5GpwN+2jwUnpISY/QWMjG9QjCQT7eANk05o2tnleqh1XqkXUe3Fs9B6MHqvU0fvhq9eyj
nuonl2yfXK2e3fRIgkmd/6p4MT1gZutR8Nj294Y22vzKUuI29DBOOdEV3TxHD5XFMj/bzh/+LLi5
Qb0ou46j5U/sxJeXJqOJhyZBFMYJujCf0DgJ0nAWRFldokCXypEBRV8CFNESSqBsY/OglANby1EL
6uegikmtPQkM8Pia/52ntkDt7Ek/9cQ1Vq/a05vPPwC7Xhcf8ywAAA==
headers:
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Headers:
- X-Requested-With, content-type, auth-token, Authorization, stripe-signature,
APPS
Access-Control-Allow-Methods:
- GET, POST, OPTIONS
Access-Control-Allow-Origin:
- '*'
Access-Control-Max-Age:
- '3600'
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json; charset=utf-8
Date:
- Thu, 16 Nov 2023 19:47:23 GMT
ETag:
- W/"2cf3-POGuhFFFDsLUP2Mt0xcWd1R6lJk"
Server:
- nginx/1.18.0 (Ubuntu)
Transfer-Encoding:
- chunked
Vary:
- Accept-Encoding
X-Frame-Options:
- SAMEORIGIN
X-Powered-By:
- Express
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Connection:
- keep-alive
method: GET
uri: https://financialmodelingprep.com/api/v4/insider-trading?apikey=MOCK_API_KEY&limit=100&page=1&symbol=AAPL&transactionType=P-Purchase
response:
body:
string: !!binary |
H4sIAAAAAAAAA+2dXXMaOxKG78+vmMrN3oSxWt+aO2ITxwk2Kexk6+zWXrAYJ1Ri8AI5iWtr//sK
2wPYoyDQfAlBlVMVg2bMzDy83eputf75RxT9V/+LolfT+9t/j7+/SqJXzebH9qvXj6/eDL8PR19O
erPB/B2MMGkg3EAkApkQnmCSDpxNeqNprz8bjkeZ0ZAOmgzuxpOZPuHx8Nt8BEIIQCjJqeE0V/d3
D6c5b7R+DW7vZumQ6aD/YzKcDQfTzs/R4FoPQU/v9Me3d73R/fLkiGAEimT+/EXv9uHU7c4/mhed
6LxzcXbcjI4XH0L/5c7N/OyT+ajr4WTQn40n6du9/n9+DKfzj9iZnAynd+PpcP7LfOjJ4r6NJ7fp
BdDsJ796usyHjw9csqcRd5Nhf7ByRU9H3KcfuDuYzvQQfVx0ORv3v0WfRsPFjdFP6uHCv85md9Pk
6Ojnz5+xPkH8ZfzXUXPS/zr8azA9Glx/6U2Ornuz3tHyBq38F5P5/zFaeakxf4wPLzaGo+vBr/jr
7PaV/pP/ex0EPQwT5Q1AzZIBOh7f3o5Hj/DsKDciAZWbGwycGU+zOTfOqnP56bTZjbqdi2b7JFoo
hjszwYgOmOCBIOEBxBQlvhC066pTATgswSYzsy04FLDMBY6z6rRbn88uLjsXUbN79e5TtwhsQhEe
UAZ+QAXJD2WEUuTu8BRP0Y6LTxXwQAIsNzwgMaIiFzzO4vOm1W5H75vnrcto8bjdiQlGd5gJHRYk
OoRzkd7/mvHZdcGpgBqcAMpNDcZU0Xxzc2fBOe10W1Gz/abVvYred/MzE4zkcBM8PEh4KBfgPscq
mqBdV50KwCFFgKMdXKD5JufuqjOeTL/dR83vg1/5gQlGcoSJ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ynWZ5Wb5wAA
headers:
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Headers:
- X-Requested-With, content-type, auth-token, Authorization, stripe-signature,
APPS
Access-Control-Allow-Methods:
- GET, POST, OPTIONS
Access-Control-Allow-Origin:
- '*'
Access-Control-Max-Age:
- '3600'
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json; charset=utf-8
Date:
- Thu, 16 Nov 2023 19:47:24 GMT
ETag:
- W/"e79b-vE7DR4eHATYelBC5a3zT67JYAqU"
Server:
- nginx/1.18.0 (Ubuntu)
Transfer-Encoding:
- chunked
Vary:
- Accept-Encoding
X-Frame-Options:
- SAMEORIGIN
X-Powered-By:
- Express
status:
code: 200
message: OK
version: 1

View File

@@ -1,171 +0,0 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Connection:
- keep-alive
method: GET
uri: https://financialmodelingprep.com/api/v4/insider-trading?apikey=MOCK_API_KEY&limit=100&page=0&symbol=AAPL&transactionType=P-Purchase
response:
body:
string: !!binary |
H4sIAAAAAAAAA+3ZT1PbOBQA8Hs/hSbnWtGTrH++pSHbzUyADKH00OnBmxjwlNhZ25TNdPrdKzk4
BOymJbs2JGsGDlGeZUnvN8+S+fQGoW/mD6FOupz/Fd90PNTp9cajzttV62V4E0ZXR34W2G8oAe4Q
6VCFQHkMPCKKwCzxo9SfZmEclaLdIigJFnGSmQ774RcbQQgBwjVlvKKb8+Ui72bsjG+T6bWfBkVQ
GkxvkzALg/T0LgpmJogJV9x/OY3nCz9aPtyBMDMQzUpjOPHnef8fe+9PBmdo8mHSO1kPw9z79NL2
ntiQWZgE0yxOiq/96d+3YWoHeZochekiTkP7IV+89crFybyYglse+fn9RPPhUzPK+4hFEk7tNUAp
1o+vWhYj7sfzeRyhSRZPvxQ9mzTlE77OskXqdbt3d3fYXIev4q/dnlm+8GuQdoPZlZ90Z37md1eL
0rXro7SmLgNukqEI2WhybP7yRieMZsE/+Dqbd8ztvr89EDZ2znvMZmP4D2xcDLR1U7Ob/WZTqYax
w1FDHQCHklwN93hVup9Gg96mhhLJtFvRzXPUuIbermyG7w2as9N3g7NztE56027UUzdccEwUbabe
AFApCDW5YCA532hyTApXjYcqx13X9L2UI0oVhwsXU/H4qtbNf+2Gqf1241a4YZhwyls5Ncs5wIpD
MTSzx2nEDVgJzLjRHlEel9vd5NG0fjdUyJ23xq/BDbASHCY5ZnS9dauDzsPirKwoMDtkMGcVRRjf
aLJJXDUeKB9g+85Hlvm42FW8zr1O83zMMRuIQwUiwgPqueusVPIhwjGlj6ptfEDZn3/Jh+rdD+b9
3vH43WA0Qh+Ho9Gwd4wuXsgQKz+7JGDeeP0hkgimXLUJyOR91dgwIHNbU3/Wb39aQNsAbUyiAKQ4
1nW+TX71gEwF0mbz1QL6LUAVFYhiqQ4LUE6CSHvwMoB+8Wr5PpqXkre5A3KpK6ocPgcQABewq6BJ
/8/j4dE5GpwN+2jwUnpISY/QWMjG9QjCQT7eANk05o2tnleqh1XqkXUe3Fs9B6MHqvU0fvhq9eyj
nuonl2yfXK2e3fRIgkmd/6p4MT1gZutR8Nj294Y22vzKUuI29DBOOdEV3TxHD5XFMj/bzh/+LLi5
Qb0ou46j5U/sxJeXJqOJhyZBFMYJujCf0DgJ0nAWRFldokCXypEBRV8CFNESSqBsY/OglANby1EL
6uegikmtPQkM8Pia/52ntkDt7Ek/9cQ1Vq/a05vPPwC7Xhcf8ywAAA==
headers:
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Headers:
- X-Requested-With, content-type, auth-token, Authorization, stripe-signature,
APPS
Access-Control-Allow-Methods:
- GET, POST, OPTIONS
Access-Control-Allow-Origin:
- '*'
Access-Control-Max-Age:
- '3600'
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 18 Oct 2023 13:30:50 GMT
ETag:
- W/"2cf3-POGuhFFFDsLUP2Mt0xcWd1R6lJk"
Server:
- nginx/1.18.0 (Ubuntu)
Transfer-Encoding:
- chunked
Vary:
- Accept-Encoding
X-Frame-Options:
- SAMEORIGIN
X-Powered-By:
- Express
status:
code: 200
message: OK
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, br
Connection:
- keep-alive
method: GET
uri: https://financialmodelingprep.com/api/v4/insider-trading?apikey=MOCK_API_KEY&limit=100&page=1&symbol=AAPL&transactionType=P-Purchase
response:
body:
string: !!binary |
H4sIAAAAAAAAA+2dXXMaOxKG78+vmMrN3oSxWt+aO2ITxwk2Kexk6+zWXrAYJ1Ri8AI5iWtr//sK
2wPYoyDQfAlBlVMVg2bMzDy83eputf75RxT9V/+LolfT+9t/j7+/SqJXzebH9qvXj6/eDL8PR19O
erPB/B2MMGkg3EAkApkQnmCSDpxNeqNprz8bjkeZ0ZAOmgzuxpOZPuHx8Nt8BEIIQCjJqeE0V/d3
D6c5b7R+DW7vZumQ6aD/YzKcDQfTzs/R4FoPYZiopzf749u73uh+eX5EMAJFMp/gonf7cPZ25x/N
i0503rk4O25Gx4vPof9452b+BybzUdfDyaA/G0/St3v9//wYTuefsjM5GU7vxtPh/JeHu7e4dePJ
bXoNNPvhr56u9OEKgEv2NOJuMuzPj0HPj7hPP/Dx+PZ2PIouZ+P+t/Ss+hk9XO/X2exumhwd/fz5
M9bHxV/Gfx01J/2vw78G06PB9Zfe5Oi6N+sdLe/Lyn8xmf8fo5WXGvMH+PBiYzi6HvyKv85uX+k/
+b/XubgRCajc3GDgzHiazblJb/HW0Fx+Om12o27notk+iU7yM7M4RUnMdAfTmR6ij3vkJvo0Gi7u
S5HwgAkeCBIeQExR4gtBu646FYDDEmwyM9uCQwHLXOA4q0679fns4rJzETW7V+8+dYvAJhThAWXg
B1SQ/FBGKEXuDk/xFO24+FQBDyTAcsMDEiMqcsHjLD5vWu129L553rqMFo/bnZhgdIeZ0GFBokM4
F+n9rxmfXRecCqjBCaDc1GBMFc03N3cWnNNOtxU1229a3avofTc/M8FIDjfBw4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VwVEkFBTyDEzuuwdRfM52TW3
F7Zx5aPXbeqHTgvph+4dW7m8br/R8tIN3yO0nN1wv7Hy0i/fCKs//vV/ekYvobTnAAA=
headers:
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Headers:
- X-Requested-With, content-type, auth-token, Authorization, stripe-signature,
APPS
Access-Control-Allow-Methods:
- GET, POST, OPTIONS
Access-Control-Allow-Origin:
- '*'
Access-Control-Max-Age:
- '3600'
Connection:
- keep-alive
Content-Encoding:
- gzip
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 18 Oct 2023 13:30:51 GMT
ETag:
- W/"e7b4-h+iOCa6fPFAEHAO6KuQRTX+QjAY"
Server:
- nginx/1.18.0 (Ubuntu)
Transfer-Encoding:
- chunked
Vary:
- Accept-Encoding
X-Frame-Options:
- SAMEORIGIN
X-Powered-By:
- Express
status:
code: 200
message: OK
version: 1

View File

@@ -41,12 +41,13 @@ from openbb_fmp.models.financial_ratios import FMPFinancialRatiosFetcher
from openbb_fmp.models.global_news import FMPGlobalNewsFetcher
from openbb_fmp.models.historical_dividends import FMPHistoricalDividendsFetcher
from openbb_fmp.models.historical_employees import FMPHistoricalEmployeesFetcher
from openbb_fmp.models.historical_splits import FMPHistoricalStockSplitsFetcher
from openbb_fmp.models.historical_splits import FMPHistoricalSplitsFetcher
from openbb_fmp.models.income_statement import FMPIncomeStatementFetcher
from openbb_fmp.models.income_statement_growth import FMPIncomeStatementGrowthFetcher
from openbb_fmp.models.index_constituents import (
FMPIndexConstituentsFetcher,
)
from openbb_fmp.models.insider_trading import FMPInsiderTradingFetcher
from openbb_fmp.models.institutional_ownership import FMPInstitutionalOwnershipFetcher
from openbb_fmp.models.key_executives import FMPKeyExecutivesFetcher
from openbb_fmp.models.key_metrics import FMPKeyMetricsFetcher
@@ -59,7 +60,6 @@ from openbb_fmp.models.revenue_business_line import FMPRevenueBusinessLineFetche
from openbb_fmp.models.revenue_geographic import FMPRevenueGeographicFetcher
from openbb_fmp.models.risk_premium import FMPRiskPremiumFetcher
from openbb_fmp.models.share_statistics import FMPShareStatisticsFetcher
from openbb_fmp.models.stock_insider_trading import FMPStockInsiderTradingFetcher
from openbb_fmp.models.treasury_rates import FMPTreasuryRatesFetcher
test_credentials = UserService().default_user_settings.credentials.model_dump(
@@ -275,10 +275,10 @@ def test_fmp_company_overview_fetcher(credentials=test_credentials):
@pytest.mark.record_http
def test_fmp_stock_insider_trading_fetcher(credentials=test_credentials):
def test_fmp_insider_trading_fetcher(credentials=test_credentials):
params = {"symbol": "AAPL"}
fetcher = FMPStockInsiderTradingFetcher()
fetcher = FMPInsiderTradingFetcher()
result = fetcher.test(params, credentials)
assert result is None
@@ -341,7 +341,7 @@ def test_fmp_earnings_call_transcript_fetcher(credentials=test_credentials):
def test_fmp_historical_splits_fetcher(credentials=test_credentials):
params = {"symbol": "AAPL"}
fetcher = FMPHistoricalStockSplitsFetcher()
fetcher = FMPHistoricalSplitsFetcher()
result = fetcher.test(params, credentials)
assert result is None

View File

@@ -1,4 +1,4 @@
"""Intrinio Equity end of day fetcher."""
"""Intrinio Equity historical end of day fetcher."""
from datetime import datetime, time
from typing import Any, Dict, List, Literal, Optional
@@ -16,7 +16,7 @@ from pydantic import Field, PrivateAttr, model_validator
class IntrinioEquityHistoricalQueryParams(EquityHistoricalQueryParams):
"""Intrinio Equity end of day Query.
"""Intrinio Equity historical end of day Query.
Source: https://docs.intrinio.com/documentation/web_api/get_security_interval_prices_v2
"""
@@ -71,7 +71,7 @@ class IntrinioEquityHistoricalQueryParams(EquityHistoricalQueryParams):
class IntrinioEquityHistoricalData(EquityHistoricalData):
"""Intrinio Equity end of day Data."""
"""Intrinio Equity historical end of day Data."""
__alias_dict__ = {"date": "time"}

View File

@@ -1,4 +1,4 @@
"""Polygon stocks end of day fetcher."""
"""Polygon Equity Historical End of Day fetcher."""
from concurrent.futures import ThreadPoolExecutor
@@ -23,7 +23,7 @@ from pydantic import (
class PolygonEquityHistoricalQueryParams(EquityHistoricalQueryParams):
"""Polygon stocks end of day Query.
"""Polygon Equity Historical End of Day Query.
Source: https://polygon.io/docs/stocks/getting-started
"""
@@ -67,7 +67,7 @@ class PolygonEquityHistoricalQueryParams(EquityHistoricalQueryParams):
class PolygonEquityHistoricalData(EquityHistoricalData):
"""Polygon stocks end of day Data."""
"""Polygon Equity Historical End of Day Data."""
__alias_dict__ = {
"date": "t",
@@ -92,7 +92,7 @@ class PolygonEquityHistoricalFetcher(
List[PolygonEquityHistoricalData],
]
):
"""Equity Historical Price Fetcher."""
"""Equity Equity Historical End of Day Fetcher."""
@staticmethod
def transform_query(params: Dict[str, Any]) -> PolygonEquityHistoricalQueryParams:

View File

@@ -1,4 +1,4 @@
"""Tiingo Equity end of day fetcher."""
"""Tiingo Equity historical end of day fetcher."""
from datetime import datetime
from typing import Any, Dict, List, Literal, Optional
@@ -16,7 +16,7 @@ from pydantic import Field, PrivateAttr, model_validator
class TiingoEquityHistoricalQueryParams(EquityHistoricalQueryParams):
"""Tiingo Equity end of day Query.
"""Tiingo Equity historical end of day Query.
Source: https://www.tiingo.com/documentation/end-of-day
"""
@@ -52,7 +52,7 @@ class TiingoEquityHistoricalQueryParams(EquityHistoricalQueryParams):
class TiingoEquityHistoricalData(EquityHistoricalData):
"""Tiingo Equity end of day Data."""
"""Tiingo Equity historical end of day Data."""
adj_open: Optional[float] = Field(
default=None,

View File

@@ -1,4 +1,4 @@
"""yfinance Equity Historical Price."""
"""yfinance Equity Historical End of Day Fetcher."""
# ruff: noqa: SIM105
from datetime import datetime, timedelta
@@ -19,7 +19,7 @@ from pydantic import Field, PrivateAttr, field_validator
class YFinanceEquityHistoricalQueryParams(EquityHistoricalQueryParams):
"""YFinance Stock End of Day Query.
"""YFinance Equity Historical End of Day Query.
Source: https://finance.yahoo.com/
"""
@@ -70,7 +70,7 @@ class YFinanceEquityHistoricalQueryParams(EquityHistoricalQueryParams):
class YFinanceEquityHistoricalData(EquityHistoricalData):
"""YFinance Stock End of Day Data."""
"""YFinance Equity Historical End of Day Data."""
@field_validator("date", mode="before", check_fields=False)
def date_validate(cls, v): # pylint: disable=E0213