Skip to content

Commit

Permalink
Docs Fix (OpenBB-finance#3543)
Browse files Browse the repository at this point in the history
* Update generate_terminal_markdown.py

* updates

* update workflows

* Automated Change

* tests

* tests

* Automated Change

* Update test_generate_docs.py

* Automated Change

* updates

* Automated Change

* Update gen-docs.yml

* Update test.yml

* Automated Change

* Update test.yml

* Automated Change

* Update generate_sdk_markdown.py

* Automated Change

* test

* Automated Change

* testtt23

* Automated Change

* Update generate_sdk_markdown.py

* Automated Change

* Automated Change

* added empting reference folders before autogen docs

* updates

* Automated Change

* update tests gitactions

* Automated Change

* up

* Automated Change

* Automated Change

* update pytest

* Automated Change

* tests

* Automated Change

* examples update

* Automated Change

* Update generate_sdk_markdown.py

* Automated Change

* Update test.yml

* Update generate_sdk_markdown.py

* strip

* Automated Change

* Workflow : check test update

* Automated Change

* Automated Change

* Automated Change

* Update test.yml

* Automated Change

* Update test.yml

* Automated Change

* Automated Change

* up

* Automated Change

* Update generate_sdk_markdown.py

* Automated Change

* update workflows

* fix guides

* testing

* Update gh-pages.yml

* Update gh-pages.yml

Co-authored-by: tehcoderer <[email protected]>
Co-authored-by: Jeroen Bouma <[email protected]>
Co-authored-by: Chavithra PARANA <[email protected]>
Co-authored-by: Chavithra <[email protected]>
Co-authored-by: jose-donato <[email protected]>
Co-authored-by: jose-donato <[email protected]>
  • Loading branch information
7 people authored Nov 25, 2022
1 parent 55b1fac commit 7904660
Show file tree
Hide file tree
Showing 1,538 changed files with 31,818 additions and 14,656 deletions.
21 changes: 6 additions & 15 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ on:

jobs:
generate:
name: Generate documentation
name: Generate and Deploy documentation
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # actions/checkout v3.0.2
uses: actions/checkout@v3 # actions/checkout v3.0.2

- name: Setup Python 3.10
uses: actions/setup-python@v4
Expand All @@ -35,27 +35,18 @@ jobs:

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
run: poetry install --no-interaction --no-root -E doc

- name: Install packages
run: poetry install --no-interaction -E prediction -E doc -E optimization

- run: |
source $VENV
pip install "u8darts[torch]"
pytest tests/website --autodoc
python website/generate_sdk_markdown.py && python website/generate_terminal_markdown.py
- name: Commit Documentation
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Automated Change

deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,21 @@ jobs:
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root

- name: Install Package
run: poetry install --no-interaction
- name: Install Extra Doc
run: poetry install --no-interaction -E doc

- name: Install Extra Optimization
run: poetry install --no-interaction -E optimization

- name: Install Optimization Toolkit
run: poetry install -E optimization --no-interaction
- name: Run Extra prediction
run: poetry install --no-interaction -E prediction

- name: Run tests
env:
MPLBACKEND: Agg
run: |
source $VENV
pytest tests/
pytest tests/ --autodoc
- name: Start Terminal and exit
run: |
Expand Down Expand Up @@ -141,10 +144,7 @@ jobs:
run: poetry install --no-interaction --no-root

- name: Install Package
run: poetry install --no-interaction

- name: Install Optimization Toolkit
run: poetry install -E optimization --no-interaction
run: poetry install --no-interaction -E doc

- name: List installed packages
shell: bash -l {0}
Expand Down Expand Up @@ -251,6 +251,7 @@ jobs:
shell: bash -l {0}
run: |
pip install --requirement requirements-full.txt
pip install docstring_parser
- name: List installed packages (Bash)
shell: bash -l {0}
Expand Down
128 changes: 58 additions & 70 deletions openbb_terminal/econometrics/regression_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,35 +67,33 @@ def get_regressions_results(
>>> Y = df["lwage"]
>>> pooled_ols_model = openbb.econometrics.panel(Y,X,"POLS")
>>> print(pooled_ols_model.summary)
SDK Snippet:
>>> PooledOLS Estimation Summary
>>> ================================================================================
>>> Dep. Variable: lwage R-squared: 0.1634
>>> Estimator: PooledOLS R-squared (Between): 0.1686
>>> No. Observations: 4360 R-squared (Within): 0.1575
>>> Date: Sun, Nov 13 2022 R-squared (Overall): 0.1634
>>> Time: 13:04:02 Log-likelihood -3050.4
>>> Cov. Estimator: Unadjusted
>>> F-statistic: 283.68
>>> Entities: 545 P-value 0.0000
>>> Avg Obs: 8.0000 Distribution: F(3,4356)
>>> Min Obs: 8.0000
>>> Max Obs: 8.0000 F-statistic (robust): 283.68
>>> P-value 0.0000
>>> Time periods: 8 Distribution: F(3,4356)
>>> Avg Obs: 545.00
>>> Min Obs: 545.00
>>> Max Obs: 545.00
>>> Parameter Estimates
>>> ==============================================================================
>>> Parameter Std. Err. T-stat P-value Lower CI Upper CI
>>> ------------------------------------------------------------------------------
>>> const -0.0308 0.0620 -0.4965 0.6196 -0.1523 0.0908
>>> exper 0.0561 0.0028 20.220 0.0000 0.0507 0.0616
>>> educ 0.1080 0.0045 24.034 0.0000 0.0992 0.1168
>>> union 0.1777 0.0172 10.344 0.0000 0.1441 0.2114
>>> ==============================================================================
Results:
PooledOLS Estimation Summary
================================================================================
Dep. Variable: lwage R-squared: 0.1634
Estimator: PooledOLS R-squared (Between): 0.1686
No. Observations: 4360 R-squared (Within): 0.1575
Date: Sun, Nov 13 2022 R-squared (Overall): 0.1634
Time: 13:04:02 Log-likelihood -3050.4
Cov. Estimator: Unadjusted
F-statistic: 283.68
Entities: 545 P-value 0.0000
Avg Obs: 8.0000 Distribution: F(3,4356)
Min Obs: 8.0000
Max Obs: 8.0000 F-statistic (robust): 283.68
P-value 0.0000
Time periods: 8 Distribution: F(3,4356)
Avg Obs: 545.00
Min Obs: 545.00
Max Obs: 545.00
Parameter Estimates
==============================================================================
Parameter Std. Err. T-stat P-value Lower CI Upper CI
------------------------------------------------------------------------------
const -0.0308 0.0620 -0.4965 0.6196 -0.1523 0.0908
exper 0.0561 0.0028 20.220 0.0000 0.0507 0.0616
educ 0.1080 0.0045 24.034 0.0000 0.0992 0.1168
union 0.1777 0.0172 10.344 0.0000 0.1441 0.2114
==============================================================================
"""
regressions = {
"OLS": lambda: get_ols(Y, X),
Expand Down Expand Up @@ -175,10 +173,7 @@ def get_regression_data(


@log_start_end(log=logger)
def get_ols(
Y: pd.DataFrame,
X: pd.DataFrame,
) -> Any:
def get_ols(Y: pd.DataFrame, X: pd.DataFrame) -> Any:
"""Performs an OLS regression on timeseries data. [Source: Statsmodels]
Parameters
Expand All @@ -199,34 +194,32 @@ def get_ols(
>>> df = openbb.econometrics.load("wage_panel")
>>> OLS_model = openbb.econometrics.OLS(df["lwage"], df[["educ", "exper", "expersq"]])
>>> print(OLS_model.summary())`
SDK Snippet:
>>> OLS Regression Results
>>> =======================================================================================
>>> Dep. Variable: lwage R-squared (uncentered): 0.920
>>> Model: OLS Adj. R-squared (uncentered): 0.919
>>> Method: Least Squares F-statistic: 1.659e+04
>>> Date: Thu, 10 Nov 2022 Prob (F-statistic): 0.00
>>> Time: 15:28:11 Log-Likelihood: -3091.3
>>> No. Observations: 4360 AIC: 6189.
>>> Df Residuals: 4357 BIC: 6208.
>>> Df Model: 3
>>> Covariance Type: nonrobust
>>> ==============================================================================
>>> coef std err t P>|t| [0.025 0.975]
>>> ------------------------------------------------------------------------------
>>> educ 0.0986 0.002 39.879 0.000 0.094 0.103
>>> exper 0.1018 0.009 10.737 0.000 0.083 0.120
>>> expersq -0.0034 0.001 -4.894 0.000 -0.005 -0.002
>>> ==============================================================================
>>> Omnibus: 1249.642 Durbin-Watson: 0.954
>>> Prob(Omnibus): 0.000 Jarque-Bera (JB): 9627.436
>>> Skew: -1.152 Prob(JB): 0.00
>>> Kurtosis: 9.905 Cond. No. 86.4
>>> ==============================================================================
>>> Notes:
>>> [1] R² is computed without centering (uncentered) since the model does not contain a constant.
>>> [2] Standard Errors assume that the covariance matrix of the errors is correctly specified.
Results:
OLS Regression Results
=======================================================================================
Dep. Variable: lwage R-squared (uncentered): 0.920
Model: OLS Adj. R-squared (uncentered): 0.919
Method: Least Squares F-statistic: 1.659e+04
Date: Thu, 10 Nov 2022 Prob (F-statistic): 0.00
Time: 15:28:11 Log-Likelihood: -3091.3
No. Observations: 4360 AIC: 6189.
Df Residuals: 4357 BIC: 6208.
Df Model: 3
Covariance Type: nonrobust
==============================================================================
coef std err t P>|t| [0.025 0.975]
------------------------------------------------------------------------------
educ 0.0986 0.002 39.879 0.000 0.094 0.103
exper 0.1018 0.009 10.737 0.000 0.083 0.120
expersq -0.0034 0.001 -4.894 0.000 -0.005 -0.002
==============================================================================
Omnibus: 1249.642 Durbin-Watson: 0.954
Prob(Omnibus): 0.000 Jarque-Bera (JB): 9627.436
Skew: -1.152 Prob(JB): 0.00
Kurtosis: 9.905 Cond. No. 86.4
==============================================================================
Notes:
[1] R² is computed without centering (uncentered) since the model does not contain a constant.
[2] Standard Errors assume that the covariance matrix of the errors is correctly specified.
"""

if X.empty or Y.empty:
Expand Down Expand Up @@ -320,8 +313,8 @@ def get_re(Y: pd.DataFrame, X: pd.DataFrame) -> Any:
@log_start_end(log=logger)
def get_bols(Y: pd.DataFrame, X: pd.DataFrame) -> Any:
"""The between estimator is an alternative, usually less efficient estimator, can can be used to
estimate model parameters. It is particular simple since it first computes the time averages of
y and x and then runs a simple regression using these averages. [Source: LinearModels]
estimate model parameters. It is particular simple since it first computes the time averages of
y and x and then runs a simple regression using these averages. [Source: LinearModels]
Parameters
----------
Expand Down Expand Up @@ -391,10 +384,7 @@ def get_fe(
with warnings.catch_warnings(record=True) as warning_messages:
exogenous = add_constant(X)
model = PanelOLS(
Y,
exogenous,
entity_effects=entity_effects,
time_effects=time_effects,
Y, exogenous, entity_effects=entity_effects, time_effects=time_effects
).fit()

if len(warning_messages) > 0:
Expand Down Expand Up @@ -519,9 +509,7 @@ def get_dwat(
>>> Y, X = df["lwage"], df[["exper","educ"]]
>>> model = openbb.econometrics.ols(Y,X)
>>> durbin_watson_value = openbb.econometrics.dwat(model)
SDK Snippet:
>>> 0.96
Result:
0.96
"""
# Durbin Watson test: The test statistic is approximately equal to 2*(1-r) where r is the
# sample autocorrelation of the residuals. Thus, for r == 0, indicating no serial correlation,
Expand Down
2 changes: 1 addition & 1 deletion openbb_terminal/miscellaneous/library/trail_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -524,4 +524,4 @@ keys.stocksera,openbb_terminal.keys_model.set_stocksera_key,
futures.search,openbb_terminal.futures.yfinance_model.get_search_futures,
futures.historical,openbb_terminal.futures.yfinance_model.get_historical_futures,openbb_terminal.futures.yfinance_view.display_historical
futures.curve,openbb_terminal.futures.yfinance_model.get_curve_futures,openbb_terminal.futures.yfinance_view.display_curve
economy.get_groups,openbb_terminal.economy.finviz_model.get_groups,
economy.get_groups,openbb_terminal.economy.finviz_model.get_groups,
Loading

0 comments on commit 7904660

Please sign in to comment.