Merge branch 'develop' into feature/openbb-sdk-v4

This commit is contained in:
Igor Radovanovic
2023-08-09 13:40:49 +02:00
committed by GitHub
5 changed files with 113 additions and 123 deletions

View File

@@ -282,8 +282,8 @@ def display_redditsent(
Optionally specify the name of the sheet the data is exported to.
export: str
Format to export data
external_axes: Optional[List[plt.Axes]]
If supplied, expect 1 external axis
external_axes : bool, optional
Whether to return the figure object or not, by default False
"""
fig = OpenBBFigure()

View File

@@ -975,8 +975,8 @@ def display_yield_curve(
----------
date: str
Date to get curve for. If None, gets most recent date (format yyyy-mm-dd)
external_axes : Optional[List[plt.Axes]], optional
External axes (1 axis is expected in the list), by default None
external_axes : bool, optional
Whether to return the figure object or not, by default False
raw : bool
Output only raw data
export : str

View File

@@ -48,72 +48,67 @@ def display_brnn_forecast(
) -> Union[OpenBBFigure, None]:
"""Display BRNN forecast
Parameters
----------
data: Union[pd.Series, pd.DataFrame]
Input Data
target_column: str
Target column to forecast. Defaults to "close".
dataset_name: str
The name of the ticker to be predicted
n_predict: int
Days to predict. Defaults to 5.
train_split: float
Train/val split. Defaults to 0.85.
past_covariates: str
Multiple secondary columns to factor in when forecasting. Defaults to None.
forecast_horizon: int
Forecast horizon when performing historical forecasting. Defaults to 5.
input_chunk_length: int
Number of past time steps that are fed to the forecasting module at prediction time. Defaults to 14.
output_chunk_length: int
The length of the forecast of the model. Defaults to 5.
model_type: str
Either a string specifying the RNN module type ("RNN", "LSTM" or "GRU"). Defaults to "LSTM".
n_rnn_layers: int
Number of layers in the RNN module. Defaults to 1.
dropout: float
Fraction of neurons affected by Dropout. Defaults to 0.0.
batch_size: int
Number of time series (input and output sequences) used in each training pass. Defaults to 32.
n_epochs: int
Number of epochs over which to train the model. Defaults to 101.
learning_rate: float
Defaults to 1e-3.
model_save_name: str
Name for model. Defaults to "brnn_model".
force_reset: bool
If set to True, any previously-existing model with the same name will be reset
(all checkpoints will be discarded). Defaults to True.
save_checkpoints: bool
Whether or not to automatically save the untrained model and checkpoints from training.
Defaults to True.
sheet_name: str
Optionally specify the name of the sheet the data is exported to.
export: str
Format to export data
residuals: bool
Whether to show residuals for the model. Defaults to False.
forecast_only: bool
Whether to only show dates in the forecasting range. Defaults to False.
start_date: Optional[datetime]
The starting date to perform analysis, data before this is trimmed. Defaults to None.
end_date: Optional[datetime]
The ending date to perform analysis, data after this is trimmed. Defaults to None.
naive: bool
Whether to show the naive baseline. This just assumes the closing price will be the same
as the previous day's closing price. Defaults to False.
<<<<<<< HEAD
external_axes : bool, optional
Whether to return the figure object or not, by default False
=======
export_pred_raw: bool
Whether to export the raw predicted values. Defaults to False.
metric: str
The metric to use for the model. Defaults to "mape".
external_axes: Optional[List[plt.axes]]
External axes to plot on
>>>>>>> OpenBBTerminal-main
Parameters
----------
data: Union[pd.Series, pd.DataFrame]
Input Data
target_column: str
Target column to forecast. Defaults to "close".
dataset_name: str
The name of the ticker to be predicted
n_predict: int
Days to predict. Defaults to 5.
train_split: float
Train/val split. Defaults to 0.85.
past_covariates: str
Multiple secondary columns to factor in when forecasting. Defaults to None.
forecast_horizon: int
Forecast horizon when performing historical forecasting. Defaults to 5.
input_chunk_length: int
Number of past time steps that are fed to the forecasting module at prediction time. Defaults to 14.
output_chunk_length: int
The length of the forecast of the model. Defaults to 5.
model_type: str
Either a string specifying the RNN module type ("RNN", "LSTM" or "GRU"). Defaults to "LSTM".
n_rnn_layers: int
Number of layers in the RNN module. Defaults to 1.
dropout: float
Fraction of neurons affected by Dropout. Defaults to 0.0.
batch_size: int
Number of time series (input and output sequences) used in each training pass. Defaults to 32.
n_epochs: int
Number of epochs over which to train the model. Defaults to 101.
learning_rate: float
Defaults to 1e-3.
model_save_name: str
Name for model. Defaults to "brnn_model".
force_reset: bool
If set to True, any previously-existing model with the same name will be reset
(all checkpoints will be discarded). Defaults to True.
save_checkpoints: bool
Whether or not to automatically save the untrained model and checkpoints from training.
Defaults to True.
sheet_name: str
Optionally specify the name of the sheet the data is exported to.
export: str
Format to export data
residuals: bool
Whether to show residuals for the model. Defaults to False.
forecast_only: bool
Whether to only show dates in the forecasting range. Defaults to False.
start_date: Optional[datetime]
The starting date to perform analysis, data before this is trimmed. Defaults to None.
end_date: Optional[datetime]
The ending date to perform analysis, data after this is trimmed. Defaults to None.
naive: bool
Whether to show the naive baseline. This just assumes the closing price will be the same
as the previous day's closing price. Defaults to False.
export_pred_raw: bool
Whether to export the raw predicted values. Defaults to False.
metric: str
The metric to use for the model. Defaults to "mape".
external_axes : bool, optional
Whether to return the figure object or not, by default False
"""
data = helpers.clean_data(
data, start_date, end_date, target_column, past_covariates

View File

@@ -41,57 +41,52 @@ def display_expo_forecast(
) -> Union[OpenBBFigure, None]:
"""Display Probabilistic Exponential Smoothing forecast
Parameters
----------
data : Union[pd.Series, np.array]
Data to forecast
dataset_name: str
The name of the ticker to be predicted
target_column: Optional[str]:
Target column to forecast. Defaults to "close".
trend: str
Trend component. One of [N, A, M]
Defaults to ADDITIVE.
seasonal: str
Seasonal component. One of [N, A, M]
Defaults to ADDITIVE.
seasonal_periods: int
Number of seasonal periods in a year
If not set, inferred from frequency of the series.
dampen: str
Dampen the function
n_predict: int
Number of days to forecast
start_window: float
Size of sliding window from start of timeseries and onwards
forecast_horizon: int
Number of days to forecast when backtesting and retraining historical
sheet_name: str
Optionally specify the name of the sheet the data is exported to.
export: str
Format to export data
residuals: bool
Whether to show residuals for the model. Defaults to False.
forecast_only: bool
Whether to only show dates in the forecasting range. Defaults to False.
start_date: Optional[datetime]
The starting date to perform analysis, data before this is trimmed. Defaults to None.
end_date: Optional[datetime]
The ending date to perform analysis, data after this is trimmed. Defaults to None.
naive: bool
Whether to show the naive baseline. This just assumes the closing price will be the same
as the previous day's closing price. Defaults to False.
<<<<<<< HEAD
external_axes : bool, optional
Whether to return the figure object or not, by default False
=======
export_pred_raw: bool
Whether to export the raw predicted values. Defaults to False.
metric: str
The metric to use when backtesting. Defaults to "mape".
external_axes: Optional[List[plt.axes]]
External axes to plot on
>>>>>>> OpenBBTerminal-main
Parameters
----------
data : Union[pd.Series, np.array]
Data to forecast
dataset_name: str
The name of the ticker to be predicted
target_column: Optional[str]:
Target column to forecast. Defaults to "close".
trend: str
Trend component. One of [N, A, M]
Defaults to ADDITIVE.
seasonal: str
Seasonal component. One of [N, A, M]
Defaults to ADDITIVE.
seasonal_periods: int
Number of seasonal periods in a year
If not set, inferred from frequency of the series.
dampen: str
Dampen the function
n_predict: int
Number of days to forecast
start_window: float
Size of sliding window from start of timeseries and onwards
forecast_horizon: int
Number of days to forecast when backtesting and retraining historical
sheet_name: str
Optionally specify the name of the sheet the data is exported to.
export: str
Format to export data
residuals: bool
Whether to show residuals for the model. Defaults to False.
forecast_only: bool
Whether to only show dates in the forecasting range. Defaults to False.
start_date: Optional[datetime]
The starting date to perform analysis, data before this is trimmed. Defaults to None.
end_date: Optional[datetime]
The ending date to perform analysis, data after this is trimmed. Defaults to None.
naive: bool
Whether to show the naive baseline. This just assumes the closing price will be the same
as the previous day's closing price. Defaults to False.
export_pred_raw: bool
Whether to export the raw predicted values. Defaults to False.
metric: str
The metric to use when backtesting. Defaults to "mape".
external_axes : bool, optional
Whether to return the figure object or not, by default False
"""
data = helpers.clean_data(data, start_date, end_date, target_column, None)
if not helpers.check_data(data, target_column, None):

View File

@@ -40,7 +40,7 @@ def get_data(
query_params = {
"all_feilds": "False",
"ordering": "-published_on,-share_of_article,-pagerank",
"ordering": "-published_on,-entity_score,-share_of_article,-pagerank",
}
if ticker:
query_params["ticker"] = ticker
@@ -70,7 +70,7 @@ def get_data(
query_params["offset"] = offset # type:ignore
response = requests.get(
"https://althub-backend.invisagealpha.com/api/OnclusiveSentiment/",
"https://data-access.althub.com/api/OnclusiveSentiment/",
headers=headers,
params=query_params,
timeout=5,