OpenBB Econometrics Extension
This package adds the openbb-econometrics extension to the Open Data Platform by OpenBB.
It provides a toolkit of econometrics commands — regression, regression diagnostics,
stationarity and cointegration tests, Granger causality, GARCH volatility modelling, and
panel-data estimators — that operate on any tabular dataset passed in as data.
Installation
Install from PyPI with:
pip install openbb-econometrics
Then build the Python static assets by running:
openbb-build
Quick Start
Every command is a POST endpoint that takes a data payload (a list of records, e.g.
the .results of another OpenBB command) plus typed parameters, and returns an OBBject.
from openbb import obb
prices = obb.equity.price.historical(
symbol="AAPL", start_date="2023-01-01", provider="yfinance"
).results
# Coefficient table of an OLS regression.
obb.econometrics.ols_regression(
data=prices, y_column="close", x_columns=["open", "high", "low"]
)
# Augmented Dickey-Fuller stationarity test.
obb.econometrics.unit_root(data=prices, column="close")
# GARCH(1, 1) conditional volatility.
obb.econometrics.garch(data=prices, column="close")
To use the extension over HTTP, start the API server with openbb-api and POST to
/api/v1/econometrics/<command>.
Coverage
All commands are available under obb.econometrics.*.
Tools
correlation_matrix— correlation matrix of a datasetsummary_statistics— per-column descriptive statistics
Regression
ols_regression— Ordinary Least Squares coefficient tableols_regression_summary— OLS goodness-of-fit summary
Diagnostics
autocorrelation— Durbin-Watson autocorrelation testresidual_autocorrelation— Breusch-Godfrey residual autocorrelation testheteroskedasticity— Breusch-Pagan and White heteroskedasticity testsnormality— Jarque-Bera normality test on residualsvariance_inflation_factor— multicollinearity (VIF) test
Time Series
unit_root— Augmented Dickey-Fuller unit root testkpss— KPSS stationarity testcointegration— Engle-Granger pairwise cointegration testcointegration_johansen— Johansen multivariate cointegration testcausality— Granger causality testgarch— GARCH(p, q) conditional volatility model
Panel
panel_random_effects— one-way Random Effects modelpanel_between— Between estimatorpanel_pooled— Pooled OLS estimatorpanel_fixed— Fixed Effects estimatorpanel_first_difference— First-Difference estimatorpanel_fmac— Fama-MacBeth estimator
See the full docs here