diff --git a/.gitignore b/.gitignore
index ceaaa66c12c..4f92317b787 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,5 +8,6 @@ __pycache__/
env/
venv/
notebooks/reports/*
+reports/*
!notebooks/reports/.gitkeep
.python-version
diff --git a/gamestonk_terminal/forex/fx_controller.py b/gamestonk_terminal/forex/fx_controller.py
index b796f83ff25..1e3f4940117 100644
--- a/gamestonk_terminal/forex/fx_controller.py
+++ b/gamestonk_terminal/forex/fx_controller.py
@@ -83,10 +83,10 @@ class ForexController:
" reddit search reddit for posts about the loaded instrument"
)
print(
- " eda > exploratory data analysis, e.g.: decompose, cusum, residuals analysis"
+ " > eda exploratory data analysis, e.g.: decompose, cusum, residuals analysis"
)
print(
- " ba > behavioural analysis, from: reddit, stocktwits, twitter, google"
+ " > ba behavioural analysis, from: reddit, stocktwits, twitter, google"
)
print("")
diff --git a/gamestonk_terminal/papermill/due_diligence_view.py b/gamestonk_terminal/papermill/due_diligence_view.py
index 339caf15c94..9572a1ed9a5 100644
--- a/gamestonk_terminal/papermill/due_diligence_view.py
+++ b/gamestonk_terminal/papermill/due_diligence_view.py
@@ -10,7 +10,7 @@ import papermill as pm
from gamestonk_terminal import config_terminal as cfg
-def due_diligence(other_args: List[str]):
+def due_diligence(other_args: List[str], show=True):
"""Due Diligence report
Parameters
@@ -35,12 +35,15 @@ def due_diligence(other_args: List[str]):
help="Stock ticker",
)
+ if other_args:
+ if "-" not in other_args[0]:
+ other_args.insert(0, "-t")
+
try:
(ns_parser, unknown_args) = parser.parse_known_args(other_args)
except SystemExit:
print("")
return
-
if unknown_args:
print(f"The following args couldn't be interpreted: {unknown_args}")
@@ -66,7 +69,8 @@ def due_diligence(other_args: List[str]):
print("")
return
- webbrowser.open(
- f"http://localhost:{cfg.PAPERMILL_NOTEBOOK_REPORT_PORT}/notebooks/{analysis_notebook}"
- )
+ if show:
+ webbrowser.open(
+ f"http://localhost:{cfg.PAPERMILL_NOTEBOOK_REPORT_PORT}/notebooks/{analysis_notebook}"
+ )
print("")
diff --git a/gamestonk_terminal/screener/README.md b/gamestonk_terminal/screener/README.md
index 3135fb3f981..af2a3feeab2 100644
--- a/gamestonk_terminal/screener/README.md
+++ b/gamestonk_terminal/screener/README.md
@@ -68,7 +68,7 @@ View historical price of stocks. [Source: Yahoo Finance]
## overview
```text
-usage: overview [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-a]
+usage: overview [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-aem]
```
Prints screener data of the companies that meet the pre-set filtering. Some of the fields shown are: Sector, Industry, Market Cap, Volume. Note that when the signal parameter (-s) is specified, the preset is disregarded. [Source: Finviz]
@@ -77,6 +77,8 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
* -s : Signal type. Default: None. When specified (see list available in [signals](#signals)), the preset is disregarded.
* -l : Limit of stocks to output. Default: 200.
* -a : Set order of stocks shown to Ascended. Default: Descended.
+* -e : Export list to a file.
+* -m : Run papermill dd on the tickers in the returned list.
@@ -84,7 +86,7 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
## valuation
```text
-usage: valuation [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-a]
+usage: valuation [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-aem]
```
Prints screener data of the companies that meet the pre-set filtering. Some of the fields shown are: P/E, PEG, P/S, P/B, EPS this Y. Note that when the signal parameter (-s) is specified, the preset is disregarded. [Source: Finviz]
@@ -93,6 +95,11 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
* -s : Signal type. Default: None. When specified (see list available in [signals](#signals)), the preset is disregarded.
* -l : Limit of stocks to output. Default: 200.
* -a : Set order of stocks shown to Ascended. Default: Descended.
+* -e : Export list to a file.
+* -m : Run papermill dd on the tickers in the returned list.
+
+
+
@@ -100,7 +107,7 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
## financial
```text
-usage: financial [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-a]
+usage: financial [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-aem]
```
Prints screener data of the companies that meet the pre-set filtering. Some of the fields shown are: Dividend, ROA, ROE, ROI, Earnings. Note that when the signal parameter (-s) is specified, the preset is disregarded. [Source: Finviz]
@@ -109,6 +116,11 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
* -s : Signal type. Default: None. When specified (see list available in [signals](#signals)), the preset is disregarded.
* -l : Limit of stocks to output. Default: 200.
* -a : Set order of stocks shown to Ascended. Default: Descended.
+* -e : Export list to a file.
+* -m : Run papermill dd on the tickers in the returned list.
+
+
+
@@ -116,7 +128,7 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
## ownership
```text
-usage: ownership [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-a]
+usage: ownership [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-aem]
```
Prints screener data of the companies that meet the pre-set filtering. Some of the fields shown are: Float, Insider Own, Short Ratio. Note that when the signal parameter (-s) is specified, the preset is disregarded. [Source: Finviz]
@@ -125,6 +137,11 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
* -s : Signal type. Default: None. When specified (see list available in [signals](#signals)), the preset is disregarded.
* -l : Limit of stocks to output. Default: 200.
* -a : Set order of stocks shown to Ascended. Default: Descended.
+* -e : Export list to a file.
+* -m : Run papermill dd on the tickers in the returned list.
+
+
+
@@ -132,7 +149,7 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
## performance
```text
-usage: performance [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-a]
+usage: performance [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-aem]
```
Prints screener data of the companies that meet the pre-set filtering. Some of the fields shown are: Perf Week, Perf YTD, Volatility M. Note that when the signal parameter (-s) is specified, the preset is disregarded. [Source: Finviz]
@@ -141,6 +158,11 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
* -s : Signal type. Default: None. When specified (see list available in [signals](#signals)), the preset is disregarded.
* -l : Limit of stocks to output. Default: 200.
* -a : Set order of stocks shown to Ascended. Default: Descended.
+* -e : Export list to a file.
+* -m : Run papermill dd on the tickers in the returned list.
+
+
+
@@ -148,7 +170,7 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
## technical
```text
-usage: technical [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-a]
+usage: technical [-p {template,sexy_year,...}] [-s {top_gainers,top_losers,...}] [-l LIMIT] [-aem]
```
Prints screener data of the companies that meet the pre-set filtering. Some of the fields shown are: Beta, SMA50, 52W Low, RSI, Change. Note that when the signal parameter (-s) is specified, the preset is disregarded. [Source: Finviz]
@@ -157,6 +179,11 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
* -s : Signal type. Default: None. When specified (see list available in [signals](#signals)), the preset is disregarded.
* -l : Limit of stocks to output. Default: 200.
* -a : Set order of stocks shown to Ascended. Default: Descended.
+* -e : Export list to a file.
+* -m : Run papermill dd on the tickers in the returned list.
+
+
+
@@ -165,9 +192,14 @@ Prints screener data of the companies that meet the pre-set filtering. Some of t
Example:
```text
-technical -s oversold
+technical -s oversold [-em]
```
+* -e : Export list to a file.
+* -m : Run papermill dd on the tickers in the returned list.
+
+
+
diff --git a/gamestonk_terminal/screener/finviz_view.py b/gamestonk_terminal/screener/finviz_view.py
index 3c331be9649..f6553ad537d 100644
--- a/gamestonk_terminal/screener/finviz_view.py
+++ b/gamestonk_terminal/screener/finviz_view.py
@@ -6,6 +6,8 @@ from typing import List
import os
import configparser
import pandas as pd
+from datetime import datetime
+from gamestonk_terminal.papermill import due_diligence_view
from finvizfinance.screener import (
technical,
overview,
@@ -198,6 +200,20 @@ def screener(other_args: List[str], loaded_preset: str, data_type: str):
dest="ascend",
help="Set order to Ascend, the default is Descend",
)
+ parser.add_argument(
+ "-e",
+ "--export",
+ action="store_true",
+ dest="exportFile",
+ help="Save list as a text file",
+ )
+ parser.add_argument(
+ "-m",
+ "--mill",
+ action="store_true",
+ dest="mill",
+ help="Run papermill on list",
+ )
try:
ns_parser = parse_known_args_and_warn(parser, other_args)
@@ -215,6 +231,19 @@ def screener(other_args: List[str], loaded_preset: str, data_type: str):
if isinstance(df_screen, pd.DataFrame):
print(df_screen.to_string())
print("")
+ if ns_parser.exportFile:
+ now = datetime.now()
+ if not os.path.exists("reports/screener"):
+ os.makedirs("reports/screener")
+ with open(
+ f"reports/screener/{ns_parser.signal}-{now.strftime('%Y-%m-%d_%H:%M:%S')}",
+ "w",
+ ) as file:
+ file.write(df_screen.to_string(index=False) + "\n")
+ if ns_parser.mill:
+ for i in range(len(df_screen)):
+ ticker = [df_screen.iat[i, 0]]
+ due_diligence_view.due_diligence(ticker, show=False)
return list(df_screen["Ticker"].values)
else:
print("")