diff options
6 files changed, 304 insertions, 16 deletions
diff --git a/openbb_platform/extensions/econometrics/openbb_econometrics/econometrics_router.py b/openbb_platform/extensions/econometrics/openbb_econometrics/econometrics_router.py index f4c8f48386e..ce96a825c36 100644 --- a/openbb_platform/extensions/econometrics/openbb_econometrics/econometrics_router.py +++ b/openbb_platform/extensions/econometrics/openbb_econometrics/econometrics_router.py @@ -1,5 +1,7 @@ """Econometrics Router.""" +# pylint: disable=unused-argument + import re from itertools import combinations from typing import Dict, List, Literal @@ -43,7 +45,10 @@ router = Router(prefix="") APIEx(parameters={"data": APIEx.mock_data("timeseries")}), ], ) -def correlation_matrix(data: List[Data]) -> OBBject[List[Data]]: +def correlation_matrix( + data: List[Data], + **extra_params, +) -> OBBject[List[Data]]: """Get the correlation matrix of an input dataset. The correlation matrix provides a view of how different variables in your dataset relate to one another. @@ -55,6 +60,9 @@ def correlation_matrix(data: List[Data]) -> OBBject[List[Data]]: ---------- data : List[Data] Input dataset. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -101,6 +109,7 @@ def ols_regression( data: List[Data], y_column: str, x_columns: List[str], + **extra_params, ) -> OBBject[Dict]: """Perform Ordinary Least Squares (OLS) regression. @@ -117,6 +126,9 @@ def ols_regression( Target column. x_columns: List[str] List of columns to use as exogenous variables. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -153,6 +165,7 @@ def ols_regression_summary( data: List[Data], y_column: str, x_columns: List[str], + **extra_params, ) -> OBBject[Data]: """Perform Ordinary Least Squares (OLS) regression. @@ -166,6 +179,9 @@ def ols_regression_summary( Target column. x_columns: List[str] List of columns to use as exogenous variables. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -238,6 +254,7 @@ def autocorrelation( data: List[Data], y_column: str, x_columns: List[str], + **extra_params, ) -> OBBject[Data]: """Perform Durbin-Watson test for autocorrelation. @@ -257,6 +274,9 @@ def autocorrelation( Target column. x_columns: List[str] List of columns to use as exogenous variables. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -293,6 +313,7 @@ def residual_autocorrelation( y_column: str, x_columns: List[str], lags: PositiveInt = 1, + **extra_params, ) -> OBBject[Data]: """Perform Breusch-Godfrey Lagrange Multiplier tests for residual autocorrelation. @@ -314,6 +335,9 @@ def residual_autocorrelation( List of columns to use as exogenous variables. lags: PositiveInt Number of lags to use in the test. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -351,6 +375,7 @@ def residual_autocorrelation( def cointegration( data: List[Data], columns: List[str], + **extra_params, ) -> OBBject[Data]: """Show co-integration between two timeseries using the two step Engle-Granger test. @@ -371,6 +396,9 @@ def cointegration( Data columns to check cointegration maxlag: PositiveInt Number of lags to use in the test. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -426,6 +454,7 @@ def causality( y_column: str, x_column: str, lag: PositiveInt = 3, + **extra_params, ) -> OBBject[Data]: """Perform Granger causality test to determine if X 'causes' y. @@ -447,6 +476,9 @@ def causality( Columns to use as exogenous variables. lag: PositiveInt Number of lags to use in the test. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -494,6 +526,7 @@ def unit_root( data: List[Data], column: str, regression: Literal["c", "ct", "ctt"] = "c", + **extra_params, ) -> OBBject[Data]: """Perform Augmented Dickey-Fuller (ADF) unit root test. @@ -515,6 +548,9 @@ def unit_root( regression: Literal["c", "ct", "ctt"] Regression type to use in the test. Either "c" for constant only, "ct" for constant and trend, or "ctt" for constant, trend, and trend-squared. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -549,6 +585,7 @@ def panel_random_effects( data: List[Data], y_column: str, x_columns: List[str], + **extra_params, ) -> OBBject[Dict]: """Perform One-way Random Effects model for panel data. @@ -565,6 +602,9 @@ def panel_random_effects( Target column. x_columns: List[str] List of columns to use as exogenous variables. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -596,6 +636,7 @@ def panel_between( data: List[Data], y_column: str, x_columns: List[str], + **extra_params, ) -> OBBject[Dict]: """Perform a Between estimator regression on panel data. @@ -612,6 +653,9 @@ def panel_between( Target column. x_columns: List[str] List of columns to use as exogenous variables. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -641,6 +685,7 @@ def panel_pooled( data: List[Data], y_column: str, x_columns: List[str], + **extra_params, ) -> OBBject[Dict]: """Perform a Pooled coefficient estimator regression on panel data. @@ -658,6 +703,9 @@ def panel_pooled( Target column. x_columns: List[str] List of columns to use as exogenous variables. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -687,6 +735,7 @@ def panel_fixed( data: List[Data], y_column: str, x_columns: List[str], + **extra_params, ) -> OBBject[Dict]: """One- and two-way fixed effects estimator for panel data. @@ -703,6 +752,9 @@ def panel_fixed( Target column. x_columns: List[str] List of columns to use as exogenous variables. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -732,6 +784,7 @@ def panel_first_difference( data: List[Data], y_column: str, x_columns: List[str], + **extra_params, ) -> OBBject[Dict]: """Perform a first-difference estimate for panel data. @@ -748,6 +801,9 @@ def panel_first_difference( Target column. x_columns: List[str] List of columns to use as exogenous variables. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -777,6 +833,7 @@ def panel_fmac( data: List[Data], y_column: str, x_columns: List[str], + **extra_params, ) -> OBBject[Dict]: """Fama-MacBeth estimator for panel data. @@ -794,6 +851,9 @@ def panel_fmac( Target column. x_columns: List[str] List of columns to use as exogenous variables. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- diff --git a/openbb_platform/extensions/quantitative/openbb_quantitative/performance/performance_router.py b/openbb_platform/extensions/quantitative/openbb_quantitative/performance/performance_router.py index 025df52bb20..1f3fddf6b4b 100644 --- a/openbb_platform/extensions/quantitative/openbb_quantitative/performance/performance_router.py +++ b/openbb_platform/extensions/quantitative/openbb_quantitative/performance/performance_router.py @@ -1,3 +1,7 @@ +"""Quantitative Performance Router.""" + +# pylint: disable=unused-argument + from typing import List import numpy as np @@ -47,6 +51,7 @@ def omega_ratio( target: str, threshold_start: float = 0.0, threshold_end: float = 1.5, + **extra_params, ) -> OBBject[List[OmegaModel]]: """Calculate the Omega Ratio. @@ -64,6 +69,9 @@ def omega_ratio( Start threshold, by default 0.0 threshold_end : float, optional End threshold, by default 1.5 + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -122,6 +130,7 @@ def sharpe_ratio( rfr: float = 0.0, window: PositiveInt = 252, index: str = "date", + **extra_params, ) -> OBBject[List[Data]]: """Get Rolling Sharpe Ratio. @@ -143,6 +152,9 @@ def sharpe_ratio( window : PositiveInt, optional Window size, by default 252 index : str, optional + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -193,6 +205,7 @@ def sortino_ratio( window: PositiveInt = 252, adjusted: bool = False, index: str = "date", + **extra_params, ) -> OBBject[List[Data]]: """Get rolling Sortino Ratio. @@ -222,6 +235,10 @@ def sortino_ratio( Adjust sortino ratio to compare it to sharpe ratio, by default False index:str Index column for input data + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. + Returns ------- OBBject[List[Data]] diff --git a/openbb_platform/extensions/quantitative/openbb_quantitative/quantitative_router.py b/openbb_platform/extensions/quantitative/openbb_quantitative/quantitative_router.py index 0065ec62011..3b5ff224047 100644 --- a/openbb_platform/extensions/quantitative/openbb_quantitative/quantitative_router.py +++ b/openbb_platform/extensions/quantitative/openbb_quantitative/quantitative_router.py @@ -1,5 +1,7 @@ """Quantitative Analysis Router.""" +# pylint: disable=unused-argument + from typing import List, Literal import pandas as pd @@ -49,7 +51,11 @@ router.include_router(performance_router) APIEx(parameters={"target": "close", "data": APIEx.mock_data("timeseries", 8)}), ], ) -def normality(data: List[Data], target: str) -> OBBject[NormalityModel]: +def normality( + data: List[Data], + target: str, + **extra_params, +) -> OBBject[NormalityModel]: """Get Normality Statistics. - **Kurtosis**: whether the kurtosis of a sample differs from the normal distribution. @@ -64,6 +70,9 @@ def normality(data: List[Data], target: str) -> OBBject[NormalityModel]: Time series data. target : str Target column name. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -107,7 +116,11 @@ def normality(data: List[Data], target: str) -> OBBject[NormalityModel]: ), ], ) -def capm(data: List[Data], target: str) -> OBBject[CAPMModel]: +def capm( + data: List[Data], + target: str, + **extra_params, +) -> OBBject[CAPMModel]: """Get Capital Asset Pricing Model (CAPM). CAPM offers a streamlined way to assess the expected return on an investment while accounting for its risk relative @@ -120,6 +133,9 @@ def capm(data: List[Data], target: str) -> OBBject[CAPMModel]: Time series data. target : str Target column name. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -175,6 +191,7 @@ def unitroot_test( target: str, fuller_reg: Literal["c", "ct", "ctt", "nc", "c"] = "c", kpss_reg: Literal["c", "ct"] = "c", + **extra_params, ) -> OBBject[UnitRootModel]: """Get Unit Root Test. @@ -196,6 +213,9 @@ def unitroot_test( Regression type for ADF test. kpss_reg : Literal["c", "ct"] Regression type for KPSS test. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -241,7 +261,11 @@ def unitroot_test( APIEx(parameters={"target": "close", "data": APIEx.mock_data("timeseries", 5)}), ], ) -def summary(data: List[Data], target: str) -> OBBject[SummaryModel]: +def summary( + data: List[Data], + target: str, + **extra_params, +) -> OBBject[SummaryModel]: """Get Summary Statistics. The summary that offers a snapshot of its central tendencies, variability, and distribution. @@ -257,6 +281,9 @@ def summary(data: List[Data], target: str) -> OBBject[SummaryModel]: Time series data. target : str Target column name. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- diff --git a/openbb_platform/extensions/quantitative/openbb_quantitative/rolling/rolling_router.py b/openbb_platform/extensions/quantitative/openbb_quantitative/rolling/rolling_router.py index 34ef9be67a1..df6f3897ea3 100644 --- a/openbb_platform/extensions/quantitative/openbb_quantitative/rolling/rolling_router.py +++ b/openbb_platform/extensions/quantitative/openbb_quantitative/rolling/rolling_router.py @@ -1,5 +1,7 @@ """Rolling submenu of quantitative models for rolling statistics.""" +# pylint: disable=unused-argument + from typing import List import pandas as pd @@ -49,7 +51,11 @@ router = Router(prefix="/rolling") ], ) def skew( - data: List[Data], target: str, window: PositiveInt = 21, index: str = "date" + data: List[Data], + target: str, + window: PositiveInt = 21, + index: str = "date", + **extra_params, ) -> OBBject[List[Data]]: """Get Rolling Skew. @@ -69,6 +75,9 @@ def skew( Window size. index : str, optional Index column name, by default "date" + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -112,7 +121,11 @@ def skew( ], ) def variance( - data: List[Data], target: str, window: PositiveInt = 21, index: str = "date" + data: List[Data], + target: str, + window: PositiveInt = 21, + index: str = "date", + **extra_params, ) -> OBBject[List[Data]]: """ Calculate the rolling variance of a target column within a given window size. @@ -130,6 +143,9 @@ def variance( The number of observations used for calculating the rolling measure. index: str, optional The name of the index column, default is "date". + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -170,7 +186,11 @@ def variance( ], ) def stdev( - data: List[Data], target: str, window: PositiveInt = 21, index: str = "date" + data: List[Data], + target: str, + window: PositiveInt = 21, + index: str = "date", + **extra_params, ) -> OBBject[List[Data]]: """ Calculate the rolling standard deviation of a target column within a given window size. @@ -189,6 +209,9 @@ def stdev( The number of observations used for calculating the rolling measure. index: str, optional The name of the index column, default is "date". + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -231,7 +254,11 @@ def stdev( ], ) def kurtosis( - data: List[Data], target: str, window: PositiveInt = 21, index: str = "date" + data: List[Data], + target: str, + window: PositiveInt = 21, + index: str = "date", + **extra_params, ) -> OBBject[List[Data]]: """ Calculate the rolling kurtosis of a target column within a given window size. @@ -252,6 +279,9 @@ def kurtosis( The number of observations used for calculating the rolling measure. index: str, optional The name of the index column, default is "date". + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -300,6 +330,7 @@ def quantile( window: PositiveInt = 21, quantile_pct: NonNegativeFloat = 0.5, index: str = "date", + **extra_params, ) -> OBBject[List[Data]]: """ Calculate the rolling quantile of a target column within a given window size at a specified quantile percentage. @@ -320,6 +351,9 @@ def quantile( The quantile percentage to calculate (e.g., 0.5 for median), default is 0.5. index: str, optional The name of the index column, default is "date". + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -374,7 +408,11 @@ def quantile( ], ) def mean( - data: List[Data], target: str, window: PositiveInt = 21, index: str = "date" + data: List[Data], + target: str, + window: PositiveInt = 21, + index: str = "date", + **extra_params, ) -> OBBject[List[Data]]: """ Calculate the rolling mean (average) of a target column within a given window size. @@ -393,6 +431,9 @@ def mean( The number of observations used for calculating the rolling measure. index: str, optional The name of the index column, default is "date". + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- diff --git a/openbb_platform/extensions/quantitative/openbb_quantitative/stats/stats_router.py b/openbb_platform/extensions/quantitative/openbb_quantitative/stats/stats_router.py index 68be4b675cf..a69f69923a0 100644 --- a/openbb_platform/extensions/quantitative/openbb_quantitative/stats/stats_router.py +++ b/openbb_platform/extensions/quantitative/openbb_quantitative/stats/stats_router.py @@ -49,6 +49,7 @@ router = Router(prefix="/stats") def skew( data: List[Data], target: str, + **extra_params, ) -> OBBject[List[Data]]: """Get the skew of the data set. @@ -64,6 +65,9 @@ def skew( Time series data. target : str Target column name. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -100,7 +104,11 @@ def skew( ), ], ) -def variance(data: List[Data], target: str) -> OBBject[List[Data]]: +def variance( + data: List[Data], + target: str, + **extra_params, +) -> OBBject[List[Data]]: """ Calculate the variance of a target column. @@ -113,6 +121,9 @@ def variance(data: List[Data], target: str) -> OBBject[List[Data]]: The time series data as a list of data points. target: str The name of the column for which to calculate variance. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -149,7 +160,11 @@ def variance(data: List[Data], target: str) -> OBBject[List[Data]]: ), ], ) -def stdev(data: List[Data], target: str) -> OBBject[List[Data]]: +def stdev( + data: List[Data], + target: str, + **extra_params, +) -> OBBject[List[Data]]: """ Calculate the rolling standard deviation of a target column. @@ -163,6 +178,9 @@ def stdev(data: List[Data], target: str) -> OBBject[List[Data]]: The time series data as a list of data points. target: str The name of the column for which to calculate standard deviation. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -199,7 +217,11 @@ def stdev(data: List[Data], target: str) -> OBBject[List[Data]]: ), ], ) -def kurtosis(data: List[Data], target: str) -> OBBject[List[Data]]: +def kurtosis( + data: List[Data], + target: str, + **extra_params, +) -> OBBject[List[Data]]: """ Calculate the rolling kurtosis of a target column. @@ -214,6 +236,9 @@ def kurtosis(data: List[Data], target: str) -> OBBject[List[Data]]: The time series data as a list of data points. target: str The name of the column for which to calculate kurtosis. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -254,6 +279,7 @@ def quantile( data: List[Data], target: str, quantile_pct: NonNegativeFloat = 0.5, + **extra_params, ) -> OBBject[List[Data]]: """ Calculate the quantile of a target column at a specified quantile percentage. @@ -269,6 +295,9 @@ def quantile( The name of the column for which to calculate the quantile. quantile_pct: NonNegativeFloat, optional The quantile percentage to calculate (e.g., 0.5 for median), default is 0.5. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -311,6 +340,7 @@ def quantile( def mean( data: List[Data], target: str, + **extra_params, ) -> OBBject[List[Data]]: """ Calculate the mean (average) of a target column. @@ -325,6 +355,9 @@ def mean( The time series data as a list of data points. target: str The name of the column for which to calculate the mean. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- diff --git a/openbb_platform/extensions/technical/openbb_technical/technical_router.py b/openbb_platform/extensions/technical/openbb_technical/technical_router.py index e4faa20ef90..15170fa9f91 100644 --- a/openbb_platform/extensions/technical/openbb_technical/technical_router.py +++ b/openbb_platform/extensions/technical/openbb_technical/technical_router.py @@ -1,6 +1,7 @@ """Technical Analysis Router.""" -# pylint: disable=too-many-lines +# pylint: disable=too-many-lines, unused-argument + from typing import List, Literal, Optional import pandas as pd @@ -48,6 +49,7 @@ def atr( mamode: Literal["rma", "ema", "sma", "wma"] = "rma", drift: NonNegativeInt = 1, offset: int = 0, + **extra_params, ) -> OBBject[List[Data]]: """Calculate the Average True Range. @@ -73,7 +75,9 @@ def atr( The difference period, by default 1 offset : int, optional How many periods to offset the result, by default 0 - + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- OBBject[List[Data]] @@ -112,6 +116,7 @@ def fib( period: PositiveInt = 120, start_date: Optional[str] = None, end_date: Optional[str] = None, + **extra_params, ) -> OBBject[List[Data]]: """Create Fibonacci Retracement Levels. @@ -129,6 +134,9 @@ def fib( Index column name, by default "date" period : PositiveInt, optional Period to calculate the indicator, by default 120 + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -180,6 +188,7 @@ def obv( data: List[Data], index: str = "date", offset: int = 0, + **extra_params, ) -> OBBject[List[Data]]: """Calculate the On Balance Volume (OBV). @@ -200,6 +209,9 @@ def obv( Index column name, by default "date" offset : int, optional How many periods to offset the result, by default 0. + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -234,6 +246,7 @@ def fisher( index: str = "date", length: PositiveInt = 14, signal: PositiveInt = 1, + **extra_params, ) -> OBBject[List[Data]]: """Perform the Fisher Transform. @@ -253,6 +266,9 @@ def fisher( Fisher period, by default 14 signal : PositiveInt, optional Fisher Signal period, by default 1 + **extra_params : Optional[Dict[str, Any]] + Extra parameters to be passed to the command execution. + API POST requests are sent in the body with data. Returns ------- @@ -289,6 +305,7 @@ def adosc( fast: PositiveInt = 3, slow: PositiveInt = 10, offset: int = 0, + **extra_params, ) -> OBBject[List[Data]]: """Calculate the Accumulation/Distribution Oscillator. @@ -311,6 +328,9 @@ def adosc( Number of periods to be used for the slow calculation, by default 10. offset : int, optional Offset to be used for the calculation, by default 0. + **extra_params : Optional[Dict[str, Any]] + |