Fix bug stocks candle (#1429)

Co-authored-by: Theodore Aptekarev <aptekarev@gmail.com>
This commit is contained in:
minhhoang1023
2022-03-03 03:56:29 +07:00
committed by GitHub
parent eb6d3ff8ac
commit ee7551c831
2 changed files with 3 additions and 10 deletions

View File

@@ -232,7 +232,7 @@ Stock: [/param]{stock_text}
dest="mov_avg",
type=str,
help="Add moving average in number of days to plot and separate by a comma. Example: 20,30,50",
default="20,50",
default=None,
)
ns_parser = parse_known_args_and_warn(
@@ -261,10 +261,11 @@ Stock: [/param]{stock_text}
data = stocks_helper.process_candle(self.stock)
mov_avgs = []
if ns_parser.mov_avg:
mov_list = (num for num in ns_parser.mov_avg.split(","))
mov_avgs = []
for num in mov_list:
try:

View File

@@ -8,7 +8,6 @@ from datetime import datetime, timedelta
from typing import List, Union, Optional, Iterable
import matplotlib.pyplot as plt
import matplotlib
from matplotlib.lines import Line2D
import mplfinance as mpf
import numpy as np
@@ -31,7 +30,6 @@ from gamestonk_terminal.helper_funcs import (
plot_autoscale,
get_user_timezone_or_invalid,
print_rich_table,
lambda_long_number_format,
)
from gamestonk_terminal.rich_config import console
@@ -351,12 +349,6 @@ def display_candle(
candle_chart_kwargs["figsize"] = plot_autoscale()
fig, ax = mpf.plot(df_stock, **candle_chart_kwargs, **kwargs)
ax[2].get_yaxis().set_major_formatter(
matplotlib.ticker.FuncFormatter(
lambda x, _: lambda_long_number_format(x)
)
)
fig.suptitle(
f"{asset_type} {s_ticker}",
x=0.055,