Merge branch 'develop' into feature/volume-inchart

This commit is contained in:
teh_coderer
2023-03-15 16:57:11 -05:00
committed by GitHub
5 changed files with 22 additions and 5 deletions

View File

@@ -638,6 +638,7 @@ def show_quick_performance(
show_index=False,
headers=df.columns,
title=f"{symbol.upper()}/{current_currency.upper()} Performance {exchange_str}",
print_to_console=True,
)
console.print()

View File

@@ -679,6 +679,10 @@ class EconomyController(BaseController):
dest="parameter",
default="",
help="Series ID of the Macro Economic data from FRED",
required="-h" not in other_args
and "--help" not in other_args
and "-q" not in other_args
and "--query" not in other_args,
)
parser.add_argument(
"-s",
@@ -704,6 +708,10 @@ class EconomyController(BaseController):
nargs="+",
dest="query",
help="Query the FRED database to obtain Series IDs given the query search term.",
required="-h" not in other_args
and "--help" not in other_args
and "-p" not in other_args
and "--parameter" not in other_args,
)
if other_args and "-" not in other_args[0][0]:
other_args.insert(0, "-p")

View File

@@ -273,6 +273,7 @@ def print_rich_table(
columns_to_auto_color: Optional[List[str]] = None,
rows_to_auto_color: Optional[List[str]] = None,
export: bool = False,
print_to_console: bool = False,
limit: Optional[int] = 1000,
):
"""Prepare a table from df in rich.
@@ -303,11 +304,18 @@ def print_rich_table(
Whether we are exporting the table to a file. If so, we don't want to print it.
limit: Optional[int]
Limit the number of rows to show.
print_to_console: bool
Whether to print the table to the console. If False and interactive mode is
enabled, the table will be displayed in a new window. Otherwise, it will print to the
console.
"""
if export:
return
current_user = get_current_user()
enable_interactive = (
current_user.preferences.USE_INTERACTIVE_DF and plots_backend().isatty
)
def _get_headers(_headers: Union[List[str], pd.Index]) -> List[str]:
"""Check if headers are valid and return them."""
@@ -320,7 +328,7 @@ def print_rich_table(
)
return output
if current_user.preferences.USE_INTERACTIVE_DF and plots_backend().isatty:
if enable_interactive and not print_to_console:
df_outgoing = df.copy()
# If headers are provided, use them
if headers is not None:

View File

@@ -1688,7 +1688,7 @@ class TechnicalAnalysisController(StockBaseController):
dest="indicators",
type=check_indicators,
help="Indicators to plot",
required="--indicators" not in other_args,
required="-h" not in other_args,
)
parser.add_argument(
"-p",

View File

@@ -835,7 +835,7 @@ def test_call_fred_query(mocker):
"other_args, mocked_func, called_args, called_kwargs",
[
(
["--parameter=dgs2,dgs5"],
["--parameter", "dgs2,dgs5"],
"fred_view.display_fred_series",
[],
dict(
@@ -850,7 +850,7 @@ def test_call_fred_query(mocker):
),
),
(
["--parameter=DgS2,dgs5", "--export=csv", "--raw"],
["--parameter", "DgS2,dgs5", "--export=csv", "--raw"],
"fred_view.display_fred_series",
[],
dict(
@@ -865,7 +865,7 @@ def test_call_fred_query(mocker):
),
),
(
["--parameter=DgS2,dgs5", "--export=csv", "--start=2022-10-10"],
["--parameter", "DgS2,dgs5", "--export=csv", "--start=2022-10-10"],
"fred_view.display_fred_series",
[],
dict(