Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clenow and demark to SDK #3525

Merged
merged 6 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions openbb_terminal/common/technical_analysis/momentum_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ def clenow_momentum(
Coefficient of linear regression
pd.Series:
Values for best fit line

Examples
--------
>>> from openbb_terminal.sdk import openbb
>>> df = openbb.stocks.load("AAPL")
>>> openbb.ta.clenow(df["Close"])
"""
if len(values) < window:
console.print(
Expand Down Expand Up @@ -260,5 +266,11 @@ def demark_seq(values: pd.Series) -> pd.DataFrame:
-------
pd.DataFrame
Dataframe of UP and DOWN sequential indicators

Examples
--------
>>> from openbb_terminal.sdk import openbb
>>> df = openbb.stocks.load("AAPL")
>>> openbb.ta.demark(df["Close"])
"""
return ta.td_seq(values, asint=True)
14 changes: 13 additions & 1 deletion openbb_terminal/common/technical_analysis/momentum_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,12 @@ def display_clenow_momentum(
Format to export data
external_axes : Optional[List[plt.Axes]], optional
External axes (2 axes are expected in the list), by default None

Examples
--------
>>> from openbb_terminal.sdk import openbb
>>> df = openbb.stocks.load("AAPL")
>>> openbb.ta.clenow_chart(df["Close"])
"""
r2, coef, fit_data = momentum_model.clenow_momentum(data, window)

Expand Down Expand Up @@ -642,7 +648,7 @@ def display_demark(
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
):
"""Plots demark squential indicator
"""Plot demark sequential indicator

Parameters
----------
Expand All @@ -656,6 +662,12 @@ def display_demark(
Format to export data
external_axes : Optional[List[plt.Axes]], optional
External axes (1 axes are expected in the list), by default None

Examples
--------
>>> from openbb_terminal.sdk import openbb
>>> df = openbb.stocks.load("AAPL")
>>> openbb.ta.demark_chart(df)
"""
close_col = ta_helpers.check_columns(data, high=False, low=False)
if close_col is None:
Expand Down
2 changes: 2 additions & 0 deletions openbb_terminal/miscellaneous/library/trail_map.csv
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ ta.fisher,openbb_terminal.common.technical_analysis.momentum_model.fisher,openbb
ta.macd,openbb_terminal.common.technical_analysis.momentum_model.macd,openbb_terminal.common.technical_analysis.momentum_view.display_macd
ta.rsi,openbb_terminal.common.technical_analysis.momentum_model.rsi,openbb_terminal.common.technical_analysis.momentum_view.display_rsi
ta.stoch,openbb_terminal.common.technical_analysis.momentum_model.stoch,openbb_terminal.common.technical_analysis.momentum_view.display_stoch
ta.demark,openbb_terminal.common.technical_analysis.momentum_model.demark_seq,openbb_terminal.common.technical_analysis.momentum_view.display_demark
ta.clenow,openbb_terminal.common.technical_analysis.momentum_model.clenow_momentum,openbb_terminal.common.technical_analysis.momentum_view.display_clenow_momentum
ta.ma,openbb_terminal.common.technical_analysis.overlap_view.view_ma,openbb_terminal.common.technical_analysis.overlap_view.view_ma
ta.ema,openbb_terminal.common.technical_analysis.overlap_model.ema,
ta.hma,openbb_terminal.common.technical_analysis.overlap_model.hma,
Expand Down