diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e16417a185ee..5f507829eedd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: types: [python] files: '^openbb_platform/.*\.py$' exclude: 'tests/.*\.py|openbb_platform/test_.*\.py' - args: ["--config=pyproject.toml"] + args: ["--config=ruff.toml"] - repo: https://github.com/codespell-project/codespell rev: v2.2.5 hooks: diff --git a/openbb_platform/core/openbb_core/app/model/preferences.py b/openbb_platform/core/openbb_core/app/model/preferences.py index 19c2d7f745df..44d44efd0d92 100644 --- a/openbb_platform/core/openbb_core/app/model/preferences.py +++ b/openbb_platform/core/openbb_core/app/model/preferences.py @@ -27,7 +27,7 @@ class Preferences(BaseModel): ) plot_pywry_height: PositiveInt = 762 plot_pywry_width: PositiveInt = 1400 - request_timeout: PositiveInt = 15 + request_timeout: PositiveInt = 60 show_warnings: bool = True table_style: Literal["dark", "light"] = "dark" user_styles_directory: str = str(Path.home() / "OpenBBUserData" / "styles" / "user") diff --git a/openbb_platform/core/openbb_core/provider/standard_models/treasury_prices.py b/openbb_platform/core/openbb_core/provider/standard_models/treasury_prices.py index 5f42f7d4de41..c803987b92a6 100644 --- a/openbb_platform/core/openbb_core/provider/standard_models/treasury_prices.py +++ b/openbb_platform/core/openbb_core/provider/standard_models/treasury_prices.py @@ -15,7 +15,7 @@ class TreasuryPricesQueryParams(QueryParams): date: Optional[dateType] = Field( description=QUERY_DESCRIPTIONS.get("date", "") - + " No date will return the current posted data.", + + " Defaults to the last business day.", default=None, ) diff --git a/openbb_platform/core/tests/app/service/test_user_service.py b/openbb_platform/core/tests/app/service/test_user_service.py index aefe199382f2..e65f0a56aca9 100644 --- a/openbb_platform/core/tests/app/service/test_user_service.py +++ b/openbb_platform/core/tests/app/service/test_user_service.py @@ -57,7 +57,8 @@ def test_update_default(): # Update the default settings updated_settings = UserService.update_default(other_settings) - assert updated_settings.defaults.model_dump() == defaults_test.model_dump() + assert "test" in updated_settings.defaults.model_dump()["routes"] + assert updated_settings.defaults.model_dump()["routes"]["test"] == {"test": "test"} def test_merge_dicts(): diff --git a/openbb_platform/extensions/technical/openbb_technical/technical_router.py b/openbb_platform/extensions/technical/openbb_technical/technical_router.py index 47aa24d2700f..3dbf2e3df848 100644 --- a/openbb_platform/extensions/technical/openbb_technical/technical_router.py +++ b/openbb_platform/extensions/technical/openbb_technical/technical_router.py @@ -57,11 +57,6 @@ + " long_period=365, short_period=30, window=30, trading_periods=365)", ], ), - APIEx( - description="Note that the mock data displayed here is insufficient." - + " It must contain multiple symbols, with the benchmark, and be daily data at least 1 year in length.", - parameters={"benchmark": "SPY", "data": APIEx.mock_data("timeseries")}, - ), ], ) async def relative_rotation( diff --git a/openbb_platform/obbject_extensions/charting/tests/test_charting.py b/openbb_platform/obbject_extensions/charting/tests/test_charting.py index 3f270c53a25e..498b046fdb09 100644 --- a/openbb_platform/obbject_extensions/charting/tests/test_charting.py +++ b/openbb_platform/obbject_extensions/charting/tests/test_charting.py @@ -48,6 +48,7 @@ def __init__(self): self.provider = "mock_provider" self.extra = "mock_extra" self.warnings = "mock_warnings" + self.chart = MagicMock() def to_dataframe(self): """Mock to_dataframe.""" @@ -108,8 +109,8 @@ def test_functions(mock_get_charting_functions): mock_get_charting_functions.assert_called_once() -@patch("openbb_charting.core.backend.get_backend") -@patch("openbb_charting.core.backend.create_backend") +@patch("openbb_charting.get_backend") +@patch("openbb_charting.create_backend") def test_handle_backend(mock_create_backend, mock_get_backend, obbject): """Test _handle_backend method.""" # Act -> _handle backend is called in the constructor @@ -136,7 +137,8 @@ def test_get_chart_function(mock_charting_router): @patch("openbb_charting.Charting._get_chart_function") -def test_show(mock_get_chart_function, obbject): +@patch("openbb_charting.Chart") +def test_show(_, mock_get_chart_function, obbject): """Test show method.""" # Arrange mock_function = MagicMock() @@ -151,28 +153,24 @@ def test_show(mock_get_chart_function, obbject): # Assert mock_get_chart_function.assert_called_once() mock_function.assert_called_once() - mock_fig.show.assert_called_once() -@patch("openbb_charting.to_chart") -def test_to_chart(mock_to_chart, obbject): +@patch("openbb_charting.Charting._prepare_data_as_df") +@patch("openbb_charting.Charting._get_chart_function") +@patch("openbb_charting.Chart") +def test_to_chart(_, mock_get_chart_function, mock_prepare_data_as_df, obbject): """Test to_chart method.""" # Arrange + mock_prepare_data_as_df.return_value = (mock_dataframe, True) + mock_function = MagicMock() + mock_get_chart_function.return_value = mock_function mock_fig = MagicMock() - mock_to_chart.return_value = (mock_fig, {"content": "mock_content"}) + mock_function.return_value = (mock_fig, {"content": "mock_content"}) obj = Charting(obbject) # Act obj.to_chart() # Assert - assert obj._obbject.chart.fig == mock_fig - mock_to_chart.assert_called_once_with( - mock_dataframe, - indicators=None, - symbol="", - candles=True, - volume=True, - prepost=False, - volume_ticks_x=7, - ) + mock_get_chart_function.assert_called_once() + mock_function.assert_called_once() diff --git a/openbb_platform/openbb/assets/reference.json b/openbb_platform/openbb/assets/reference.json index 3d8781d622cc..94947e5c4ebe 100644 --- a/openbb_platform/openbb/assets/reference.json +++ b/openbb_platform/openbb/assets/reference.json @@ -629,7 +629,7 @@ "name": "sort", "type": "Literal['ticker', 'name', 'market', 'locale', 'currency_symbol', 'currency_name', 'base_currency_symbol', 'base_currency_name', 'last_updated_utc', 'delisted_utc']", "description": "Sort field used for ordering.", - "default": "", + "default": null, "optional": true }, { @@ -2681,7 +2681,7 @@ }, { "name": "filter_variable", - "type": "Literal[None, 'frequency', 'units', 'seasonal_adjustment']", + "type": "Literal['frequency', 'units', 'seasonal_adjustment']", "description": "Filter by an attribute.", "default": null, "optional": true @@ -2941,21 +2941,21 @@ "fred": [ { "name": "frequency", - "type": "Literal[None, 'a', 'q', 'm', 'w', 'd', 'wef', 'weth', 'wew', 'wetu', 'wem', 'wesu', 'wesa', 'bwew', 'bwem']", + "type": "Literal['a', 'q', 'm', 'w', 'd', 'wef', 'weth', 'wew', 'wetu', 'wem', 'wesu', 'wesa', 'bwew', 'bwem']", "description": "Frequency aggregation to convert high frequency data to lower frequency. None = No change a = Annual q = Quarterly m = Monthly w = Weekly d = Daily wef = Weekly, Ending Friday weth = Weekly, Ending Thursday wew = Weekly, Ending Wednesday wetu = Weekly, Ending Tuesday wem = Weekly, Ending Monday wesu = Weekly, Ending Sunday wesa = Weekly, Ending Saturday bwew = Biweekly, Ending Wednesday bwem = Biweekly, Ending Monday", "default": null, "optional": true }, { "name": "aggregation_method", - "type": "Literal[None, 'avg', 'sum', 'eop']", + "type": "Literal['avg', 'sum', 'eop']", "description": "A key that indicates the aggregation method used for frequency aggregation. This parameter has no affect if the frequency parameter is not set. avg = Average sum = Sum eop = End of Period", "default": "eop", "optional": true }, { "name": "transform", - "type": "Literal[None, 'chg', 'ch1', 'pch', 'pc1', 'pca', 'cch', 'cca', 'log']", + "type": "Literal['chg', 'ch1', 'pch', 'pc1', 'pca', 'cch', 'cca', 'log']", "description": "Transformation type None = No transformation chg = Change ch1 = Change from Year Ago pch = Percent Change pc1 = Percent Change from Year Ago pca = Compounded Annual Rate of Change cch = Continuously Compounded Rate of Change cca = Continuously Compounded Annual Rate of Change log = Natural Log", "default": null, "optional": true @@ -10092,14 +10092,14 @@ }, { "name": "order", - "type": "Literal[None, 'asc', 'desc']", + "type": "Literal['asc', 'desc']", "description": "Order of the financial statement.", "default": null, "optional": true }, { "name": "sort", - "type": "Literal[None, 'filing_date', 'period_of_report_date']", + "type": "Literal['filing_date', 'period_of_report_date']", "description": "Sort of the financial statement.", "default": null, "optional": true @@ -16024,7 +16024,7 @@ "sec": [ { "name": "cik", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "Lookup filings by Central Index Key (CIK) instead of by symbol.", "default": null, "optional": true @@ -16174,7 +16174,7 @@ }, { "name": "act", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "The SEC Act number.", "default": null, "optional": true @@ -16202,42 +16202,42 @@ }, { "name": "accession_number", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "The accession number.", "default": null, "optional": true }, { "name": "file_number", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "The file number.", "default": null, "optional": true }, { "name": "film_number", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "The film number.", "default": null, "optional": true }, { "name": "is_inline_xbrl", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "Whether the filing is an inline XBRL filing.", "default": null, "optional": true }, { "name": "is_xbrl", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "Whether the filing is an XBRL filing.", "default": null, "optional": true }, { "name": "size", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "The size of the filing.", "default": null, "optional": true @@ -23630,7 +23630,7 @@ }, { "name": "rate_tenor_unit_rec", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "The rate tenor unit for receivable portion of the swap.", "default": null, "optional": true @@ -23644,7 +23644,7 @@ }, { "name": "reset_date_unit_rec", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "The reset date unit for receivable portion of the swap.", "default": null, "optional": true @@ -23693,7 +23693,7 @@ }, { "name": "rate_tenor_unit_pmnt", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "The rate tenor unit for payment portion of the swap.", "default": null, "optional": true @@ -23707,7 +23707,7 @@ }, { "name": "reset_date_unit_pmnt", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "The reset date unit for payment portion of the swap.", "default": null, "optional": true @@ -26788,7 +26788,71 @@ } ], "fmp": [], - "intrinio": [], + "intrinio": [ + { + "name": "source", + "type": "Literal['yahoo', 'moody', 'moody_us_news', 'moody_us_press_releases']", + "description": "The source of the news article.", + "default": null, + "optional": true + }, + { + "name": "sentiment", + "type": "Literal['positive', 'neutral', 'negative']", + "description": "Return news only from this source.", + "default": null, + "optional": true + }, + { + "name": "language", + "type": "str", + "description": "Filter by language. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "topic", + "type": "str", + "description": "Filter by topic. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "word_count_greater_than", + "type": "int", + "description": "News stories will have a word count greater than this value. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "word_count_less_than", + "type": "int", + "description": "News stories will have a word count less than this value. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "is_spam", + "type": "bool", + "description": "Filter whether it is marked as spam or not. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "business_relevance_greater_than", + "type": "float", + "description": "News stories will have a business relevance score more than this value. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "business_relevance_less_than", + "type": "float", + "description": "News stories will have a business relevance score less than this value. Unsupported for yahoo source.", + "default": null, + "optional": true + } + ], "tiingo": [ { "name": "offset", @@ -26934,6 +26998,76 @@ } ], "intrinio": [ + { + "name": "source", + "type": "str", + "description": "The source of the news article.", + "default": null, + "optional": true + }, + { + "name": "summary", + "type": "str", + "description": "The summary of the news article.", + "default": null, + "optional": true + }, + { + "name": "topics", + "type": "str", + "description": "The topics related to the news article.", + "default": null, + "optional": true + }, + { + "name": "word_count", + "type": "int", + "description": "The word count of the news article.", + "default": null, + "optional": true + }, + { + "name": "business_relevance", + "type": "float", + "description": "How strongly correlated the news article is to the business", + "default": null, + "optional": true + }, + { + "name": "sentiment", + "type": "str", + "description": "The sentiment of the news article - i.e, negative, positive.", + "default": null, + "optional": true + }, + { + "name": "sentiment_confidence", + "type": "float", + "description": "The confidence score of the sentiment rating.", + "default": null, + "optional": true + }, + { + "name": "language", + "type": "str", + "description": "The language of the news article.", + "default": null, + "optional": true + }, + { + "name": "spam", + "type": "bool", + "description": "Whether the news article is spam.", + "default": null, + "optional": true + }, + { + "name": "copyright", + "type": "str", + "description": "The copyright notice of the news article.", + "default": null, + "optional": true + }, { "name": "id", "type": "str", @@ -26943,10 +27077,17 @@ }, { "name": "company", - "type": "Dict[str, Any]", - "description": "Company details related to the news article.", - "default": "", - "optional": false + "type": "IntrinioCompany", + "description": "The Intrinio Company object. Contains details company reference data.", + "default": null, + "optional": true + }, + { + "name": "security", + "type": "IntrinioSecurity", + "description": "The Intrinio Security object. Contains the security details related to the news article.", + "default": null, + "optional": true } ], "tiingo": [ @@ -27129,7 +27270,71 @@ "optional": true } ], - "intrinio": [], + "intrinio": [ + { + "name": "source", + "type": "Literal['yahoo', 'moody', 'moody_us_news', 'moody_us_press_releases']", + "description": "The source of the news article.", + "default": null, + "optional": true + }, + { + "name": "sentiment", + "type": "Literal['positive', 'neutral', 'negative']", + "description": "Return news only from this source.", + "default": null, + "optional": true + }, + { + "name": "language", + "type": "str", + "description": "Filter by language. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "topic", + "type": "str", + "description": "Filter by topic. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "word_count_greater_than", + "type": "int", + "description": "News stories will have a word count greater than this value. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "word_count_less_than", + "type": "int", + "description": "News stories will have a word count less than this value. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "is_spam", + "type": "bool", + "description": "Filter whether it is marked as spam or not. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "business_relevance_greater_than", + "type": "float", + "description": "News stories will have a business relevance score more than this value. Unsupported for yahoo source.", + "default": null, + "optional": true + }, + { + "name": "business_relevance_less_than", + "type": "float", + "description": "News stories will have a business relevance score less than this value. Unsupported for yahoo source.", + "default": null, + "optional": true + } + ], "polygon": [ { "name": "order", @@ -27292,12 +27497,89 @@ } ], "intrinio": [ + { + "name": "source", + "type": "str", + "description": "The source of the news article.", + "default": null, + "optional": true + }, + { + "name": "summary", + "type": "str", + "description": "The summary of the news article.", + "default": null, + "optional": true + }, + { + "name": "topics", + "type": "str", + "description": "The topics related to the news article.", + "default": null, + "optional": true + }, + { + "name": "word_count", + "type": "int", + "description": "The word count of the news article.", + "default": null, + "optional": true + }, + { + "name": "business_relevance", + "type": "float", + "description": "How strongly correlated the news article is to the business", + "default": null, + "optional": true + }, + { + "name": "sentiment", + "type": "str", + "description": "The sentiment of the news article - i.e, negative, positive.", + "default": null, + "optional": true + }, + { + "name": "sentiment_confidence", + "type": "float", + "description": "The confidence score of the sentiment rating.", + "default": null, + "optional": true + }, + { + "name": "language", + "type": "str", + "description": "The language of the news article.", + "default": null, + "optional": true + }, + { + "name": "spam", + "type": "bool", + "description": "Whether the news article is spam.", + "default": null, + "optional": true + }, + { + "name": "copyright", + "type": "str", + "description": "The copyright notice of the news article.", + "default": null, + "optional": true + }, { "name": "id", "type": "str", "description": "Article ID.", "default": "", "optional": false + }, + { + "name": "security", + "type": "IntrinioSecurity", + "description": "The Intrinio Security object. Contains the security details related to the news article.", + "default": null, + "optional": true } ], "polygon": [ @@ -27530,7 +27812,7 @@ }, { "name": "cik", - "type": "Union[str, int]", + "type": "Union[int, str]", "description": "Central Index Key (CIK)", "default": null, "optional": true diff --git a/openbb_platform/openbb/package/__init__.py b/openbb_platform/openbb/package/__init__.py deleted file mode 100644 index 3d627c7ba620..000000000000 --- a/openbb_platform/openbb/package/__init__.py +++ /dev/null @@ -1 +0,0 @@ -### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### diff --git a/openbb_platform/openbb/package/derivatives_options.py b/openbb_platform/openbb/package/derivatives_options.py index 4e95763ec5f9..4490181503de 100644 --- a/openbb_platform/openbb/package/derivatives_options.py +++ b/openbb_platform/openbb/package/derivatives_options.py @@ -209,9 +209,9 @@ def unusual( The type of unusual activity to query for. (provider: intrinio) sentiment : Optional[Literal['bullish', 'bearish', 'neutral']] The sentiment type to query for. (provider: intrinio) - min_value : Optional[Union[float, int]] + min_value : Optional[Union[int, float]] The inclusive minimum total value for the unusual activity. (provider: intrinio) - max_value : Optional[Union[float, int]] + max_value : Optional[Union[int, float]] The inclusive maximum total value for the unusual activity. (provider: intrinio) limit : int The number of data entries to return. A typical day for all symbols will yield 50-80K records. The API will paginate at 1000 records. The high default limit (100K) is to be able to reliably capture the most days. The high absolute limit (1.25M) is to allow for outlier days. Queries at the absolute limit will take a long time, and might be unreliable. Apply filters to improve performance. (provider: intrinio) diff --git a/openbb_platform/openbb/package/economy.py b/openbb_platform/openbb/package/economy.py index dd5c0cfb118f..0422146ba39b 100644 --- a/openbb_platform/openbb/package/economy.py +++ b/openbb_platform/openbb/package/economy.py @@ -794,7 +794,7 @@ def fred_search( The number of data entries to return. (1-1000) (provider: fred) offset : Optional[Annotated[int, Ge(ge=0)]] Offset the results in conjunction with limit. (provider: fred) - filter_variable : Literal[None, 'frequency', 'units', 'seasonal_adjustment'] + filter_variable : Optional[Literal['frequency', 'units', 'seasonal_adjustment']] Filter by an attribute. (provider: fred) filter_value : Optional[str] String value to filter the variable by. Used in conjunction with filter_variable. (provider: fred) @@ -931,7 +931,7 @@ def fred_series( The provider to use for the query, by default None. If None, the provider specified in defaults is selected or 'fred' if there is no default. - frequency : Literal[None, 'a', 'q', 'm', 'w', 'd', 'wef', 'weth', 'wew', 'wetu', 'wem', 'wesu', 'wesa', 'bwew', 'bwem'] + frequency : Optional[Literal['a', 'q', 'm', 'w', 'd', 'wef', 'weth', 'wew', 'wetu', 'wem', 'wesu', 'wesa', 'bwew', 'bwem']] Frequency aggregation to convert high frequency data to lower frequency. None = No change @@ -950,7 +950,7 @@ def fred_series( bwew = Biweekly, Ending Wednesday bwem = Biweekly, Ending Monday (provider: fred) - aggregation_method : Literal[None, 'avg', 'sum', 'eop'] + aggregation_method : Optional[Literal['avg', 'sum', 'eop']] A key that indicates the aggregation method used for frequency aggregation. This parameter has no affect if the frequency parameter is not set. @@ -958,7 +958,7 @@ def fred_series( sum = Sum eop = End of Period (provider: fred) - transform : Literal[None, 'chg', 'ch1', 'pch', 'pc1', 'pca', 'cch', 'cca', 'log'] + transform : Optional[Literal['chg', 'ch1', 'pch', 'pc1', 'pca', 'cch', 'cca', 'log']] Transformation type None = No transformation diff --git a/openbb_platform/openbb/package/equity_fundamental.py b/openbb_platform/openbb/package/equity_fundamental.py index 0ed3fc957b8f..4606e106d1ea 100644 --- a/openbb_platform/openbb/package/equity_fundamental.py +++ b/openbb_platform/openbb/package/equity_fundamental.py @@ -619,9 +619,9 @@ def cash( Period of report date greater than or equal to the given date. (provider: polygon) include_sources : bool Whether to include the sources of the financial statement. (provider: polygon) - order : Literal[None, 'asc', 'desc'] + order : Optional[Literal['asc', 'desc']] Order of the financial statement. (provider: polygon) - sort : Literal[None, 'filing_date', 'period_of_report_date'] + sort : Optional[Literal['filing_date', 'period_of_report_date']] Sort of the financial statement. (provider: polygon) Returns @@ -1197,7 +1197,7 @@ def filings( End date of the data, in YYYY-MM-DD format. (provider: intrinio) thea_enabled : Optional[bool] Return filings that have been read by Intrinio's Thea NLP. (provider: intrinio) - cik : Optional[Union[str, int]] + cik : Optional[Union[int, str]] Lookup filings by Central Index Key (CIK) instead of by symbol. (provider: sec) use_cache : bool Whether or not to use cache. If True, cache will store for one day. (provider: sec) @@ -1246,7 +1246,7 @@ def filings( Industry category of the company. (provider: intrinio) report_date : Optional[date] The date of the filing. (provider: sec) - act : Optional[Union[str, int]] + act : Optional[Union[int, str]] The SEC Act number. (provider: sec) items : Optional[Union[str, float]] The SEC Item numbers. (provider: sec) @@ -1254,17 +1254,17 @@ def filings( The description of the primary document. (provider: sec) primary_doc : Optional[str] The filename of the primary document. (provider: sec) - accession_number : Optional[Union[str, int]] + accession_number : Optional[Union[int, str]] The accession number. (provider: sec) - file_number : Optional[Union[str, int]] + file_number : Optional[Union[int, str]] The file number. (provider: sec) - film_number : Optional[Union[str, int]] + film_number : Optional[Union[int, str]] The film number. (provider: sec) - is_inline_xbrl : Optional[Union[str, int]] + is_inline_xbrl : Optional[Union[int, str]] Whether the filing is an inline XBRL filing. (provider: sec) - is_xbrl : Optional[Union[str, int]] + is_xbrl : Optional[Union[int, str]] Whether the filing is an XBRL filing. (provider: sec) - size : Optional[Union[str, int]] + size : Optional[Union[int, str]] The size of the filing. (provider: sec) complete_submission_url : Optional[str] The URL to the complete filing submission. (provider: sec) diff --git a/openbb_platform/openbb/package/equity_ownership.py b/openbb_platform/openbb/package/equity_ownership.py index 7311c9aa7ebc..45fd01edb5f4 100644 --- a/openbb_platform/openbb/package/equity_ownership.py +++ b/openbb_platform/openbb/package/equity_ownership.py @@ -245,7 +245,7 @@ def insider_trading( Expiration date of the derivative. (provider: intrinio) underlying_security_title : Optional[str] Name of the underlying non-derivative security related to this derivative transaction. (provider: intrinio) - underlying_shares : Optional[Union[float, int]] + underlying_shares : Optional[Union[int, float]] Number of underlying shares related to this derivative transaction. (provider: intrinio) nature_of_ownership : Optional[str] Nature of ownership of the insider trading. (provider: intrinio) diff --git a/openbb_platform/openbb/package/equity_price.py b/openbb_platform/openbb/package/equity_price.py index 369b2c14646d..a174d0b9e4bc 100644 --- a/openbb_platform/openbb/package/equity_price.py +++ b/openbb_platform/openbb/package/equity_price.py @@ -117,7 +117,7 @@ def historical( The low price. close : float The close price. - volume : Optional[Union[float, int]] + volume : Optional[Union[int, float]] The trading volume. vwap : Optional[float] Volume Weighted Average Price over the period. @@ -508,9 +508,9 @@ def quote( The low price. close : Optional[float] The close price. - volume : Optional[Union[float, int]] + volume : Optional[Union[int, float]] The trading volume. - exchange_volume : Optional[Union[float, int]] + exchange_volume : Optional[Union[int, float]] Volume of shares exchanged during the trading day on the specific exchange. prev_close : Optional[float] The previous close price. diff --git a/openbb_platform/openbb/package/etf.py b/openbb_platform/openbb/package/etf.py index fba228608680..0c30a66ca2bb 100644 --- a/openbb_platform/openbb/package/etf.py +++ b/openbb_platform/openbb/package/etf.py @@ -155,7 +155,7 @@ def equity_exposure( The number of shares held in the ETF. weight : Optional[float] The weight of the equity in the ETF, as a normalized percent. - market_value : Optional[Union[float, int]] + market_value : Optional[Union[int, float]] The market value of the equity position in the ETF. Examples @@ -279,7 +279,7 @@ def historical( The low price. close : float The close price. - volume : Optional[Union[float, int]] + volume : Optional[Union[int, float]] The trading volume. vwap : Optional[float] Volume Weighted Average Price over the period. @@ -538,11 +538,11 @@ def holdings( The floating rate spread for reveivable portion of the swap. (provider: sec) rate_tenor_rec : Optional[str] The rate tenor for receivable portion of the swap. (provider: sec) - rate_tenor_unit_rec : Optional[Union[str, int]] + rate_tenor_unit_rec : Optional[Union[int, str]] The rate tenor unit for receivable portion of the swap. (provider: sec) reset_date_rec : Optional[str] The reset date for receivable portion of the swap. (provider: sec) - reset_date_unit_rec : Optional[Union[str, int]] + reset_date_unit_rec : Optional[Union[int, str]] The reset date unit for receivable portion of the swap. (provider: sec) rate_type_pmnt : Optional[str] The type of rate for payment portion of the swap. (provider: sec) @@ -556,11 +556,11 @@ def holdings( The floating rate spread for payment portion of the swap. (provider: sec) rate_tenor_pmnt : Optional[str] The rate tenor for payment portion of the swap. (provider: sec) - rate_tenor_unit_pmnt : Optional[Union[str, int]] + rate_tenor_unit_pmnt : Optional[Union[int, str]] The rate tenor unit for payment portion of the swap. (provider: sec) reset_date_pmnt : Optional[str] The reset date for payment portion of the swap. (provider: sec) - reset_date_unit_pmnt : Optional[Union[str, int]] + reset_date_unit_pmnt : Optional[Union[int, str]] The reset date unit for payment portion of the swap. (provider: sec) repo_type : Optional[str] The type of repo. (provider: sec) diff --git a/openbb_platform/openbb/package/news.py b/openbb_platform/openbb/package/news.py index d137098644da..d951f6be51b6 100644 --- a/openbb_platform/openbb/package/news.py +++ b/openbb_platform/openbb/package/news.py @@ -96,10 +96,27 @@ def company( Content types of the news to retrieve. (provider: benzinga) page : Optional[int] Page number of the results. Use in combination with limit. (provider: fmp) + source : Optional[Union[Literal['yahoo', 'moody', 'moody_us_news', 'moody_us_press_releases'], str]] + The source of the news article. (provider: intrinio); + A comma-separated list of the domains requested. (provider: tiingo) + sentiment : Optional[Literal['positive', 'neutral', 'negative']] + Return news only from this source. (provider: intrinio) + language : Optional[str] + Filter by language. Unsupported for yahoo source. (provider: intrinio) + topic : Optional[str] + Filter by topic. Unsupported for yahoo source. (provider: intrinio) + word_count_greater_than : Optional[int] + News stories will have a word count greater than this value. Unsupported for yahoo source. (provider: intrinio) + word_count_less_than : Optional[int] + News stories will have a word count less than this value. Unsupported for yahoo source. (provider: intrinio) + is_spam : Optional[bool] + Filter whether it is marked as spam or not. Unsupported for yahoo source. (provider: intrinio) + business_relevance_greater_than : Optional[float] + News stories will have a business relevance score more than this value. Unsupported for yahoo source. (provider: intrinio) + business_relevance_less_than : Optional[float] + News stories will have a business relevance score less than this value. Unsupported for yahoo source. (provider: intrinio) offset : Optional[int] Page offset, used in conjunction with limit. (provider: tiingo) - source : Optional[str] - A comma-separated list of the domains requested. (provider: tiingo) Returns ------- @@ -145,9 +162,30 @@ def company( Updated date of the news. (provider: benzinga) source : Optional[str] Name of the news source. (provider: fmp); + The source of the news article. (provider: intrinio); Source of the article. (provider: polygon); News source. (provider: tiingo); Source of the news article (provider: yfinance) + summary : Optional[str] + The summary of the news article. (provider: intrinio) + topics : Optional[str] + The topics related to the news article. (provider: intrinio) + word_count : Optional[int] + The word count of the news article. (provider: intrinio) + business_relevance : Optional[float] + How strongly correlated the news article is to the business (provider: intrinio) + sentiment : Optional[str] + The sentiment of the news article - i.e, negative, positive. (provider: intrinio) + sentiment_confidence : Optional[float] + The confidence score of the sentiment rating. (provider: intrinio) + language : Optional[str] + The language of the news article. (provider: intrinio) + spam : Optional[bool] + Whether the news article is spam. (provider: intrinio) + copyright : Optional[str] + The copyright notice of the news article. (provider: intrinio) + security : Optional[IntrinioSecurity] + The Intrinio Security object. Contains the security details related to the news article. (provider: intrinio) amp_url : Optional[str] AMP URL. (provider: polygon) publisher : Optional[PolygonPublisher] @@ -275,10 +313,27 @@ def world( Authors of the news to retrieve. (provider: benzinga) content_types : Optional[str] Content types of the news to retrieve. (provider: benzinga) + source : Optional[Union[Literal['yahoo', 'moody', 'moody_us_news', 'moody_us_press_releases'], str]] + The source of the news article. (provider: intrinio); + A comma-separated list of the domains requested. (provider: tiingo) + sentiment : Optional[Literal['positive', 'neutral', 'negative']] + Return news only from this source. (provider: intrinio) + language : Optional[str] + Filter by language. Unsupported for yahoo source. (provider: intrinio) + topic : Optional[str] + Filter by topic. Unsupported for yahoo source. (provider: intrinio) + word_count_greater_than : Optional[int] + News stories will have a word count greater than this value. Unsupported for yahoo source. (provider: intrinio) + word_count_less_than : Optional[int] + News stories will have a word count less than this value. Unsupported for yahoo source. (provider: intrinio) + is_spam : Optional[bool] + Filter whether it is marked as spam or not. Unsupported for yahoo source. (provider: intrinio) + business_relevance_greater_than : Optional[float] + News stories will have a business relevance score more than this value. Unsupported for yahoo source. (provider: intrinio) + business_relevance_less_than : Optional[float] + News stories will have a business relevance score less than this value. Unsupported for yahoo source. (provider: intrinio) offset : Optional[int] Page offset, used in conjunction with limit. (provider: tiingo) - source : Optional[str] - A comma-separated list of the domains requested. (provider: tiingo) Returns ------- @@ -322,8 +377,30 @@ def world( Updated date of the news. (provider: benzinga) site : Optional[str] News source. (provider: fmp, tiingo) - company : Optional[Dict[str, Any]] - Company details related to the news article. (provider: intrinio) + source : Optional[str] + The source of the news article. (provider: intrinio) + summary : Optional[str] + The summary of the news article. (provider: intrinio) + topics : Optional[str] + The topics related to the news article. (provider: intrinio) + word_count : Optional[int] + The word count of the news article. (provider: intrinio) + business_relevance : Optional[float] + How strongly correlated the news article is to the business (provider: intrinio) + sentiment : Optional[str] + The sentiment of the news article - i.e, negative, positive. (provider: intrinio) + sentiment_confidence : Optional[float] + The confidence score of the sentiment rating. (provider: intrinio) + language : Optional[str] + The language of the news article. (provider: intrinio) + spam : Optional[bool] + Whether the news article is spam. (provider: intrinio) + copyright : Optional[str] + The copyright notice of the news article. (provider: intrinio) + company : Optional[IntrinioCompany] + The Intrinio Company object. Contains details company reference data. (provider: intrinio) + security : Optional[IntrinioSecurity] + The Intrinio Security object. Contains the security details related to the news article. (provider: intrinio) symbols : Optional[str] Ticker tagged in the fetched news. (provider: tiingo) article_id : Optional[int] diff --git a/openbb_platform/openbb/package/regulators_sec.py b/openbb_platform/openbb/package/regulators_sec.py deleted file mode 100644 index b0d674356e83..000000000000 --- a/openbb_platform/openbb/package/regulators_sec.py +++ /dev/null @@ -1,489 +0,0 @@ -### THIS FILE IS AUTO-GENERATED. DO NOT EDIT. ### - -from typing import Literal, Optional - -from openbb_core.app.model.field import OpenBBField -from openbb_core.app.model.obbject import OBBject -from openbb_core.app.static.container import Container -from openbb_core.app.static.utils.decorators import exception_handler, validate -from openbb_core.app.static.utils.filters import filter_inputs -from typing_extensions import Annotated - - -class ROUTER_regulators_sec(Container): - """/regulators/sec - cik_map - institutions_search - rss_litigation - schema_files - sic_search - symbol_map - """ - - def __repr__(self) -> str: - return self.__doc__ or "" - - @exception_handler - @validate - def cik_map( - self, - symbol: Annotated[str, OpenBBField(description="Symbol to get data for.")], - provider: Annotated[ - Optional[Literal["sec"]], - OpenBBField( - description="The provider to use for the query, by default None.\n If None, the provider specified in defaults is selected or 'sec' if there is\n no default." - ), - ] = None, - **kwargs - ) -> OBBject: - """Map a ticker symbol to a CIK number. - - Parameters - ---------- - symbol : str - Symbol to get data for. - provider : Optional[Literal['sec']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'sec' if there is - no default. - use_cache : Optional[bool] - Whether or not to use cache for the request, default is True. (provider: sec) - - Returns - ------- - OBBject - results : CikMap - Serializable results. - provider : Optional[Literal['sec']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra : Dict[str, Any] - Extra info. - - CikMap - ------ - cik : Optional[Union[int, str]] - Central Index Key (CIK) for the requested entity. - - Examples - -------- - >>> from openbb import obb - >>> obb.regulators.sec.cik_map(symbol='MSFT', provider='sec') - """ # noqa: E501 - - return self._run( - "/regulators/sec/cik_map", - **filter_inputs( - provider_choices={ - "provider": self._get_provider( - provider, - "/regulators/sec/cik_map", - ("sec",), - ) - }, - standard_params={ - "symbol": symbol, - }, - extra_params=kwargs, - ) - ) - - @exception_handler - @validate - def institutions_search( - self, - query: Annotated[str, OpenBBField(description="Search query.")] = "", - use_cache: Annotated[ - Optional[bool], - OpenBBField( - description="Whether or not to use cache. If True, cache will store for seven days." - ), - ] = True, - provider: Annotated[ - Optional[Literal["sec"]], - OpenBBField( - description="The provider to use for the query, by default None.\n If None, the provider specified in defaults is selected or 'sec' if there is\n no default." - ), - ] = None, - **kwargs - ) -> OBBject: - """Search SEC-regulated institutions by name and return a list of results with CIK numbers. - - Parameters - ---------- - query : str - Search query. - use_cache : Optional[bool] - Whether or not to use cache. - provider : Optional[Literal['sec']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'sec' if there is - no default. - - Returns - ------- - OBBject - results : List[InstitutionsSearch] - Serializable results. - provider : Optional[Literal['sec']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra : Dict[str, Any] - Extra info. - - InstitutionsSearch - ------------------ - name : Optional[str] - The name of the institution. (provider: sec) - cik : Optional[Union[str, int]] - Central Index Key (CIK) (provider: sec) - - Examples - -------- - >>> from openbb import obb - >>> obb.regulators.sec.institutions_search(provider='sec') - >>> obb.regulators.sec.institutions_search(query='blackstone real estate', provider='sec') - """ # noqa: E501 - - return self._run( - "/regulators/sec/institutions_search", - **filter_inputs( - provider_choices={ - "provider": self._get_provider( - provider, - "/regulators/sec/institutions_search", - ("sec",), - ) - }, - standard_params={ - "query": query, - "use_cache": use_cache, - }, - extra_params=kwargs, - ) - ) - - @exception_handler - @validate - def rss_litigation( - self, - provider: Annotated[ - Optional[Literal["sec"]], - OpenBBField( - description="The provider to use for the query, by default None.\n If None, the provider specified in defaults is selected or 'sec' if there is\n no default." - ), - ] = None, - **kwargs - ) -> OBBject: - """Get the RSS feed that provides links to litigation releases concerning civil lawsuits brought by the Commission in federal court. - - Parameters - ---------- - provider : Optional[Literal['sec']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'sec' if there is - no default. - - Returns - ------- - OBBject - results : List[RssLitigation] - Serializable results. - provider : Optional[Literal['sec']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra : Dict[str, Any] - Extra info. - - RssLitigation - ------------- - published : Optional[datetime] - The date of publication. (provider: sec) - title : Optional[str] - The title of the release. (provider: sec) - summary : Optional[str] - Short summary of the release. (provider: sec) - id : Optional[str] - The identifier associated with the release. (provider: sec) - link : Optional[str] - URL to the release. (provider: sec) - - Examples - -------- - >>> from openbb import obb - >>> obb.regulators.sec.rss_litigation(provider='sec') - """ # noqa: E501 - - return self._run( - "/regulators/sec/rss_litigation", - **filter_inputs( - provider_choices={ - "provider": self._get_provider( - provider, - "/regulators/sec/rss_litigation", - ("sec",), - ) - }, - standard_params={}, - extra_params=kwargs, - ) - ) - - @exception_handler - @validate - def schema_files( - self, - query: Annotated[str, OpenBBField(description="Search query.")] = "", - use_cache: Annotated[ - Optional[bool], - OpenBBField( - description="Whether or not to use cache. If True, cache will store for seven days." - ), - ] = True, - provider: Annotated[ - Optional[Literal["sec"]], - OpenBBField( - description="The provider to use for the query, by default None.\n If None, the provider specified in defaults is selected or 'sec' if there is\n no default." - ), - ] = None, - **kwargs - ) -> OBBject: - """Use tool for navigating the directory of SEC XML schema files by year. - - Parameters - ---------- - query : str - Search query. - use_cache : Optional[bool] - Whether or not to use cache. - provider : Optional[Literal['sec']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'sec' if there is - no default. - url : Optional[str] - Enter an optional URL path to fetch the next level. (provider: sec) - - Returns - ------- - OBBject - results : SchemaFiles - Serializable results. - provider : Optional[Literal['sec']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra : Dict[str, Any] - Extra info. - - SchemaFiles - ----------- - files : Optional[List[str]] - Dictionary of URLs to SEC Schema Files (provider: sec) - - Examples - -------- - >>> from openbb import obb - >>> obb.regulators.sec.schema_files(provider='sec') - >>> # Get a list of schema files. - >>> data = obb.regulators.sec.schema_files().results - >>> data.files[0] - >>> 'https://xbrl.fasb.org/us-gaap/' - >>> # The directory structure can be navigated by constructing a URL from the 'results' list. - >>> url = data.files[0]+data.files[-1] - >>> # The URL base will always be the 0 position in the list, feed the URL back in as a parameter. - >>> obb.regulators.sec.schema_files(url=url).results.files - >>> ['https://xbrl.fasb.org/us-gaap/2024/' - >>> 'USGAAP2024FileList.xml' - >>> 'dis/' - >>> 'dqcrules/' - >>> 'ebp/' - >>> 'elts/' - >>> 'entire/' - >>> 'meta/' - >>> 'stm/' - >>> 'us-gaap-2024.zip'] - """ # noqa: E501 - - return self._run( - "/regulators/sec/schema_files", - **filter_inputs( - provider_choices={ - "provider": self._get_provider( - provider, - "/regulators/sec/schema_files", - ("sec",), - ) - }, - standard_params={ - "query": query, - "use_cache": use_cache, - }, - extra_params=kwargs, - ) - ) - - @exception_handler - @validate - def sic_search( - self, - query: Annotated[str, OpenBBField(description="Search query.")] = "", - use_cache: Annotated[ - Optional[bool], - OpenBBField( - description="Whether or not to use cache. If True, cache will store for seven days." - ), - ] = True, - provider: Annotated[ - Optional[Literal["sec"]], - OpenBBField( - description="The provider to use for the query, by default None.\n If None, the provider specified in defaults is selected or 'sec' if there is\n no default." - ), - ] = None, - **kwargs - ) -> OBBject: - """Search for Industry Titles, Reporting Office, and SIC Codes. An empty query string returns all results. - - Parameters - ---------- - query : str - Search query. - use_cache : Optional[bool] - Whether or not to use cache. - provider : Optional[Literal['sec']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'sec' if there is - no default. - - Returns - ------- - OBBject - results : List[SicSearch] - Serializable results. - provider : Optional[Literal['sec']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra : Dict[str, Any] - Extra info. - - SicSearch - --------- - sic : Optional[int] - Sector Industrial Code (SIC) (provider: sec) - industry : Optional[str] - Industry title. (provider: sec) - office : Optional[str] - Reporting office within the Corporate Finance Office (provider: sec) - - Examples - -------- - >>> from openbb import obb - >>> obb.regulators.sec.sic_search(provider='sec') - >>> obb.regulators.sec.sic_search(query='real estate investment trusts', provider='sec') - """ # noqa: E501 - - return self._run( - "/regulators/sec/sic_search", - **filter_inputs( - provider_choices={ - "provider": self._get_provider( - provider, - "/regulators/sec/sic_search", - ("sec",), - ) - }, - standard_params={ - "query": query, - "use_cache": use_cache, - }, - extra_params=kwargs, - ) - ) - - @exception_handler - @validate - def symbol_map( - self, - query: Annotated[str, OpenBBField(description="Search query.")], - use_cache: Annotated[ - Optional[bool], - OpenBBField( - description="Whether or not to use cache. If True, cache will store for seven days." - ), - ] = True, - provider: Annotated[ - Optional[Literal["sec"]], - OpenBBField( - description="The provider to use for the query, by default None.\n If None, the provider specified in defaults is selected or 'sec' if there is\n no default." - ), - ] = None, - **kwargs - ) -> OBBject: - """Map a CIK number to a ticker symbol, leading 0s can be omitted or included. - - Parameters - ---------- - query : str - Search query. - use_cache : Optional[bool] - Whether or not to use cache. If True, cache will store for seven days. - provider : Optional[Literal['sec']] - The provider to use for the query, by default None. - If None, the provider specified in defaults is selected or 'sec' if there is - no default. - - Returns - ------- - OBBject - results : SymbolMap - Serializable results. - provider : Optional[Literal['sec']] - Provider name. - warnings : Optional[List[Warning_]] - List of warnings. - chart : Optional[Chart] - Chart object. - extra : Dict[str, Any] - Extra info. - - SymbolMap - --------- - symbol : Optional[str] - Symbol representing the entity requested in the data. (provider: sec) - - Examples - -------- - >>> from openbb import obb - >>> obb.regulators.sec.symbol_map(query='0000789019', provider='sec') - """ # noqa: E501 - - return self._run( - "/regulators/sec/symbol_map", - **filter_inputs( - provider_choices={ - "provider": self._get_provider( - provider, - "/regulators/sec/symbol_map", - ("sec",), - ) - }, - standard_params={ - "query": query, - "use_cache": use_cache, - }, - extra_params=kwargs, - ) - ) diff --git a/openbb_platform/providers/government_us/openbb_government_us/models/treasury_prices.py b/openbb_platform/providers/government_us/openbb_government_us/models/treasury_prices.py index 8892cfd770be..3fb167bf1e9b 100644 --- a/openbb_platform/providers/government_us/openbb_government_us/models/treasury_prices.py +++ b/openbb_platform/providers/government_us/openbb_government_us/models/treasury_prices.py @@ -2,7 +2,7 @@ # pylint: disable=unused-argument import asyncio -from datetime import datetime, timedelta +from datetime import date, timedelta from io import StringIO from typing import Any, Dict, List, Literal, Optional @@ -45,18 +45,14 @@ def transform_query( params: Dict[str, Any] ) -> GovernmentUSTreasuryPricesQueryParams: """Transform query params.""" + yesterday = date.today() - timedelta(days=1) + last_bd = ( + yesterday - timedelta(yesterday.weekday() - 4) + if yesterday.weekday() > 4 + else yesterday + ) if params.get("date") is None: - _date = datetime.now().date() - else: - _date = ( - datetime.strptime(params["date"], "%Y-%m-%d").date() - if isinstance(params["date"], str) - else params["date"] - ) - if _date.weekday() > 4: - _date = _date - timedelta(days=_date.weekday() - 4) - params["date"] = _date - + params["date"] = last_bd return GovernmentUSTreasuryPricesQueryParams(**params) # pylint: disable=unused-argument diff --git a/openbb_platform/providers/polygon/openbb_polygon/models/currency_pairs.py b/openbb_platform/providers/polygon/openbb_polygon/models/currency_pairs.py index 965878c06c3b..6662b4026556 100644 --- a/openbb_platform/providers/polygon/openbb_polygon/models/currency_pairs.py +++ b/openbb_platform/providers/polygon/openbb_polygon/models/currency_pairs.py @@ -52,7 +52,7 @@ class PolygonCurrencyPairsQueryParams(CurrencyPairsQueryParams): "last_updated_utc", "delisted_utc", ] - ] = Field(default="", description="Sort field used for ordering.") + ] = Field(default=None, description="Sort field used for ordering.") limit: Optional[PositiveInt] = Field( default=1000, description=QUERY_DESCRIPTIONS.get("limit", "") ) @@ -106,9 +106,8 @@ def transform_query(params: Dict[str, Any]) -> PolygonCurrencyPairsQueryParams: """Transform the query parameters. Ticker is set if symbol is provided.""" transform_params = params now = datetime.now().date().isoformat() - transform_params["symbol"] = ( - f"ticker=C:{params.get('symbol').upper()}" if params.get("symbol") else "" - ) + symbol = params.get("symbol") + transform_params["symbol"] = f"ticker=C:{symbol.upper()}" if symbol else "" if params.get("date") is None: transform_params["date"] = now diff --git a/openbb_platform/providers/sec/openbb_sec/models/form_13FHR.py b/openbb_platform/providers/sec/openbb_sec/models/form_13FHR.py index 2fe075650b2c..cc9428ef2e48 100644 --- a/openbb_platform/providers/sec/openbb_sec/models/form_13FHR.py +++ b/openbb_platform/providers/sec/openbb_sec/models/form_13FHR.py @@ -64,6 +64,7 @@ async def aextract_data( urls = filings.iloc[: query.limit].to_list() if query.date is not None: date = parse_13f.date_to_quarter_end(query.date.strftime("%Y-%m-%d")) + filings.index = filings.index.astype(str) urls = [filings.loc[date]] results = [] diff --git a/openbb_platform/providers/sec/openbb_sec/models/rss_litigation.py b/openbb_platform/providers/sec/openbb_sec/models/rss_litigation.py index a83dd9fcb237..67444f79ac25 100644 --- a/openbb_platform/providers/sec/openbb_sec/models/rss_litigation.py +++ b/openbb_platform/providers/sec/openbb_sec/models/rss_litigation.py @@ -60,7 +60,7 @@ def extract_data( ["title", "link", "description", "pubDate", "dc:creator"] ] feed.columns = cols - feed["date"] = pd.to_datetime(feed["date"]) + feed["date"] = pd.to_datetime(feed["date"], format="mixed") feed = feed.set_index("date") # Remove special characters for column in ["title", "summary"]: diff --git a/openbb_platform/providers/sec/pyproject.toml b/openbb_platform/providers/sec/pyproject.toml index 4609f97fa5a7..545475ea31f0 100644 --- a/openbb_platform/providers/sec/pyproject.toml +++ b/openbb_platform/providers/sec/pyproject.toml @@ -11,6 +11,7 @@ python = ">=3.8,<3.12" openbb-core = "^1.1.6" requests-cache = "^1.1.0" xmltodict = "^0.13.0" +lxml = "^5.2.1" [build-system] requires = ["poetry-core"] diff --git a/openbb_platform/providers/tmx/openbb_tmx/models/treasury_prices.py b/openbb_platform/providers/tmx/openbb_tmx/models/treasury_prices.py index 76375fed8463..2f0543aa968e 100644 --- a/openbb_platform/providers/tmx/openbb_tmx/models/treasury_prices.py +++ b/openbb_platform/providers/tmx/openbb_tmx/models/treasury_prices.py @@ -1,9 +1,8 @@ -"""TMX Treasury Prices Fetcher""" +"""TMX Treasury Prices Fetcher.""" # pylint: disable=unused-argument from datetime import ( date as dateType, - datetime, timedelta, ) from typing import Any, Dict, List, Literal, Optional @@ -19,8 +18,7 @@ class TmxTreasuryPricesQueryParams(TreasuryPricesQueryParams): - """ - TMX Treasury Prices Query Params. + """TMX Treasury Prices Query Params. Data will be made available by 5:00 EST on T+1 @@ -99,13 +97,14 @@ class TmxTreasuryPricesFetcher( def transform_query(params: Dict[str, Any]) -> TmxTreasuryPricesQueryParams: """Transform query params.""" transformed_params = params.copy() - now = datetime.now() - if now.date().weekday() > 4: - now = now - timedelta(now.date().weekday() - 4) + yesterday = dateType.today() - timedelta(days=1) + last_bd = ( + yesterday - timedelta(yesterday.weekday() - 4) + if yesterday.weekday() > 4 + else yesterday + ) if "maturity_date_min" not in transformed_params: - transformed_params["maturity_date_min"] = ( - now - timedelta(days=1) - ).strftime("%Y-%m-%d") + transformed_params["maturity_date_min"] = last_bd return TmxTreasuryPricesQueryParams(**transformed_params) @staticmethod