mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
@@ -31,7 +31,7 @@ register_matplotlib_converters()
|
||||
@log_start_end(log=logger)
|
||||
def view_ma(
|
||||
series: pd.Series,
|
||||
length: List[int] = None,
|
||||
window: List[int] = None,
|
||||
offset: int = 0,
|
||||
ma_type: str = "EMA",
|
||||
symbol: str = "",
|
||||
@@ -44,7 +44,7 @@ def view_ma(
|
||||
----------
|
||||
series: pd.Series
|
||||
Series of prices
|
||||
length: List[int]
|
||||
window: List[int]
|
||||
Length of EMA window
|
||||
offset: int
|
||||
Offset variable
|
||||
@@ -61,10 +61,10 @@ def view_ma(
|
||||
price_df = pd.DataFrame(series)
|
||||
|
||||
l_legend = [symbol]
|
||||
if not length:
|
||||
length = [20, 50]
|
||||
if not window:
|
||||
window = [20, 50]
|
||||
|
||||
for win in length:
|
||||
for win in window:
|
||||
if ma_type == "EMA":
|
||||
df_ta = overlap_model.ema(series, win, offset)
|
||||
l_legend.append(f"EMA {win}")
|
||||
@@ -112,7 +112,7 @@ def view_ma(
|
||||
export_data(
|
||||
export,
|
||||
os.path.dirname(os.path.abspath(__file__)).replace("common", "stocks"),
|
||||
f"{ma_type.lower()}{'_'.join([str(win) for win in length])}",
|
||||
f"{ma_type.lower()}{'_'.join([str(win) for win in window])}",
|
||||
price_df,
|
||||
)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ logger = logging.getLogger(__name__)
|
||||
def display_bbands(
|
||||
data: pd.DataFrame,
|
||||
symbol: str = "",
|
||||
limit: int = 15,
|
||||
window: int = 15,
|
||||
n_std: float = 2,
|
||||
mamode: str = "sma",
|
||||
export: str = "",
|
||||
@@ -40,7 +40,7 @@ def display_bbands(
|
||||
Dataframe of ohlc prices
|
||||
symbol : str
|
||||
Ticker symbol
|
||||
limit : int
|
||||
window : int
|
||||
Length of window to calculate BB
|
||||
n_std : float
|
||||
Number of standard deviations to show
|
||||
@@ -51,7 +51,7 @@ def display_bbands(
|
||||
external_axes : Optional[List[plt.Axes]], optional
|
||||
External axes (1 axis is expected in the list), by default None
|
||||
"""
|
||||
df_ta = volatility_model.bbands(data["Adj Close"], limit, n_std, mamode)
|
||||
df_ta = volatility_model.bbands(data["Adj Close"], window, n_std, mamode)
|
||||
plot_data = pd.merge(data, df_ta, how="outer", left_index=True, right_index=True)
|
||||
plot_data = reindex_dates(plot_data)
|
||||
|
||||
@@ -188,7 +188,7 @@ def display_donchian(
|
||||
@log_start_end(log=logger)
|
||||
def view_kc(
|
||||
data: pd.DataFrame,
|
||||
limit: int = 20,
|
||||
window: int = 20,
|
||||
scalar: float = 2,
|
||||
mamode: str = "ema",
|
||||
offset: int = 0,
|
||||
@@ -203,7 +203,7 @@ def view_kc(
|
||||
|
||||
data: pd.DataFrame
|
||||
Dataframe of ohlc prices
|
||||
limit: int
|
||||
window: int
|
||||
Length of window
|
||||
scalar: float
|
||||
Scalar value
|
||||
@@ -222,7 +222,7 @@ def view_kc(
|
||||
data["High"],
|
||||
data["Low"],
|
||||
data["Adj Close"],
|
||||
limit,
|
||||
window,
|
||||
scalar,
|
||||
mamode,
|
||||
offset,
|
||||
|
||||
@@ -71,8 +71,12 @@ def get_tradingview_recommendation(
|
||||
interval=an_interval,
|
||||
)
|
||||
d_recommendation = stock_recommendation.get_analysis().summary
|
||||
df_recommendation = df_recommendation.append(
|
||||
d_recommendation, ignore_index=True
|
||||
df_recommendation = pd.concat(
|
||||
[
|
||||
pd.DataFrame.from_dict(d_recommendation, orient="index").T,
|
||||
df_recommendation,
|
||||
],
|
||||
axis=0,
|
||||
)
|
||||
index_recommendation.append(INTERVALS[an_interval])
|
||||
df_recommendation.index = index_recommendation
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
Interval,RECOMMENDATION,BUY,SELL,NEUTRAL
|
||||
1 month,BUY,14,5,7
|
||||
1 week,BUY,14,3,9
|
||||
1 day,NEUTRAL,7,9,10
|
||||
4 hours,NEUTRAL,9,11,6
|
||||
1 hour,SELL,2,15,9
|
||||
15 min,SELL,1,15,10
|
||||
5 min,STRONG_SELL,1,16,9
|
||||
1 min,STRONG_SELL,0,16,10
|
||||
1 month,STRONG_SELL,0,16,10
|
||||
1 week,STRONG_SELL,1,16,9
|
||||
1 day,SELL,1,15,10
|
||||
4 hours,SELL,2,15,9
|
||||
1 hour,NEUTRAL,9,11,6
|
||||
15 min,NEUTRAL,7,9,10
|
||||
5 min,BUY,14,3,9
|
||||
1 min,BUY,14,5,7
|
||||
|
||||
|
Reference in New Issue
Block a user