mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
[Feature]try to add fmp senate trading data api (#6957)
* [Feature] Add Government Trades * [BugFix] Supplement the missing files * [Enhancement] Fix branch goverment_trades * [Enhancement] Fix branch government_trades * Capture test cassettes. * [Enhancement] Fix branch government_trades * some style things and prevent page from exceeding 30 * black * linter again * else None instead of Other --------- Co-authored-by: Danglewood <85772166+deeleeramone@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
"""Government Trades Standard Model."""
|
||||
|
||||
from datetime import date as dateType
|
||||
from typing import Literal, Optional
|
||||
|
||||
from openbb_core.provider.abstract.data import Data
|
||||
from openbb_core.provider.abstract.query_params import QueryParams
|
||||
from openbb_core.provider.utils.descriptions import (
|
||||
DATA_DESCRIPTIONS,
|
||||
QUERY_DESCRIPTIONS,
|
||||
)
|
||||
from pydantic import Field, NonNegativeInt, field_validator
|
||||
|
||||
|
||||
class GovernmentTradesQueryParams(QueryParams):
|
||||
"""Government Trades Query."""
|
||||
|
||||
symbol: Optional[str] = Field(
|
||||
default=None, description=QUERY_DESCRIPTIONS.get("symbol", "")
|
||||
)
|
||||
chamber: Literal["house", "senate", "all"] = Field(
|
||||
default="all", description="Government Chamber."
|
||||
)
|
||||
limit: Optional[NonNegativeInt] = Field(
|
||||
default=100, description=QUERY_DESCRIPTIONS.get("limit", "")
|
||||
)
|
||||
|
||||
@field_validator("symbol", mode="before", check_fields=False)
|
||||
@classmethod
|
||||
def to_upper(cls, v: str):
|
||||
"""Convert field to uppercase."""
|
||||
return v.upper() if v else None
|
||||
|
||||
|
||||
class GovernmentTradesData(Data):
|
||||
"""Government Trades data."""
|
||||
|
||||
symbol: Optional[str] = Field(
|
||||
default=None, description=DATA_DESCRIPTIONS.get("symbol", "")
|
||||
)
|
||||
date: dateType = Field(description=DATA_DESCRIPTIONS.get("date", ""))
|
||||
transaction_date: Optional[dateType] = Field(
|
||||
default=None, description="Date of Transaction."
|
||||
)
|
||||
representative: Optional[str] = Field(
|
||||
default=None, description="Name of Representative."
|
||||
)
|
||||
@@ -2156,3 +2156,36 @@ def test_equity_discovery_latest_financial_reports(params, headers):
|
||||
result = requests.get(url, headers=headers, timeout=10)
|
||||
assert isinstance(result, requests.Response)
|
||||
assert result.status_code == 200
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params",
|
||||
[
|
||||
(
|
||||
{
|
||||
"chamber": "all",
|
||||
"symbol": "AAPL",
|
||||
"provider": "fmp",
|
||||
"limit": None,
|
||||
}
|
||||
),
|
||||
(
|
||||
{
|
||||
"symbol": None,
|
||||
"chamber": "all",
|
||||
"limit": 300,
|
||||
"provider": "fmp",
|
||||
}
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_equity_ownership_government_trades(params, headers):
|
||||
"""Test the equity ownership government trades endpoint."""
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
|
||||
query_str = get_querystring(params, [])
|
||||
url = f"http://0.0.0.0:8000/api/v1/equity/ownership/government_trades?{query_str}"
|
||||
result = requests.get(url, headers=headers, timeout=10)
|
||||
assert isinstance(result, requests.Response)
|
||||
assert result.status_code == 200
|
||||
|
||||
@@ -2017,3 +2017,35 @@ def test_equity_discovery_latest_financial_reports(params, obb):
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
|
||||
@parametrize(
|
||||
"params",
|
||||
[
|
||||
(
|
||||
{
|
||||
"chamber": "all",
|
||||
"symbol": "AAPL",
|
||||
"provider": "fmp",
|
||||
"limit": None,
|
||||
}
|
||||
),
|
||||
(
|
||||
{
|
||||
"symbol": None,
|
||||
"chamber": "all",
|
||||
"limit": 300,
|
||||
"provider": "fmp",
|
||||
}
|
||||
),
|
||||
],
|
||||
)
|
||||
@pytest.mark.integration
|
||||
def test_equity_ownership_government_trades(params, obb):
|
||||
"""Test the equity ownership government trades endpoint."""
|
||||
params = {p: v for p, v in params.items() if v}
|
||||
|
||||
result = obb.equity.ownership.government_trades(**params)
|
||||
assert result
|
||||
assert isinstance(result, OBBject)
|
||||
assert len(result.results) > 0
|
||||
|
||||
@@ -112,3 +112,22 @@ async def form_13f(
|
||||
their investment strategy from competitors and the public.
|
||||
"""
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
|
||||
@router.command(
|
||||
model="GovernmentTrades",
|
||||
examples=[
|
||||
APIEx(parameters={"symbol": "AAPL", "chamber": "all", "provider": "fmp"}),
|
||||
APIEx(parameters={"limit": 500, "chamber": "all", "provider": "fmp"}),
|
||||
],
|
||||
)
|
||||
async def government_trades(
|
||||
cc: CommandContext,
|
||||
provider_choices: ProviderChoices,
|
||||
standard_params: StandardParams,
|
||||
extra_params: ExtraParams,
|
||||
) -> OBBject:
|
||||
"""Obtain government transaction data, including data from the Senate
|
||||
and the House of Representatives.
|
||||
"""
|
||||
return await OBBject.from_query(Query(**locals()))
|
||||
|
||||
173
openbb_platform/openbb/assets/reference.json
vendored
173
openbb_platform/openbb/assets/reference.json
vendored
@@ -3,7 +3,7 @@
|
||||
"info": {
|
||||
"title": "OpenBB Platform (Python)",
|
||||
"description": "Investment research for everyone, anywhere.",
|
||||
"core": "1.3.6",
|
||||
"core": "1.3.7",
|
||||
"extensions": {
|
||||
"openbb_core_extension": [
|
||||
"commodity@1.2.6",
|
||||
@@ -10271,6 +10271,7 @@
|
||||
"dominica",
|
||||
"dominican_republic",
|
||||
"east_germany",
|
||||
"eastern_caribbean_currency_union",
|
||||
"ecuador",
|
||||
"egypt",
|
||||
"el_salvador",
|
||||
@@ -10526,6 +10527,7 @@
|
||||
"dominica",
|
||||
"dominican_republic",
|
||||
"east_germany",
|
||||
"eastern_caribbean_currency_union",
|
||||
"ecuador",
|
||||
"egypt",
|
||||
"el_salvador",
|
||||
@@ -28322,6 +28324,175 @@
|
||||
},
|
||||
"model": "Form13FHR"
|
||||
},
|
||||
"/equity/ownership/government_trades": {
|
||||
"deprecated": {
|
||||
"flag": null,
|
||||
"message": null
|
||||
},
|
||||
"description": "Obtain government transaction data, including data from the Senate\nand the House of Representatives.",
|
||||
"examples": "\nExamples\n--------\n\n```python\nfrom openbb import obb\nobb.equity.ownership.government_trades(symbol='AAPL', chamber='all', provider='fmp')\nobb.equity.ownership.government_trades(limit=500, chamber='all', provider='fmp')\n```\n\n",
|
||||
"parameters": {
|
||||
"standard": [
|
||||
{
|
||||
"name": "symbol",
|
||||
"type": "Union[str, List[str]]",
|
||||
"description": "Symbol to get data for. Multiple items allowed for provider(s): fmp.",
|
||||
"default": null,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "chamber",
|
||||
"type": "Literal['house', 'senate', 'all']",
|
||||
"description": "Government Chamber.",
|
||||
"default": "all",
|
||||
"optional": true,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "limit",
|
||||
"type": "Annotated[int, Ge(ge=0)]",
|
||||
"description": "The number of data entries to return.",
|
||||
"default": 100,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
}
|
||||
],
|
||||
"fmp": []
|
||||
},
|
||||
"returns": {
|
||||
"OBBject": [
|
||||
{
|
||||
"name": "results",
|
||||
"type": "List[GovernmentTrades]",
|
||||
"description": "Serializable results."
|
||||
},
|
||||
{
|
||||
"name": "provider",
|
||||
"type": "Optional[Literal['fmp']]",
|
||||
"description": "Provider name."
|
||||
},
|
||||
{
|
||||
"name": "warnings",
|
||||
"type": "Optional[List[Warning_]]",
|
||||
"description": "List of warnings."
|
||||
},
|
||||
{
|
||||
"name": "chart",
|
||||
"type": "Optional[Chart]",
|
||||
"description": "Chart object."
|
||||
},
|
||||
{
|
||||
"name": "extra",
|
||||
"type": "Dict[str, Any]",
|
||||
"description": "Extra info."
|
||||
}
|
||||
]
|
||||
},
|
||||
"data": {
|
||||
"standard": [
|
||||
{
|
||||
"name": "symbol",
|
||||
"type": "str",
|
||||
"description": "Symbol representing the entity requested in the data.",
|
||||
"default": null,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "date",
|
||||
"type": "Union[date, str]",
|
||||
"description": "The date of the data.",
|
||||
"default": "",
|
||||
"optional": false,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "transaction_date",
|
||||
"type": "date",
|
||||
"description": "Date of Transaction.",
|
||||
"default": null,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "representative",
|
||||
"type": "str",
|
||||
"description": "Name of Representative.",
|
||||
"default": null,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
}
|
||||
],
|
||||
"fmp": [
|
||||
{
|
||||
"name": "chamber",
|
||||
"type": "Literal['house', 'senate']",
|
||||
"description": "Government Chamber - House or Senate.",
|
||||
"default": "",
|
||||
"optional": false,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "owner",
|
||||
"type": "str",
|
||||
"description": "Ownership status (e.g., Spouse, Joint).",
|
||||
"default": null,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "asset_type",
|
||||
"type": "str",
|
||||
"description": "Type of asset involved in the transaction.",
|
||||
"default": null,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "asset_description",
|
||||
"type": "str",
|
||||
"description": "Description of the asset.",
|
||||
"default": null,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "transaction_type",
|
||||
"type": "str",
|
||||
"description": "Type of transaction (e.g., Sale, Purchase).",
|
||||
"default": null,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "amount",
|
||||
"type": "str",
|
||||
"description": "Transaction amount range.",
|
||||
"default": null,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "comment",
|
||||
"type": "str",
|
||||
"description": "Additional comments on the transaction.",
|
||||
"default": null,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
},
|
||||
{
|
||||
"name": "url",
|
||||
"type": "str",
|
||||
"description": "Link to the transaction document.",
|
||||
"default": null,
|
||||
"optional": true,
|
||||
"choices": null
|
||||
}
|
||||
]
|
||||
},
|
||||
"model": "GovernmentTrades"
|
||||
},
|
||||
"/equity/price/quote": {
|
||||
"deprecated": {
|
||||
"flag": null,
|
||||
|
||||
@@ -1429,6 +1429,7 @@ class ROUTER_economy(Container):
|
||||
"dominica",
|
||||
"dominican_republic",
|
||||
"east_germany",
|
||||
"eastern_caribbean_currency_union",
|
||||
"ecuador",
|
||||
"egypt",
|
||||
"el_salvador",
|
||||
@@ -1682,6 +1683,7 @@ class ROUTER_economy(Container):
|
||||
"dominica",
|
||||
"dominican_republic",
|
||||
"east_germany",
|
||||
"eastern_caribbean_currency_union",
|
||||
"ecuador",
|
||||
"egypt",
|
||||
"el_salvador",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import datetime
|
||||
from typing import List, Literal, Optional, Union
|
||||
|
||||
from annotated_types import Ge
|
||||
from openbb_core.app.model.field import OpenBBField
|
||||
from openbb_core.app.model.obbject import OBBject
|
||||
from openbb_core.app.static.container import Container
|
||||
@@ -14,6 +15,7 @@ from typing_extensions import Annotated
|
||||
class ROUTER_equity_ownership(Container):
|
||||
"""/equity/ownership
|
||||
form_13f
|
||||
government_trades
|
||||
insider_trading
|
||||
institutional
|
||||
major_holders
|
||||
@@ -148,6 +150,117 @@ class ROUTER_equity_ownership(Container):
|
||||
)
|
||||
)
|
||||
|
||||
@exception_handler
|
||||
@validate
|
||||
def government_trades(
|
||||
self,
|
||||
symbol: Annotated[
|
||||
Union[str, None, List[Optional[str]]],
|
||||
OpenBBField(
|
||||
description="Symbol to get data for. Multiple comma separated items allowed for provider(s): fmp."
|
||||
),
|
||||
] = None,
|
||||
chamber: Annotated[
|
||||
Literal["house", "senate", "all"],
|
||||
OpenBBField(description="Government Chamber."),
|
||||
] = "all",
|
||||
limit: Annotated[
|
||||
Optional[Annotated[int, Ge(ge=0)]],
|
||||
OpenBBField(description="The number of data entries to return."),
|
||||
] = 100,
|
||||
provider: Annotated[
|
||||
Optional[Literal["fmp"]],
|
||||
OpenBBField(
|
||||
description="The provider to use, by default None. If None, the priority list configured in the settings is used. Default priority: fmp."
|
||||
),
|
||||
] = None,
|
||||
**kwargs
|
||||
) -> OBBject:
|
||||
"""Obtain government transaction data, including data from the Senate
|
||||
and the House of Representatives.
|
||||
|
||||
|
||||
Parameters
|
||||
----------
|
||||
symbol : Union[str, None, List[Optional[str]]]
|
||||
Symbol to get data for. Multiple comma separated items allowed for provider(s): fmp.
|
||||
chamber : Literal['house', 'senate', 'all']
|
||||
Government Chamber.
|
||||
limit : Optional[Annotated[int, Ge(ge=0)]]
|
||||
The number of data entries to return.
|
||||
provider : Optional[Literal['fmp']]
|
||||
The provider to use, by default None. If None, the priority list configured in the settings is used. Default priority: fmp.
|
||||
|
||||
Returns
|
||||
-------
|
||||
OBBject
|
||||
results : List[GovernmentTrades]
|
||||
Serializable results.
|
||||
provider : Optional[Literal['fmp']]
|
||||
Provider name.
|
||||
warnings : Optional[List[Warning_]]
|
||||
List of warnings.
|
||||
chart : Optional[Chart]
|
||||
Chart object.
|
||||
extra : Dict[str, Any]
|
||||
Extra info.
|
||||
|
||||
GovernmentTrades
|
||||
----------------
|
||||
symbol : Optional[str]
|
||||
Symbol representing the entity requested in the data.
|
||||
date : date
|
||||
The date of the data.
|
||||
transaction_date : Optional[date]
|
||||
Date of Transaction.
|
||||
representative : Optional[str]
|
||||
Name of Representative.
|
||||
chamber : Optional[Literal['house', 'senate']]
|
||||
Government Chamber - House or Senate. (provider: fmp)
|
||||
owner : Optional[str]
|
||||
Ownership status (e.g., Spouse, Joint). (provider: fmp)
|
||||
asset_type : Optional[str]
|
||||
Type of asset involved in the transaction. (provider: fmp)
|
||||
asset_description : Optional[str]
|
||||
Description of the asset. (provider: fmp)
|
||||
transaction_type : Optional[str]
|
||||
Type of transaction (e.g., Sale, Purchase). (provider: fmp)
|
||||
amount : Optional[str]
|
||||
Transaction amount range. (provider: fmp)
|
||||
comment : Optional[str]
|
||||
Additional comments on the transaction. (provider: fmp)
|
||||
url : Optional[str]
|
||||
Link to the transaction document. (provider: fmp)
|
||||
|
||||
Examples
|
||||
--------
|
||||
>>> from openbb import obb
|
||||
>>> obb.equity.ownership.government_trades(symbol='AAPL', chamber='all', provider='fmp')
|
||||
>>> obb.equity.ownership.government_trades(limit=500, chamber='all', provider='fmp')
|
||||
""" # noqa: E501
|
||||
|
||||
return self._run(
|
||||
"/equity/ownership/government_trades",
|
||||
**filter_inputs(
|
||||
provider_choices={
|
||||
"provider": self._get_provider(
|
||||
provider,
|
||||
"equity.ownership.government_trades",
|
||||
("fmp",),
|
||||
)
|
||||
},
|
||||
standard_params={
|
||||
"symbol": symbol,
|
||||
"chamber": chamber,
|
||||
"limit": limit,
|
||||
},
|
||||
extra_params=kwargs,
|
||||
info={
|
||||
"symbol": {"fmp": {"multiple_items_allowed": True, "choices": None}}
|
||||
},
|
||||
)
|
||||
)
|
||||
|
||||
@exception_handler
|
||||
@validate
|
||||
def insider_trading(
|
||||
|
||||
@@ -41,6 +41,7 @@ from openbb_fmp.models.executive_compensation import FMPExecutiveCompensationFet
|
||||
from openbb_fmp.models.financial_ratios import FMPFinancialRatiosFetcher
|
||||
from openbb_fmp.models.forward_ebitda_estimates import FMPForwardEbitdaEstimatesFetcher
|
||||
from openbb_fmp.models.forward_eps_estimates import FMPForwardEpsEstimatesFetcher
|
||||
from openbb_fmp.models.government_trades import FMPGovernmentTradesFetcher
|
||||
from openbb_fmp.models.historical_dividends import FMPHistoricalDividendsFetcher
|
||||
from openbb_fmp.models.historical_employees import FMPHistoricalEmployeesFetcher
|
||||
from openbb_fmp.models.historical_eps import FMPHistoricalEpsFetcher
|
||||
@@ -137,6 +138,7 @@ stock market information (news, currencies, and stock prices).""",
|
||||
"WorldNews": FMPWorldNewsFetcher,
|
||||
"EtfHistorical": FMPEquityHistoricalFetcher,
|
||||
"YieldCurve": FMPYieldCurveFetcher,
|
||||
"GovernmentTrades": FMPGovernmentTradesFetcher,
|
||||
},
|
||||
repr_name="Financial Modeling Prep (FMP)",
|
||||
deprecated_credentials={"API_KEY_FINANCIALMODELINGPREP": "fmp_api_key"},
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
"""FMP Government Trades Model."""
|
||||
|
||||
# pylint: disable=unused-argument,too-many-locals
|
||||
|
||||
from typing import Any, Literal, Optional
|
||||
|
||||
from openbb_core.provider.abstract.fetcher import Fetcher
|
||||
from openbb_core.provider.standard_models.government_trades import (
|
||||
GovernmentTradesData,
|
||||
GovernmentTradesQueryParams,
|
||||
)
|
||||
from pydantic import Field, model_validator
|
||||
|
||||
|
||||
class FMPGovernmentTradesQueryParams(GovernmentTradesQueryParams):
|
||||
"""Government Trades Query Parameters.
|
||||
|
||||
Source: https://site.financialmodelingprep.com/developer/docs#senate-trading
|
||||
"""
|
||||
|
||||
__json_schema_extra__ = {"symbol": {"multiple_items_allowed": True}}
|
||||
|
||||
|
||||
class FMPGovernmentTradesData(GovernmentTradesData):
|
||||
"""Government Trades Data Model."""
|
||||
|
||||
__alias_dict__ = {
|
||||
"symbol": "ticker",
|
||||
"transaction_date": "transactionDate",
|
||||
"representative": "office",
|
||||
"url": "link",
|
||||
"transaction_type": "type",
|
||||
}
|
||||
chamber: Literal["house", "senate"] = Field(
|
||||
description="Government Chamber - House or Senate."
|
||||
)
|
||||
owner: Optional[str] = Field(
|
||||
default=None, description="Ownership status (e.g., Spouse, Joint)."
|
||||
)
|
||||
asset_type: Optional[str] = Field(
|
||||
default=None, description="Type of asset involved in the transaction."
|
||||
)
|
||||
asset_description: Optional[str] = Field(
|
||||
default=None, description="Description of the asset."
|
||||
)
|
||||
transaction_type: Optional[str] = Field(
|
||||
default=None, description="Type of transaction (e.g., Sale, Purchase)."
|
||||
)
|
||||
amount: Optional[str] = Field(default=None, description="Transaction amount range.")
|
||||
comment: Optional[str] = Field(
|
||||
default=None, description="Additional comments on the transaction."
|
||||
)
|
||||
url: Optional[str] = Field(
|
||||
default=None, description="Link to the transaction document."
|
||||
)
|
||||
|
||||
@model_validator(mode="before")
|
||||
@classmethod
|
||||
def _fill_missing(cls, values):
|
||||
"""Fill missing information that can be identified."""
|
||||
description = values.get("assetDescription", "").lower()
|
||||
if not values.get("owner"):
|
||||
values["owner"] = "Self"
|
||||
if (values.get("ticker") or values.get("symbol")) and not values.get(
|
||||
"assetType"
|
||||
):
|
||||
values["asset_type"] = "ETF" if "etf" in description else "Stock"
|
||||
elif (
|
||||
not values.get("ticker")
|
||||
and not values.get("symbol")
|
||||
and not values.get("assetType")
|
||||
):
|
||||
values["asset_type"] = (
|
||||
"Treasury"
|
||||
if "treasury" in description or "bill" in description
|
||||
else (
|
||||
"Bond"
|
||||
if "%" in description
|
||||
or "due" in description
|
||||
or "pct" in description
|
||||
else (
|
||||
"Fund"
|
||||
if "fund" in description
|
||||
else ("ETF" if "etf" in description else None)
|
||||
)
|
||||
)
|
||||
)
|
||||
return values
|
||||
|
||||
|
||||
class FMPGovernmentTradesFetcher(
|
||||
Fetcher[
|
||||
FMPGovernmentTradesQueryParams,
|
||||
list[FMPGovernmentTradesData],
|
||||
]
|
||||
):
|
||||
"""FMP Government Trades Fetcher."""
|
||||
|
||||
@staticmethod
|
||||
def transform_query(params: dict[str, Any]) -> FMPGovernmentTradesQueryParams:
|
||||
"""Transform the query params."""
|
||||
return FMPGovernmentTradesQueryParams(**params)
|
||||
|
||||
@staticmethod
|
||||
async def aextract_data(
|
||||
query: FMPGovernmentTradesQueryParams,
|
||||
credentials: Optional[dict[str, str]] = None,
|
||||
**kwargs: Any,
|
||||
) -> list[dict]:
|
||||
"""Return the raw data from the Government Trades endpoint."""
|
||||
# pylint: disable=import-outside-toplevel
|
||||
import asyncio # noqa
|
||||
import math
|
||||
from openbb_core.app.model.abstract.error import OpenBBError
|
||||
from openbb_core.provider.utils.errors import EmptyDataError
|
||||
from openbb_core.provider.utils.helpers import amake_request
|
||||
from openbb_fmp.utils.helpers import create_url, response_callback
|
||||
from warnings import warn
|
||||
|
||||
symbols: list = []
|
||||
|
||||
if query.symbol:
|
||||
symbols = query.symbol.split(",")
|
||||
|
||||
results: list[dict] = []
|
||||
chamber_url_dict = {
|
||||
"house": ["senate-disclosure"],
|
||||
"senate": ["senate-trading"],
|
||||
"all": ["senate-disclosure", "senate-trading"],
|
||||
}
|
||||
api_key = credentials.get("fmp_api_key") if credentials else ""
|
||||
keys_to_remove = {
|
||||
"district",
|
||||
"capitalGainsOver200USD",
|
||||
"disclosureYear",
|
||||
"firstName",
|
||||
"lastName",
|
||||
}
|
||||
keys_to_rename = {"dateRecieved": "date", "disclosureDate": "date"}
|
||||
|
||||
async def get_one(url):
|
||||
"""Get data for one URL."""
|
||||
result = await amake_request(
|
||||
url, response_callback=response_callback, **kwargs
|
||||
)
|
||||
processed_list: list = []
|
||||
|
||||
for entry in result:
|
||||
new_entry = {
|
||||
keys_to_rename.get(k, k): v
|
||||
for k, v in entry.items()
|
||||
if k not in keys_to_remove
|
||||
}
|
||||
new_entry["chamber"] = "senate" if "senate-trading" in url else "house"
|
||||
processed_list.append(new_entry)
|
||||
|
||||
if not processed_list or len(processed_list) == 0:
|
||||
warn(f"No data found for {url.replace(api_key, 'API_KEY')}")
|
||||
|
||||
if processed_list:
|
||||
results.extend(processed_list)
|
||||
|
||||
urls_list: list = []
|
||||
|
||||
try:
|
||||
if symbols:
|
||||
for symbol in symbols:
|
||||
query.symbol = symbol
|
||||
url = [
|
||||
create_url(
|
||||
4,
|
||||
f"{i}",
|
||||
api_key=api_key,
|
||||
query=query,
|
||||
exclude=["chamber", "limit"],
|
||||
)
|
||||
for i in chamber_url_dict[query.chamber]
|
||||
]
|
||||
urls_list.extend(url)
|
||||
await asyncio.gather(*[get_one(url) for url in urls_list])
|
||||
else:
|
||||
pages = math.ceil(query.limit / 100)
|
||||
|
||||
if pages > 30:
|
||||
warn(
|
||||
f"Limit value - {query.limit} exceeds the available data for {query.chamber},"
|
||||
" returning all available data."
|
||||
)
|
||||
pages = 31
|
||||
for page in range(pages):
|
||||
query.page = page
|
||||
url = [
|
||||
create_url(
|
||||
4,
|
||||
f"{i}-rss-feed",
|
||||
api_key=api_key,
|
||||
query=query,
|
||||
exclude=["chamber", "limit"],
|
||||
)
|
||||
for i in chamber_url_dict[query.chamber]
|
||||
]
|
||||
urls_list.extend(url)
|
||||
await asyncio.gather(*[get_one(url) for url in urls_list])
|
||||
|
||||
if not results:
|
||||
raise EmptyDataError("No data returned for the given symbol.")
|
||||
|
||||
return results
|
||||
except OpenBBError as e:
|
||||
raise e from e
|
||||
|
||||
@staticmethod
|
||||
def transform_data(
|
||||
query: FMPGovernmentTradesQueryParams, data: list[dict], **kwargs: Any
|
||||
) -> list[FMPGovernmentTradesData]:
|
||||
"""Return the transformed data."""
|
||||
return sorted(
|
||||
[
|
||||
FMPGovernmentTradesData(
|
||||
**{k: v for k, v in d.items() if v and v != "--"}
|
||||
)
|
||||
for d in data
|
||||
],
|
||||
key=lambda x: x.date,
|
||||
reverse=True,
|
||||
)[: query.limit or len(data)]
|
||||
@@ -0,0 +1,105 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Connection:
|
||||
- keep-alive
|
||||
method: GET
|
||||
uri: https://financialmodelingprep.com/api/v4/senate-trading-rss-feed?apikey=MOCK_API_KEY&page=0
|
||||
response:
|
||||
body:
|
||||
string: !!binary |
|
||||
H4sIAAAAAAAAA+3dW3OjOBYA4Pf5FaquqdmeqlbCzQbPm6+JO76NIc5mt/ZBgLCpxuACnIxna//7
|
||||
Cid2kjbhInDs2HrorsQGX/g4R0dCKP/+BYD/kn8AfLFsPwgHaI6//AG+qDPsmJ775dvTcw56eepu
|
||||
Zod45i0DvHnWsyzbeL0b2N3Gsd0f0RazMFwEf1xeYssMMPKN2UWAXRTii6n3cPn0yOWDjR8vF6F/
|
||||
qVTECl/lJKgoNR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paC+7na+
|
||||
e+tRDfK7qEmck/poqF23x/3oyjf4Wvn9zcYb0ThMKsJdwOgDMMISCSVG+LkJGd+n5gNfBRaBn52Q
|
||||
Z4SfmzCWb++ThZhhmYbgq3h8Yfjeaj8Nz/v7/bV+fno2PxvpGGKuUjM40h3kLV6GEi+JUDcNBHWs
|
||||
CFgWsY4qacsXcJBPX4Ci9qr3uEVL/asQneggAc1fkv8Hnh/OQH2OfdtALmiT15iuSHfR8skB85dG
|
||||
uPQx6Czd+DXP96jb7vdGTJdCd4Lc6TJKQVeOpyMH4L/g7YV6AcaY/NIOQvIWoK11PtpzMvizyzwp
|
||||
PPvIRVNsghGJVMtzbA+oJFhxADTygGcH+OcYHtkLTI5DCWGbftVk11kb3bO4pXG+a6va3XDYAn/e
|
||||
1ntd7R6o/Xqv16yPQOd20CrkSBGud3fqPd2aoyfluFsSpTpu829HU9ugRd7X8RYkfqP1kXAYHCT3
|
||||
tpOHXk+eMrp0SUFpq6SWjzLtulSCYPP7eEk2dhwgEIBDeHbv6JZOPxlPytDc+PXVZhe06532IfDa
|
||||
HRaMNO3jBq8ZLfuo/jYClQMF3yT5D7efvB9l8Kmj1hj0bbOJFkB6ontKrB8N2G/RLRJ8SoACRQB2
|
||||
SF/Df8h/Kbkkts6xdh8VUdQRb8pQlMUqlJBgQCTqGBqVKqpKPOJ4C5ejRpM2641xawBG1/dqt1nv
|
||||
gRHpU9RbQL3OnDoL3U+yyxh9AAZJAblp/3gognvyyUnyxChY+ivy3V3zUJzq9bEm08+hKUL5iDS7
|
||||
bZZki2j2G+qh6PqNBqOjoOsOJm21OSQt4nCsAS26nqWN2/VyHKkGUBvPDeQv//k/0SwWe4i0AAA=
|
||||
headers:
|
||||
Access-Control-Allow-Credentials:
|
||||
- 'true'
|
||||
Access-Control-Allow-Headers:
|
||||
- X-Requested-With, content-type, auth-token, Authorization, stripe-signature,
|
||||
APPS, publicauthkey, privateauthkey
|
||||
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:
|
||||
- Fri, 06 Dec 2024 00:39:23 GMT
|
||||
Etag:
|
||||
- W/"b488-L685VcG067aMlCDn+EpysmcRcnQ"
|
||||
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
|
||||
@@ -0,0 +1,105 @@
|
||||
interactions:
|
||||
- request:
|
||||
body: null
|
||||
headers:
|
||||
Accept:
|
||||
- application/json
|
||||
Accept-Encoding:
|
||||
- gzip, deflate
|
||||
Connection:
|
||||
- keep-alive
|
||||
method: GET
|
||||
uri: https://financialmodelingprep.com/api/v4/senate-trading-rss-feed?apikey=MOCK_API_KEY&page=0
|
||||
response:
|
||||
body:
|
||||
string: !!binary |
|
||||
H4sIAAAAAAAAA+3d23OqSBoA8Pf5K7pOTZ2dqTqdcBWcN+Ml8USjI8RsdmsfGmiUCoIFmIyztf/7
|
||||
NjGaGAmNXKIRHk5VjoIXfnzN11837b9/AeC/5B8A30zL84MbNMPf/gDflCm2Ddf59mP1nI1en7qb
|
||||
WgGeugsfr591TdPS3+4GdrexLech3GIaBHP/j/NzbBo+Rp4+PfOxgwJ8NnEfz1ePnD9a+Ol8Hnjn
|
||||
ssiLbI0RoCzXNShgLEOkyxjWtHpdE0WBZwX+fP0OBnmVEdYt/IiN8J04hhMgy0FGWG8ReMjxkR5Y
|
||||
rtMiG79uxEK2vvkyTw72nr/L/O3nR76Pgxb2dc+ahy8QbtHHgW2ZGHQdfWszdTlfHY3A1R82b75+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xLrOkI4ha7ISFFiBh5qhI6hhmcMSjzUk0pYvYCBLX4Ci/qYfuUGj/kDE
|
||||
XVtR7waDFvjzttHrqvdA6Td6vWZjCDq3N63PZry7U+7TLUt4Uo67wUd1tBTS1GAf9JVmF7QbnTZo
|
||||
q53P5mt34qvnpcBLEYR95KAJNsDQ9QLTtS0XKNgLF/dRyQOu5WNwQ/6YgsaMPKwjBwytOSbHAYPO
|
||||
won+BYKkyvSRzV1mdXg/LL0zl8K5Qyi9x/0LcDmFZ6dberU0TasybI1A3zKaaA4EhgkbVqB6C397
|
||||
p30DL4Vfv5VukfOTAQznPqcAXF8bn9HIMV//f7QgG9s24JiV6md7du/SLaB9Up4pmtG1XzNc9E/5
|
||||
PgTigfzG8T9Od/J+KdOdMXImi7BjfGm7GrIB/gvenilnYITJf9p+QN7iEJzjmz+rC2Qaz054kF5a
|
||||
13eJapu8xmRJMh7TIwfMW+jBwssha02h2+73qqQ1zdVzE60dVWmDFnlf252Tzkq4xiMO/INEavtY
|
||||
+5kyz2uINSTIS3wNCojTIeI1DHWxhmoCixjWxDlRpgnU7khRgToCl73BRaMH1EZT7TbJH81+slJP
|
||||
tjtMdiE76mW6VbrLLpkpBcp0f+Yu4vGmQV/EsH+hHMoufO8KLwMeC3lwTz45SX8w8hfeknx3xzgU
|
||||
p3J1rBWCr6HJQ+mINLvtVX/kl//8H76NuteFtAAA
|
||||
headers:
|
||||
Access-Control-Allow-Credentials:
|
||||
- 'true'
|
||||
Access-Control-Allow-Headers:
|
||||
- X-Requested-With, content-type, auth-token, Authorization, stripe-signature,
|
||||
APPS, publicauthkey, privateauthkey
|
||||
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:
|
||||
- Fri, 06 Dec 2024 00:37:01 GMT
|
||||
Etag:
|
||||
- W/"b485-xkA9fqZ3cTgtbLcCqSB0Ue9nHu4"
|
||||
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
|
||||
@@ -71,6 +71,7 @@ from openbb_fmp.models.share_statistics import FMPShareStatisticsFetcher
|
||||
from openbb_fmp.models.treasury_rates import FMPTreasuryRatesFetcher
|
||||
from openbb_fmp.models.world_news import FMPWorldNewsFetcher
|
||||
from openbb_fmp.models.yield_curve import FMPYieldCurveFetcher
|
||||
from openbb_fmp.models.government_trades import FMPGovernmentTradesFetcher
|
||||
|
||||
test_credentials = UserService().default_user_settings.credentials.model_dump(
|
||||
mode="json"
|
||||
@@ -762,3 +763,17 @@ def test_fmp_historical_market_cap_fetcher(credentials=test_credentials):
|
||||
fetcher = FmpHistoricalMarketCapFetcher()
|
||||
result = fetcher.test(params, credentials)
|
||||
assert result is None
|
||||
|
||||
|
||||
@pytest.mark.record_http
|
||||
def test_fmp_government_trades_fetcher(credentials=test_credentials):
|
||||
"""Test FMP government trades fetcher.
|
||||
params limit only functions when there is no parameter symbol.
|
||||
"""
|
||||
params = {
|
||||
"chamber": "senate",
|
||||
"limit": 1,
|
||||
}
|
||||
fetcher = FMPGovernmentTradesFetcher()
|
||||
result = fetcher.test(params, credentials)
|
||||
assert result is None
|
||||
|
||||
Reference in New Issue
Block a user