put ticker on clenow func (#2709)

Co-authored-by: James Maslek <jmaslek11@gmail.com>
This commit is contained in:
DidierRLopes
2022-10-05 02:51:57 +02:00
committed by GitHub
parent d0c5c8e288
commit 4e6a2fb564
3 changed files with 9 additions and 4 deletions

View File

@@ -544,6 +544,7 @@ def display_cg(
@log_start_end(log=logger)
def display_clenow_momentum(
data: pd.Series,
symbol: str = "",
window: int = 90,
export: str = "",
external_axes: Optional[List[plt.Axes]] = None,
@@ -554,6 +555,8 @@ def display_clenow_momentum(
----------
data : pd.Series
Series of values
symbol : str
Symbol that the data corresponds to
window : int
Length of window
export : str
@@ -579,7 +582,7 @@ def display_clenow_momentum(
df,
show_index=True,
headers=[""],
title="Clenow Exponential Regression Factor",
title=f"Clenow Exponential Regression Factor on {symbol}",
show_header=False,
)
@@ -595,7 +598,7 @@ def display_clenow_momentum(
ax1.plot(data.index, np.log(data.values))
ax1.plot(data.index[-window:], fit_data, linewidth=2)
ax1.set_title("Clenow Momentum Exponential Regression")
ax1.set_title(f"Clenow Momentum Exponential Regression on {symbol}")
ax1.set_xlim(data.index[0], data.index[-1])
ax1.set_ylabel("Log Price")
theme.style_primary_axis(

View File

@@ -288,7 +288,6 @@ def print_rich_table(
table.add_row(*row)
console.print()
console.print(table)
console.print()
else:
console.print(df.to_string(col_space=0))

View File

@@ -1415,5 +1415,8 @@ class TechnicalAnalysisController(StockBaseController):
)
if ns_parser:
momentum_view.display_clenow_momentum(
self.stock["Adj Close"], ns_parser.period, ns_parser.export
self.stock["Adj Close"],
self.ticker.upper(),
ns_parser.period,
ns_parser.export,
)