mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-28 13:01:38 +00:00
* quick econ fix * black * keys and feature flags * terminal name 👀 * some more replacements * some more replacements * edit pyproject * gst -> openbb * add example portfolios back to git * Update api from gst * sorry. skipping some tests * another round of names * another round of test edits * Missed some .gst refs and update timezone * water mark stuff * Fixing Names in terminal.spec and name of GTFF_DEFAULTS to OBBFF_DEFAULTS * fix more GST to OpenBB Terminal * Logging : merge conflicts with main * Revert wrong files Co-authored-by: Andrew <andrew.kenreich@gmail.com> Co-authored-by: DidierRLopes <dro.lopes@campus.fct.unl.pt> Co-authored-by: Chavithra PARANA <chavithra@gmail.com>
88 lines
1.7 KiB
Python
88 lines
1.7 KiB
Python
"""Trend Indicators Technical Analysis Model"""
|
|
__docformat__ = "numpy"
|
|
|
|
import logging
|
|
|
|
import pandas as pd
|
|
import pandas_ta as ta
|
|
|
|
from openbb_terminal.decorators import log_start_end
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@log_start_end(log=logger)
|
|
def adx(
|
|
high_values: pd.Series,
|
|
low_values: pd.Series,
|
|
close_values: pd.Series,
|
|
length: int = 14,
|
|
scalar: int = 100,
|
|
drift: int = 1,
|
|
):
|
|
"""ADX technical indicator
|
|
|
|
Parameters
|
|
----------
|
|
high_values: pd.Series
|
|
High prices
|
|
low_values: pd.Series
|
|
Low prices
|
|
close_values: pd.Series
|
|
close prices
|
|
length: int
|
|
Length of window
|
|
scalar: int
|
|
Scalar variable
|
|
drift: int
|
|
Drift variable
|
|
|
|
Returns
|
|
-------
|
|
pd.DataFrame
|
|
DataFrame with adx indicator
|
|
"""
|
|
return pd.DataFrame(
|
|
ta.adx(
|
|
high=high_values,
|
|
low=low_values,
|
|
close=close_values,
|
|
length=length,
|
|
scalar=scalar,
|
|
drift=drift,
|
|
).dropna()
|
|
)
|
|
|
|
|
|
@log_start_end(log=logger)
|
|
def aroon(
|
|
high_values: pd.Series, low_values: pd.Series, length: int = 25, scalar: int = 100
|
|
) -> pd.DataFrame:
|
|
"""Aroon technical indicator
|
|
|
|
Parameters
|
|
----------
|
|
high_values: pd.Series
|
|
High prices
|
|
low_values: pd.Series
|
|
Low prices
|
|
length : int
|
|
Length of window
|
|
scalar : int
|
|
Scalar variable
|
|
|
|
Returns
|
|
-------
|
|
pd.DataFrame
|
|
DataFrame with aroon indicator
|
|
"""
|
|
|
|
return pd.DataFrame(
|
|
ta.aroon(
|
|
high=high_values,
|
|
low=low_values,
|
|
length=length,
|
|
scalar=scalar,
|
|
).dropna()
|
|
)
|