-
+
Command|Website
----|----
`macroaxis` |www.macroaxis.com
diff --git a/gamestonk_terminal/research/res_controller.py b/gamestonk_terminal/stocks/research/res_controller.py
similarity index 98%
rename from gamestonk_terminal/research/res_controller.py
rename to gamestonk_terminal/stocks/research/res_controller.py
index f4bab461e14..8c71c14400f 100644
--- a/gamestonk_terminal/research/res_controller.py
+++ b/gamestonk_terminal/stocks/research/res_controller.py
@@ -235,11 +235,11 @@ def menu(ticker: str, start: datetime, interval: str):
{c: None for c in res_controller.CHOICES}
)
an_input = session.prompt(
- f"{get_flair()} (res)> ",
+ f"{get_flair()} (stocks)>(res)> ",
completer=completer,
)
else:
- an_input = input(f"{get_flair()} (res)> ")
+ an_input = input(f"{get_flair()} (stocks)>(res)> ")
try:
process_input = res_controller.switch(an_input)
diff --git a/gamestonk_terminal/residuals_analysis/README.md b/gamestonk_terminal/stocks/residuals_analysis/README.md
similarity index 99%
rename from gamestonk_terminal/residuals_analysis/README.md
rename to gamestonk_terminal/stocks/residuals_analysis/README.md
index da660b318db..1afdb9785f8 100644
--- a/gamestonk_terminal/residuals_analysis/README.md
+++ b/gamestonk_terminal/stocks/residuals_analysis/README.md
@@ -32,7 +32,7 @@ This menu aims to perform residual analysis on a pre-loaded stock in order to do
usage: pick [-m MODEL]
```
-Pick model to fit to stock data.
+Pick model to fit to stock data.
Currently supported: **Naive**, **ARIMA**
diff --git a/gamestonk_terminal/residuals_analysis/ra_controller.py b/gamestonk_terminal/stocks/residuals_analysis/ra_controller.py
similarity index 97%
rename from gamestonk_terminal/residuals_analysis/ra_controller.py
rename to gamestonk_terminal/stocks/residuals_analysis/ra_controller.py
index 01a762ee575..2ab66b39410 100644
--- a/gamestonk_terminal/residuals_analysis/ra_controller.py
+++ b/gamestonk_terminal/stocks/residuals_analysis/ra_controller.py
@@ -8,8 +8,7 @@ from datetime import datetime
import pandas as pd
from matplotlib import pyplot as plt
from prompt_toolkit.completion import NestedCompleter
-from gamestonk_terminal.residuals_analysis import residuals_api
-from gamestonk_terminal.residuals_analysis import residuals_model
+from gamestonk_terminal.common.residuals_analysis import residuals_api, residuals_model
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.helper_funcs import get_flair
from gamestonk_terminal.menu import session
@@ -265,11 +264,11 @@ def menu(ticker: str, start: datetime, interval: str, stock: pd.DataFrame):
{c: None for c in ra_controller.CHOICES}
)
an_input = session.prompt(
- f"{get_flair()} (ra)> ",
+ f"{get_flair()} (stocks)>(ra)> ",
completer=completer,
)
else:
- an_input = input(f"{get_flair()} (ra)> ")
+ an_input = input(f"{get_flair()} (stocks)>(ra)> ")
try:
plt.close("all")
diff --git a/gamestonk_terminal/screener/README.md b/gamestonk_terminal/stocks/screener/README.md
similarity index 99%
rename from gamestonk_terminal/screener/README.md
rename to gamestonk_terminal/stocks/screener/README.md
index becbe574d4b..fa9062796a8 100644
--- a/gamestonk_terminal/screener/README.md
+++ b/gamestonk_terminal/stocks/screener/README.md
@@ -219,7 +219,7 @@ Prints list of available signals. [Source: Finviz]
Goes to the portfolio menu with list of passed stocks. In order to pass the stocks, just type the tickers of interest, no commas.
```
-usage: po ticker1 ticker2 ...
+usage: po ticker1 ticker2 ...
```
````
diff --git a/gamestonk_terminal/screener/finviz_model.py b/gamestonk_terminal/stocks/screener/finviz_model.py
similarity index 100%
rename from gamestonk_terminal/screener/finviz_model.py
rename to gamestonk_terminal/stocks/screener/finviz_model.py
diff --git a/gamestonk_terminal/screener/finviz_view.py b/gamestonk_terminal/stocks/screener/finviz_view.py
similarity index 98%
rename from gamestonk_terminal/screener/finviz_view.py
rename to gamestonk_terminal/stocks/screener/finviz_view.py
index 60cbd086494..e78bdaf3697 100644
--- a/gamestonk_terminal/screener/finviz_view.py
+++ b/gamestonk_terminal/stocks/screener/finviz_view.py
@@ -6,12 +6,12 @@ from typing import List
import os
from datetime import datetime
import pandas as pd
-from gamestonk_terminal.papermill import due_diligence_view
+from gamestonk_terminal.stocks.report import due_diligence_view
from gamestonk_terminal.helper_funcs import (
parse_known_args_and_warn,
check_positive,
)
-from gamestonk_terminal.screener.finviz_model import (
+from gamestonk_terminal.stocks.screener.finviz_model import (
d_signals,
presets_path,
get_screener_data,
diff --git a/gamestonk_terminal/screener/presets/5pct_above_low.ini b/gamestonk_terminal/stocks/screener/presets/5pct_above_low.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/5pct_above_low.ini
rename to gamestonk_terminal/stocks/screener/presets/5pct_above_low.ini
diff --git a/gamestonk_terminal/screener/presets/README.md b/gamestonk_terminal/stocks/screener/presets/README.md
similarity index 95%
rename from gamestonk_terminal/screener/presets/README.md
rename to gamestonk_terminal/stocks/screener/presets/README.md
index 1e53d0dc6d6..1cdb73020a4 100644
--- a/gamestonk_terminal/screener/presets/README.md
+++ b/gamestonk_terminal/stocks/screener/presets/README.md
@@ -20,7 +20,7 @@
## How to add presets
-1. Go to the folder GamestonkTerminal/gamestonk_terminal/screener/presets.
+1. Go to the folder GamestonkTerminal/gamestonk_terminal/screener/presets.
2. There should be a `README.md` file and multiple `.ini` files. One of these `.ini` files should be named `template.ini`.
@@ -31,11 +31,11 @@

-5. Open the file you just renamed (e.g. `my_own_filter.ini`), and set the parameters you want to filter.
+5. Open the file you just renamed (e.g. `my_own_filter.ini`), and set the parameters you want to filter.

-6. It may be useful to play with the main source https://finviz.com/screener.ashx since you can tweak these and understand how they influence the outcome of the filtered stocks.
+6. It may be useful to play with the main source https://finviz.com/screener.ashx since you can tweak these and understand how they influence the outcome of the filtered stocks.

@@ -89,7 +89,7 @@
* **Author of preset:** Traceabl3
* **Contact:** swing the bullroarer
-* **ABOUT:** High Yield Dividend stonks that are at-or-near their lowest price. Inverse Head and shoulders pattern recognized.
+* **ABOUT:** High Yield Dividend stonks that are at-or-near their lowest price. Inverse Head and shoulders pattern recognized.
---
@@ -105,7 +105,7 @@
* **Author of preset:** Traceabl3
* **Contact:** hit me on my skytel pager
-* **Description:** Cheap stonks that are oversold: under 10% above the low, and oversold on the RSI.
+* **Description:** Cheap stonks that are oversold: under 10% above the low, and oversold on the RSI.
---
@@ -122,7 +122,7 @@
* **Author of preset:** Traceabl3
* **Contact:** flip the pigeons
-* **Description:** Golden Cross when the 50 day moves above the 200 day from below.
+* **Description:** Golden Cross when the 50 day moves above the 200 day from below.
---
@@ -162,18 +162,12 @@
* **Author of preset:** Traceabl3
* **Contact:** wave the white flag
-* **Description:** Too many indicators indicating an impending downturn.
+* **Description:** Too many indicators indicating an impending downturn.
---
## undervalue
* **Author of preset:** Traceabl3
-* **Contact:** message on tor browser.
+* **Contact:** message on tor browser.
* **Description:** Potential Undervalued stocks
-
-
-
-
-
-
diff --git a/gamestonk_terminal/screener/presets/analyst_strong_buy.ini b/gamestonk_terminal/stocks/screener/presets/analyst_strong_buy.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/analyst_strong_buy.ini
rename to gamestonk_terminal/stocks/screener/presets/analyst_strong_buy.ini
diff --git a/gamestonk_terminal/screener/presets/break_out_stocks.ini b/gamestonk_terminal/stocks/screener/presets/break_out_stocks.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/break_out_stocks.ini
rename to gamestonk_terminal/stocks/screener/presets/break_out_stocks.ini
diff --git a/gamestonk_terminal/screener/presets/buffett_like.ini b/gamestonk_terminal/stocks/screener/presets/buffett_like.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/buffett_like.ini
rename to gamestonk_terminal/stocks/screener/presets/buffett_like.ini
diff --git a/gamestonk_terminal/screener/presets/bull_runs_over_10pct.ini b/gamestonk_terminal/stocks/screener/presets/bull_runs_over_10pct.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/bull_runs_over_10pct.ini
rename to gamestonk_terminal/stocks/screener/presets/bull_runs_over_10pct.ini
diff --git a/gamestonk_terminal/screener/presets/channel_up_and_low_debt_and_sma_50and200.ini b/gamestonk_terminal/stocks/screener/presets/channel_up_and_low_debt_and_sma_50and200.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/channel_up_and_low_debt_and_sma_50and200.ini
rename to gamestonk_terminal/stocks/screener/presets/channel_up_and_low_debt_and_sma_50and200.ini
diff --git a/gamestonk_terminal/screener/presets/cheap_bottom_dividend.ini b/gamestonk_terminal/stocks/screener/presets/cheap_bottom_dividend.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/cheap_bottom_dividend.ini
rename to gamestonk_terminal/stocks/screener/presets/cheap_bottom_dividend.ini
diff --git a/gamestonk_terminal/screener/presets/cheap_dividend.ini b/gamestonk_terminal/stocks/screener/presets/cheap_dividend.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/cheap_dividend.ini
rename to gamestonk_terminal/stocks/screener/presets/cheap_dividend.ini
diff --git a/gamestonk_terminal/screener/presets/cheap_oversold.ini b/gamestonk_terminal/stocks/screener/presets/cheap_oversold.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/cheap_oversold.ini
rename to gamestonk_terminal/stocks/screener/presets/cheap_oversold.ini
diff --git a/gamestonk_terminal/screener/presets/continued_momentum_scan.ini b/gamestonk_terminal/stocks/screener/presets/continued_momentum_scan.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/continued_momentum_scan.ini
rename to gamestonk_terminal/stocks/screener/presets/continued_momentum_scan.ini
diff --git a/gamestonk_terminal/screener/presets/death_cross.ini b/gamestonk_terminal/stocks/screener/presets/death_cross.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/death_cross.ini
rename to gamestonk_terminal/stocks/screener/presets/death_cross.ini
diff --git a/gamestonk_terminal/screener/presets/golden_cross.ini b/gamestonk_terminal/stocks/screener/presets/golden_cross.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/golden_cross.ini
rename to gamestonk_terminal/stocks/screener/presets/golden_cross.ini
diff --git a/gamestonk_terminal/screener/presets/golden_cross_penny.ini b/gamestonk_terminal/stocks/screener/presets/golden_cross_penny.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/golden_cross_penny.ini
rename to gamestonk_terminal/stocks/screener/presets/golden_cross_penny.ini
diff --git a/gamestonk_terminal/screener/presets/growth_stocks.ini b/gamestonk_terminal/stocks/screener/presets/growth_stocks.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/growth_stocks.ini
rename to gamestonk_terminal/stocks/screener/presets/growth_stocks.ini
diff --git a/gamestonk_terminal/screener/presets/heavy_inst_ins.ini b/gamestonk_terminal/stocks/screener/presets/heavy_inst_ins.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/heavy_inst_ins.ini
rename to gamestonk_terminal/stocks/screener/presets/heavy_inst_ins.ini
diff --git a/gamestonk_terminal/screener/presets/high_vol_and_low_debt.ini b/gamestonk_terminal/stocks/screener/presets/high_vol_and_low_debt.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/high_vol_and_low_debt.ini
rename to gamestonk_terminal/stocks/screener/presets/high_vol_and_low_debt.ini
diff --git a/gamestonk_terminal/screener/presets/modified_dreman.ini b/gamestonk_terminal/stocks/screener/presets/modified_dreman.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/modified_dreman.ini
rename to gamestonk_terminal/stocks/screener/presets/modified_dreman.ini
diff --git a/gamestonk_terminal/screener/presets/modified_neff.ini b/gamestonk_terminal/stocks/screener/presets/modified_neff.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/modified_neff.ini
rename to gamestonk_terminal/stocks/screener/presets/modified_neff.ini
diff --git a/gamestonk_terminal/screener/presets/news_scanner.ini b/gamestonk_terminal/stocks/screener/presets/news_scanner.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/news_scanner.ini
rename to gamestonk_terminal/stocks/screener/presets/news_scanner.ini
diff --git a/gamestonk_terminal/screener/presets/oversold.ini b/gamestonk_terminal/stocks/screener/presets/oversold.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/oversold.ini
rename to gamestonk_terminal/stocks/screener/presets/oversold.ini
diff --git a/gamestonk_terminal/screener/presets/oversold_under_3dol.ini b/gamestonk_terminal/stocks/screener/presets/oversold_under_3dol.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/oversold_under_3dol.ini
rename to gamestonk_terminal/stocks/screener/presets/oversold_under_3dol.ini
diff --git a/gamestonk_terminal/screener/presets/oversold_under_5dol.ini b/gamestonk_terminal/stocks/screener/presets/oversold_under_5dol.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/oversold_under_5dol.ini
rename to gamestonk_terminal/stocks/screener/presets/oversold_under_5dol.ini
diff --git a/gamestonk_terminal/screener/presets/potential_reversals.ini b/gamestonk_terminal/stocks/screener/presets/potential_reversals.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/potential_reversals.ini
rename to gamestonk_terminal/stocks/screener/presets/potential_reversals.ini
diff --git a/gamestonk_terminal/screener/presets/recent_growth_and_support.ini b/gamestonk_terminal/stocks/screener/presets/recent_growth_and_support.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/recent_growth_and_support.ini
rename to gamestonk_terminal/stocks/screener/presets/recent_growth_and_support.ini
diff --git a/gamestonk_terminal/screener/presets/rosenwald.ini b/gamestonk_terminal/stocks/screener/presets/rosenwald.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/rosenwald.ini
rename to gamestonk_terminal/stocks/screener/presets/rosenwald.ini
diff --git a/gamestonk_terminal/screener/presets/rosenwald_gtfo.ini b/gamestonk_terminal/stocks/screener/presets/rosenwald_gtfo.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/rosenwald_gtfo.ini
rename to gamestonk_terminal/stocks/screener/presets/rosenwald_gtfo.ini
diff --git a/gamestonk_terminal/screener/presets/sexy_year.ini b/gamestonk_terminal/stocks/screener/presets/sexy_year.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/sexy_year.ini
rename to gamestonk_terminal/stocks/screener/presets/sexy_year.ini
diff --git a/gamestonk_terminal/screener/presets/short_squeeze_scan.ini b/gamestonk_terminal/stocks/screener/presets/short_squeeze_scan.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/short_squeeze_scan.ini
rename to gamestonk_terminal/stocks/screener/presets/short_squeeze_scan.ini
diff --git a/gamestonk_terminal/screener/presets/simplistic_momentum_scanner_under_7dol.ini b/gamestonk_terminal/stocks/screener/presets/simplistic_momentum_scanner_under_7dol.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/simplistic_momentum_scanner_under_7dol.ini
rename to gamestonk_terminal/stocks/screener/presets/simplistic_momentum_scanner_under_7dol.ini
diff --git a/gamestonk_terminal/screener/presets/stocks_strong_support_levels.ini b/gamestonk_terminal/stocks/screener/presets/stocks_strong_support_levels.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/stocks_strong_support_levels.ini
rename to gamestonk_terminal/stocks/screener/presets/stocks_strong_support_levels.ini
diff --git a/gamestonk_terminal/screener/presets/template.ini b/gamestonk_terminal/stocks/screener/presets/template.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/template.ini
rename to gamestonk_terminal/stocks/screener/presets/template.ini
diff --git a/gamestonk_terminal/screener/presets/top_performers_all.ini b/gamestonk_terminal/stocks/screener/presets/top_performers_all.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/top_performers_all.ini
rename to gamestonk_terminal/stocks/screener/presets/top_performers_all.ini
diff --git a/gamestonk_terminal/screener/presets/top_performers_healthcare.ini b/gamestonk_terminal/stocks/screener/presets/top_performers_healthcare.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/top_performers_healthcare.ini
rename to gamestonk_terminal/stocks/screener/presets/top_performers_healthcare.ini
diff --git a/gamestonk_terminal/screener/presets/top_performers_tech.ini b/gamestonk_terminal/stocks/screener/presets/top_performers_tech.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/top_performers_tech.ini
rename to gamestonk_terminal/stocks/screener/presets/top_performers_tech.ini
diff --git a/gamestonk_terminal/screener/presets/under_15dol_stocks.ini b/gamestonk_terminal/stocks/screener/presets/under_15dol_stocks.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/under_15dol_stocks.ini
rename to gamestonk_terminal/stocks/screener/presets/under_15dol_stocks.ini
diff --git a/gamestonk_terminal/screener/presets/undervalue.ini b/gamestonk_terminal/stocks/screener/presets/undervalue.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/undervalue.ini
rename to gamestonk_terminal/stocks/screener/presets/undervalue.ini
diff --git a/gamestonk_terminal/screener/presets/unusual_volume.ini b/gamestonk_terminal/stocks/screener/presets/unusual_volume.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/unusual_volume.ini
rename to gamestonk_terminal/stocks/screener/presets/unusual_volume.ini
diff --git a/gamestonk_terminal/screener/presets/value_stocks.ini b/gamestonk_terminal/stocks/screener/presets/value_stocks.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/value_stocks.ini
rename to gamestonk_terminal/stocks/screener/presets/value_stocks.ini
diff --git a/gamestonk_terminal/screener/presets/weak_support_and_top_performers.ini b/gamestonk_terminal/stocks/screener/presets/weak_support_and_top_performers.ini
similarity index 100%
rename from gamestonk_terminal/screener/presets/weak_support_and_top_performers.ini
rename to gamestonk_terminal/stocks/screener/presets/weak_support_and_top_performers.ini
diff --git a/gamestonk_terminal/screener/screener_controller.py b/gamestonk_terminal/stocks/screener/screener_controller.py
similarity index 96%
rename from gamestonk_terminal/screener/screener_controller.py
rename to gamestonk_terminal/stocks/screener/screener_controller.py
index 365f3800697..d6524ad5c4d 100644
--- a/gamestonk_terminal/screener/screener_controller.py
+++ b/gamestonk_terminal/stocks/screener/screener_controller.py
@@ -13,12 +13,14 @@ from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.helper_funcs import (
parse_known_args_and_warn,
)
-from gamestonk_terminal.screener import finviz_view
-from gamestonk_terminal.screener import yahoo_finance_view
-from gamestonk_terminal.portfolio_optimization import po_controller
+from gamestonk_terminal.stocks.screener import finviz_view
+from gamestonk_terminal.stocks.screener import yahoo_finance_view
+from gamestonk_terminal.portfolio.portfolio_optimization import po_controller
presets_path = os.path.join(os.path.abspath(os.path.dirname(__file__)), "presets/")
+# pylint: disable=E1121
+
class ScreenerController:
"""Screener Controller class"""
@@ -301,11 +303,11 @@ def menu():
{c: None for c in scr_controller.CHOICES}
)
an_input = session.prompt(
- f"{get_flair()} (scr)> ",
+ f"{get_flair()} (stocks)>(scr)> ",
completer=completer,
)
else:
- an_input = input(f"{get_flair()} (scr)> ")
+ an_input = input(f"{get_flair()} (stocks)>(scr)> ")
try:
plt.close("all")
diff --git a/gamestonk_terminal/screener/yahoo_finance_view.py b/gamestonk_terminal/stocks/screener/yahoo_finance_view.py
similarity index 99%
rename from gamestonk_terminal/screener/yahoo_finance_view.py
rename to gamestonk_terminal/stocks/screener/yahoo_finance_view.py
index 544a228a509..fbf7c064b0a 100644
--- a/gamestonk_terminal/screener/yahoo_finance_view.py
+++ b/gamestonk_terminal/stocks/screener/yahoo_finance_view.py
@@ -8,7 +8,7 @@ from pandas.plotting import register_matplotlib_converters
import matplotlib.pyplot as plt
import yfinance as yf
from finvizfinance.screener import ticker
-from gamestonk_terminal.screener import finviz_view
+from gamestonk_terminal.stocks.screener import finviz_view
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.helper_funcs import (
parse_known_args_and_warn,
diff --git a/gamestonk_terminal/stocks/stocks_controller.py b/gamestonk_terminal/stocks/stocks_controller.py
new file mode 100644
index 00000000000..d6f55b6485b
--- /dev/null
+++ b/gamestonk_terminal/stocks/stocks_controller.py
@@ -0,0 +1,479 @@
+import argparse
+import os
+from typing import List
+import pandas as pd
+from prompt_toolkit.completion import NestedCompleter
+
+from gamestonk_terminal.helper_funcs import get_flair
+
+from gamestonk_terminal.helper_funcs import b_is_stock_market_open
+from gamestonk_terminal.menu import session
+from gamestonk_terminal import feature_flags as gtff
+
+from gamestonk_terminal.stocks.stocks_helper import clear, load, view, candle, quote
+
+from gamestonk_terminal.stocks.discovery import disc_controller
+from gamestonk_terminal.stocks.screener import screener_controller
+from gamestonk_terminal.stocks.insider import insider_controller
+from gamestonk_terminal.stocks.government import gov_controller
+from gamestonk_terminal.stocks.due_diligence import dd_controller
+from gamestonk_terminal.stocks.fundamental_analysis import fa_controller
+from gamestonk_terminal.stocks.research import res_controller
+from gamestonk_terminal.stocks.comparison_analysis import ca_controller
+from gamestonk_terminal.stocks.backtesting import bt_controller
+from gamestonk_terminal.stocks.technical_analysis import ta_controller
+from gamestonk_terminal.stocks.behavioural_analysis import ba_controller
+from gamestonk_terminal.stocks.residuals_analysis import ra_controller
+from gamestonk_terminal.stocks.exploratory_data_analysis import eda_controller
+from gamestonk_terminal.stocks.report import report_controller
+
+# pylint: disable=R1710
+
+
+class StocksController:
+ """Stocks Controller class"""
+
+ # To hold suffix for Yahoo Finance
+ suffix = ""
+
+ CHOICES = [
+ "cls",
+ "?",
+ "help",
+ "q",
+ "quit",
+ ]
+
+ CHOICES_COMMANDS = [
+ "load",
+ "quote",
+ "candle",
+ "view",
+ ]
+
+ CHOICES_MENUS = [
+ "ta",
+ "ba",
+ "eda",
+ "pred",
+ "ra",
+ "disc",
+ "scr",
+ "ins",
+ "gov",
+ "res",
+ "fa",
+ "bt",
+ "dd",
+ "ca",
+ "report",
+ ]
+
+ CHOICES += CHOICES_COMMANDS
+ CHOICES += CHOICES_MENUS
+
+ def __init__(self):
+ """Constructor"""
+ self.stocks_parser = argparse.ArgumentParser(add_help=False, prog="stocks")
+ self.stocks_parser.add_argument(
+ "cmd",
+ choices=self.CHOICES,
+ )
+ self.completer = NestedCompleter.from_nested_dict(
+ {c: None for c in self.CHOICES}
+ )
+
+ self.stock = pd.DataFrame()
+ self.ticker = ""
+ self.start = ""
+ self.interval = "1440min"
+
+ def print_help(self):
+ """Print help"""
+ help_text = """https://github.com/GamestonkTerminal/GamestonkTerminal/tree/main/gamestonk_terminal/stocks
+
+>> STOCKS <<
+
+What do you want to do?
+ cls clear screen
+ ?/help show this menu again
+ q quit this menu, and shows back to main menu
+ quit quit to abandon the program
+ """
+ s_intraday = (f"Intraday {self.interval}", "Daily")[self.interval == "1440min"]
+ if self.ticker and self.start:
+ help_text += f"\n{s_intraday} Stock: {self.ticker} (from {self.start.strftime('%Y-%m-%d')})\n"
+ elif self.ticker:
+ help_text += f"\n{s_intraday} Stock: {self.ticker}\n"
+ else:
+ help_text += "\nStock: ?\n"
+
+ help_text += f"Market {('CLOSED', 'OPEN')[b_is_stock_market_open()]}.\n"
+
+ help_text += """
+ clear clear a specific stock ticker from analysis
+ load load a specific stock ticker for analysis
+ quote view the current price for a specific stock ticker
+ candle view a candle chart for a specific stock ticker
+ view view and load a specific stock ticker for technical analysis
+
+> disc discover trending stocks, \t e.g. map, sectors, high short interest
+> scr screener stocks, \t\t e.g. overview/performance, using preset filters
+> gov government menu, \t\t house trading, contracts, corporate lobbying
+> dd in-depth due-diligence, \t e.g.: news, analyst, shorts, insider, sec
+> fa fundamental analysis, \t e.g.: income, balance, cash, earnings
+> res research web page, \t e.g.: macroaxis, yahoo finance, fool
+> ca comparison analysis, \t e.g.: historical, correlation, financials
+> bt strategy backtester, \t e.g.: simple ema, ema cross, rsi strategies
+> ta technical analysis, \t e.g.: ema, macd, rsi, adx, bbands, obv
+> ba behavioural analysis, \t from: reddit, stocktwits, twitter, google
+> eda exploratory data analysis,\t e.g.: decompose, cusum, residuals analysis
+> ra residuals analysis, \t e.g.: model fit, qqplot, hypothesis test
+> pred prediction techniques, \t e.g.: regression, arima, rnn, lstm
+> report generate automatic report, \t e.g.: dark pool, due diligence
+ """
+ print(help_text)
+
+ def switch(self, an_input: str):
+ """Process and dispatch input
+
+ Returns
+ -------
+ True, False, or None
+ False - quit the menu
+ True - quit the program
+ None - continue in the menu
+ """
+
+ # Empty command
+ if not an_input:
+ print("")
+ return None
+
+ (known_args, other_args) = self.stocks_parser.parse_known_args(an_input.split())
+
+ # Help menu again
+ if known_args.cmd == "?":
+ self.print_help()
+ return None
+
+ # Clear screen
+ if known_args.cmd == "cls":
+ os.system("cls||clear")
+ return None
+
+ return getattr(
+ self, "call_" + known_args.cmd, lambda: "command not recognized!"
+ )(other_args)
+
+ def call_help(self, _):
+ """Process Help Command"""
+ self.print_help()
+
+ def call_q(self, _):
+ """Process Q command - quit the menu"""
+ return False
+
+ def call_quit(self, _):
+ """Process Quit command - exit the program"""
+ return True
+
+ # COMMANDS
+ def call_clear(self, other_args: List[str]):
+ """Process clear command"""
+ self.ticker, self.start, self.interval, self.stock = clear(
+ other_args, self.ticker, self.start, self.interval, self.stock
+ )
+
+ def call_load(self, other_args: List[str]):
+ """Process load command"""
+ self.ticker, self.start, self.interval, self.stock = load(
+ other_args, self.ticker, self.start, self.interval, self.stock
+ )
+ if "." in self.ticker:
+ self.ticker, self.suffix = self.ticker.split(".")
+ else:
+ self.suffix = ""
+
+ def call_quote(self, other_args: List[str]):
+ """Process quote command"""
+ quote(
+ other_args, self.ticker + "." + self.suffix if self.suffix else self.ticker
+ )
+
+ def call_candle(self, other_args: List[str]):
+ """Process candle command"""
+ candle(
+ self.ticker + "." + self.suffix if self.suffix else self.ticker,
+ other_args,
+ )
+
+ def call_view(self, other_args: List[str]):
+ """Process view command"""
+ view(other_args, self.ticker, self.interval, self.stock)
+
+ # MENUS
+ def call_disc(self, _):
+ """Process disc command"""
+ ret = disc_controller.menu()
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_scr(self, _):
+ """Process scr command"""
+ ret = screener_controller.menu()
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_ins(self, _):
+ """Process ins command"""
+ ret = insider_controller.menu()
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_gov(self, _):
+ """Process gov command"""
+ ret = gov_controller.menu(self.ticker)
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_report(self, _):
+ """Process report command"""
+ ret = report_controller.menu()
+
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_res(self, _):
+ """Process res command"""
+ if not self.ticker:
+ print("Use 'load
' prior to this command!", "\n")
+ return
+
+ ret = res_controller.menu(
+ self.ticker,
+ self.start,
+ self.interval,
+ )
+
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_dd(self, _):
+ """Process dd command"""
+ if not self.ticker:
+ print("Use 'load ' prior to this command!", "\n")
+ return
+
+ ret = dd_controller.menu(
+ self.ticker,
+ self.start,
+ self.interval,
+ self.stock,
+ )
+
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_ca(self, _):
+ """Process ca command"""
+ if not self.ticker:
+ print("Use 'load ' prior to this command!", "\n")
+ return
+
+ ret = ca_controller.menu(self.ticker, self.start, self.interval, self.stock)
+
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_fa(self, _):
+ """Process fa command"""
+ if not self.ticker:
+ print("Use 'load ' prior to this command!", "\n")
+ return
+
+ ret = fa_controller.menu(
+ self.ticker,
+ self.start,
+ self.interval,
+ )
+
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_bt(self, _):
+ """Process bt command"""
+ if not self.ticker:
+ print("Use 'load ' prior to this command!", "\n")
+ return
+
+ ret = bt_controller.menu(
+ self.ticker,
+ self.start,
+ )
+
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_ta(self, _):
+ """Process ta command"""
+ if not self.ticker:
+ print("Use 'load ' prior to this command!", "\n")
+ return
+
+ ret = ta_controller.menu(
+ self.ticker,
+ self.start,
+ self.interval,
+ self.stock,
+ )
+
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_ba(self, _):
+ """Process ba command"""
+ if not self.ticker:
+ print("Use 'load ' prior to this command!", "\n")
+ return
+
+ ret = ba_controller.menu(
+ self.ticker,
+ self.start,
+ )
+
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_ra(self, _):
+ """Process ra command"""
+ if not self.ticker:
+ print("Use 'load ' prior to this command!", "\n")
+ return
+
+ ret = ra_controller.menu(
+ self.ticker,
+ self.start,
+ self.interval,
+ self.stock,
+ )
+
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_eda(self, _):
+ """Process eda command"""
+ if not self.ticker:
+ print("Use 'load ' prior to this command!", "\n")
+ return
+
+ if self.interval != "1440min":
+ # TODO: This menu should work regardless of data being daily or not!
+ print("Load daily data to use this menu!", "\n")
+ return
+
+ ret = eda_controller.menu(
+ self.ticker,
+ self.start,
+ self.interval,
+ self.stock,
+ )
+
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+ def call_pred(self, _):
+ """Process pred command"""
+ if not gtff.ENABLE_PREDICT:
+ print(
+ "Predict is disabled. Check ENABLE_PREDICT flag on feature_flags.py",
+ "\n",
+ )
+ return
+
+ if not self.ticker:
+ print("Use 'load ' prior to this command!", "\n")
+ return
+
+ if self.interval != "1440min":
+ # TODO: This menu should work regardless of data being daily or not!
+ print("Load daily data to use this menu!", "\n")
+ return
+
+ try:
+ # pylint: disable=import-outside-toplevel
+ from gamestonk_terminal.stocks.prediction_techniques import pred_controller
+ except ModuleNotFoundError as e:
+ print("One of the optional packages seems to be missing: ", e, "\n")
+ return
+ except Exception as e:
+ print(e, "\n")
+ return
+
+ ret = pred_controller.menu(
+ self.ticker,
+ self.start,
+ self.interval,
+ self.stock,
+ )
+
+ if ret is False:
+ self.print_help()
+ else:
+ return True
+
+
+def menu():
+ """Stocks Menu"""
+ stocks_controller = StocksController()
+ stocks_controller.call_help(None)
+ while True:
+ if session and gtff.USE_PROMPT_TOOLKIT:
+ completer = NestedCompleter.from_nested_dict(
+ {c: None for c in stocks_controller.CHOICES}
+ )
+
+ an_input = session.prompt(
+ f"{get_flair()} (stocks)> ",
+ completer=completer,
+ )
+ else:
+ an_input = input(f"{get_flair()} (stocks)> ")
+
+ try:
+ process_input = stocks_controller.switch(an_input)
+
+ if process_input is not None:
+ return process_input
+
+ except SystemExit:
+ print("The command selected doesn't exit\n")
+ continue
diff --git a/gamestonk_terminal/main_helper.py b/gamestonk_terminal/stocks/stocks_helper.py
similarity index 57%
rename from gamestonk_terminal/main_helper.py
rename to gamestonk_terminal/stocks/stocks_helper.py
index b3cca1f15db..8d5346d632f 100644
--- a/gamestonk_terminal/main_helper.py
+++ b/gamestonk_terminal/stocks/stocks_helper.py
@@ -2,44 +2,29 @@
__docformat__ = "numpy"
import argparse
from typing import List
-import os
-import sys
-import subprocess
-import random
from datetime import datetime, timedelta
-import hashlib
-import requests
-from colorama import Fore, Style
import matplotlib.pyplot as plt
from numpy.core.fromnumeric import transpose
import pandas as pd
from alpha_vantage.timeseries import TimeSeries
-import quandl
import mplfinance as mpf
import yfinance as yf
-from coinmarketcapapi import CoinMarketCapAPI, CoinMarketCapAPIError
import pytz
import pyEX
-from pyEX.common.exception import PyEXception
from tabulate import tabulate
-import praw
-from prawcore.exceptions import ResponseException
-
-# import git
# pylint: disable=no-member,too-many-branches,C0302
from gamestonk_terminal.helper_funcs import (
valid_date,
- plot_view_stock,
parse_known_args_and_warn,
plot_autoscale,
)
+from gamestonk_terminal import config_plot as cfgPlot
from gamestonk_terminal import config_terminal as cfg
from gamestonk_terminal import feature_flags as gtff
-from gamestonk_terminal import thought_of_the_day as thought
-from gamestonk_terminal.technical_analysis import trendline_api as trend
+from gamestonk_terminal.common.technical_analysis import trendline_api as trend
def clear(
@@ -655,383 +640,81 @@ def view(other_args: List[str], s_ticker: str, s_interval: str, df_stock: pd.Dat
return
-# pylint: disable=too-many-statements
+def plot_view_stock(df: pd.DataFrame, symbol: str, interval: str):
+ """
+ Plot the loaded stock dataframe
+ Parameters
+ ----------
+ df: Dataframe
+ Dataframe of prices and volumnes
+ symbol: str
+ Symbol of ticker
+ interval: str
+ Stock data resolution for plotting purposes
-
-def check_api_keys():
- """Check api keys and if they are supplied"""
-
- key_dict = {}
- if cfg.API_KEY_ALPHAVANTAGE == "REPLACE_ME": # pragma: allowlist secret
- key_dict["ALPHA_VANTAGE"] = "Not defined"
- else:
- df = TimeSeries(
- key=cfg.API_KEY_ALPHAVANTAGE, output_format="pandas"
- ).get_intraday(symbol="AAPL")
- if df[0].empty:
- key_dict["ALPHA_VANTAGE"] = "defined, test failed"
- else:
- key_dict["ALPHA_VANTAGE"] = "defined, test passed"
-
- if cfg.API_KEY_FINANCIALMODELINGPREP == "REPLACE_ME": # pragma: allowlist secret
- key_dict["FINANCIAL_MODELING_PREP"] = "Not defined"
- else:
- r = requests.get(
- f"https://financialmodelingprep.com/api/v3/profile/AAPL?apikey={cfg.API_KEY_FINANCIALMODELINGPREP}"
- )
- if r.status_code in [403, 401]:
- key_dict["FINANCIAL_MODELING_PREP"] = "defined, test failed"
- elif r.status_code == 200:
- key_dict["FINANCIAL_MODELING_PREP"] = "defined, test passed"
- else:
- key_dict["FINANCIAL_MODELING_PREP"] = "defined, test inconclusive"
-
- if cfg.API_KEY_QUANDL == "REPLACE_ME": # pragma: allowlist secret
- key_dict["QUANDL"] = "Not defined"
- else:
- try:
- quandl.save_key(cfg.API_KEY_QUANDL)
- quandl.get_table(
- "ZACKS/FC",
- paginate=True,
- ticker=["AAPL", "MSFT"],
- per_end_date={"gte": "2015-01-01"},
- qopts={"columns": ["ticker", "per_end_date"]},
- )
- key_dict["QUANDL"] = "defined, test passed"
- except quandl.errors.quandl_error.ForbiddenError:
- key_dict["QUANDL"] = "defined, test failed"
-
- if cfg.API_POLYGON_KEY == "REPLACE_ME":
- key_dict["POLYGON"] = "Not defined"
- else:
- r = requests.get(
- f"https://api.polygon.io/v2/aggs/ticker/AAPL/range/1/day/2020-06-01/2020-06-17?apiKey={cfg.API_POLYGON_KEY}"
- )
- if r.status_code in [403, 401]:
- key_dict["POLYGON"] = "defined, test failed"
- elif r.status_code == 200:
- key_dict["POLYGON"] = "defined, test passed"
- else:
- key_dict["POLYGON"] = "defined, test inconclusive"
-
- if cfg.API_FRED_KEY == "REPLACE_ME":
- key_dict["FRED"] = "Not defined"
- else:
- r = requests.get(
- f"https://api.stlouisfed.org/fred/series?series_id=GNPCA&api_key={cfg.API_FRED_KEY}"
- )
- if r.status_code in [403, 401, 400]:
- key_dict["FRED"] = "defined, test failed"
- elif r.status_code == 200:
- key_dict["FRED"] = "defined, test passed"
- else:
- key_dict["FRED"] = "defined, test inconclusive"
-
- if cfg.API_NEWS_TOKEN == "REPLACE_ME":
- key_dict["NEWSAPI"] = "Not defined"
- else:
- r = requests.get(
- f"https://newsapi.org/v2/everything?q=keyword&apiKey={cfg.API_NEWS_TOKEN}"
- )
- if r.status_code in [401, 403]:
- key_dict["NEWSAPI"] = "defined, test failed"
- elif r.status_code == 200:
- key_dict["NEWSAPI"] = "defined, test passed"
- else:
- key_dict["NEWSAPI"] = "defined, test inconclusive"
-
- if cfg.TRADIER_TOKEN == "REPLACE_ME":
- key_dict["TRADIER"] = "Not defined"
- else:
- r = requests.get(
- "https://sandbox.tradier.com/v1/markets/quotes",
- params={"symbols": "AAPL"},
- headers={
- "Authorization": f"Bearer {cfg.TRADIER_TOKEN}",
- "Accept": "application/json",
- },
- )
- if r.status_code in [401, 403]:
- key_dict["TRADIER"] = "defined, test failed"
- elif r.status_code == 200:
- key_dict["TRADIER"] = "defined, test passed"
- else:
- key_dict["TRADIER"] = "defined, test inconclusive"
-
- if cfg.API_CMC_KEY == "REPLACE_ME":
- key_dict["COINMARKETCAP"] = "Not defined"
- else:
- cmc = CoinMarketCapAPI(cfg.API_CMC_KEY)
- try:
- cmc.exchange_info()
- key_dict["COINMARKETCAP"] = "defined, test passed"
- except CoinMarketCapAPIError:
- key_dict["COINMARKETCAP"] = "defined, test failed"
-
- if cfg.API_FINNHUB_KEY == "REPLACE_ME":
- key_dict["FINNHUB"] = "Not defined"
- else:
- r = r = requests.get(
- f"https://finnhub.io/api/v1/quote?symbol=AAPL&token={cfg.API_FINNHUB_KEY}"
- )
- if r.status_code in [403, 401, 400]:
- key_dict["FINNHUB"] = "defined, test failed"
- elif r.status_code == 200:
- key_dict["FINNHUB"] = "defined, test passed"
- else:
- key_dict["FINNHUB"] = "defined, test inconclusive"
-
- if cfg.API_IEX_TOKEN == "REPLACE_ME":
- key_dict["IEXCLOUD"] = "Not defined"
- else:
- try:
- pyEX.Client(api_token=cfg.API_IEX_TOKEN, version="v1")
- key_dict["IEXCLOUD"] = "defined, test passed"
- except PyEXception:
- key_dict["IEXCLOUD"] = "defined, test failed"
-
- # Reddit
- reddit_keys = [
- cfg.API_REDDIT_CLIENT_ID,
- cfg.API_REDDIT_CLIENT_SECRET,
- cfg.API_REDDIT_USERNAME,
- cfg.API_REDDIT_PASSWORD,
- cfg.API_REDDIT_USER_AGENT,
- ]
- if "REPLACE_ME" in reddit_keys:
- key_dict["REDDIT"] = "Not defined"
- else:
- praw_api = praw.Reddit(
- client_id=cfg.API_REDDIT_CLIENT_ID,
- client_secret=cfg.API_REDDIT_CLIENT_SECRET,
- username=cfg.API_REDDIT_USERNAME,
- user_agent=cfg.API_REDDIT_USER_AGENT,
- password=cfg.API_REDDIT_PASSWORD,
- )
-
- try:
- praw_api.user.me()
- key_dict["REDDIT"] = "defined, test passed"
- except ResponseException:
- key_dict["REDDIT"] = "defined, test failed"
-
- # Twitter keys
- twitter_keys = [
- cfg.API_TWITTER_KEY,
- cfg.API_TWITTER_SECRET_KEY,
- cfg.API_TWITTER_BEARER_TOKEN,
- ]
- if "REPLACE_ME" in twitter_keys:
- key_dict["TWITTER"] = "Not defined"
- else:
- params = {
- "query": "(\\$AAPL) (lang:en)",
- "max_results": "10",
- "tweet.fields": "created_at,lang",
- }
- r = requests.get(
- "https://api.twitter.com/2/tweets/search/recent",
- params=params, # type: ignore
- headers={"authorization": "Bearer " + cfg.API_TWITTER_BEARER_TOKEN},
- )
- if r.status_code == 200:
- key_dict["TWITTER"] = "defined, test passed"
- elif r.status_code in [401, 403]:
- key_dict["TWITTER"] = "defined, test failed"
- else:
- key_dict["TWITTER"] = "defined, test inconclusive"
-
- # Robinhood keys
- rh_keys = [cfg.RH_USERNAME, cfg.RH_PASSWORD]
- if "REPLACE_ME" in rh_keys:
- key_dict["ROBINHOOD"] = "Not defined"
- else:
- key_dict["ROBINHOOD"] = "defined, not tested"
- # Degiro keys
- dg_keys = [cfg.DG_USERNAME, cfg.DG_PASSWORD, cfg.DG_TOTP_SECRET]
- if "REPLACE_ME" in dg_keys:
- key_dict["DEGIRO"] = "Not defined"
- else:
- key_dict["DEGIRO"] = "defined, not tested"
- # OANDA keys
- oanda_keys = [cfg.OANDA_TOKEN, cfg.OANDA_ACCOUNT]
- if "REPLACE_ME" in oanda_keys:
- key_dict["OANDA"] = "Not defined"
- else:
- key_dict["OANDA"] = "defined, not tested"
- # Binance keys
- bn_keys = [cfg.API_BINANCE_KEY, cfg.API_BINANCE_SECRET]
- if "REPLACE_ME" in bn_keys:
- key_dict["BINANCE"] = "Not defined"
- else:
- key_dict["BINANCE"] = "defined, not tested"
-
- # SentimentInvestor keys
- si_keys = [cfg.API_SENTIMENTINVESTOR_KEY, cfg.API_SENTIMENTINVESTOR_TOKEN]
- if "REPLACE_ME" in si_keys:
- key_dict["SENTIMENT_INVESTOR"] = "Not defined"
- else:
- account = requests.get(
- f"https://api.sentimentinvestor.com/v4/account"
- f"?token={cfg.API_SENTIMENTINVESTOR_TOKEN}&key={cfg.API_SENTIMENTINVESTOR_KEY}"
- )
- if account.ok and account.json().get("success", False):
- key_dict["SENTIMENT_INVESTOR"] = "Defined, test passed"
- else:
- key_dict["SENTIMENT_INVESTOR"] = "Defined, test unsuccessful"
-
- print(
- tabulate(
- pd.DataFrame(key_dict.items()),
- showindex=False,
- headers=[],
- tablefmt="fancy_grid",
- ),
- "\n",
- )
-
-
-def print_goodbye():
- """Prints a goodbye message when quitting the terminal"""
- goodbye_msg = [
- "An informed ape, is a strong ape. ",
- "Remember that stonks only go up. ",
- "Diamond hands. ",
- "Apes together strong. ",
- "This is our way. ",
- "Keep the spacesuit ape, we haven't reached the moon yet. ",
- "I am not a cat. I'm an ape. ",
- "We like the terminal. ",
- ]
-
- goodbye_hr = datetime.now().hour
- if goodbye_hr < 5:
- goodbye_msg_time = "Go get some rest soldier!"
- elif goodbye_hr < 11:
- goodbye_msg_time = "Rise and shine baby!"
- elif goodbye_hr < 17:
- goodbye_msg_time = "Enjoy your day!"
- elif goodbye_hr < 23:
- goodbye_msg_time = "Tomorrow's another day!"
- else:
- goodbye_msg_time = "Go get some rest soldier!"
-
- print(
- goodbye_msg[random.randint(0, len(goodbye_msg) - 1)] + goodbye_msg_time + "\n"
- )
-
-
-def sha256sum(filename):
- h = hashlib.sha256()
- b = bytearray(128 * 1024)
- mv = memoryview(b)
- with open(filename, "rb", buffering=0) as f:
- for n in iter(lambda: f.readinto(mv), 0):
- h.update(mv[:n])
- return h.hexdigest()
-
-
-def update_terminal():
- """Updates the terminal by running git pull in the directory. Runs poetry install if needed"""
- poetry_hash = sha256sum("poetry.lock")
-
- completed_process = subprocess.run("git pull", shell=True, check=False)
- if completed_process.returncode != 0:
- return completed_process.returncode
-
- new_poetry_hash = sha256sum("poetry.lock")
-
- if poetry_hash == new_poetry_hash:
- print("Great, seems like poetry hasn't been updated!")
- return completed_process.returncode
- print(
- "Seems like more modules have been added, grab a coke, this may take a while."
- )
-
- completed_process = subprocess.run("poetry install", shell=True, check=False)
- if completed_process.returncode != 0:
- return completed_process.returncode
-
- return 0
-
-
-def about_us():
- """Prints an about us section"""
- print(
- f"\n{Fore.GREEN}Thanks for using Gamestonk Terminal. This is our way!{Style.RESET_ALL}\n"
- "\n"
- f"{Fore.CYAN}Join our community on discord: {Style.RESET_ALL}https://discord.gg/Up2QGbMKHY\n"
- f"{Fore.CYAN}Follow our twitter for updates: {Style.RESET_ALL}https://twitter.com/gamestonkt\n"
- f"{Fore.CYAN}Access our landing page: {Style.RESET_ALL}https://gamestonkterminal.vercel.app\n"
- "\n"
- f"{Fore.YELLOW}Author:{Style.RESET_ALL} DidierRLopes\n"
- f"{Fore.YELLOW}Main Devs:{Style.RESET_ALL} jmaslek, aia\n"
- "\n"
- f"{Fore.YELLOW}Main Contributors:{Style.RESET_ALL}\n"
- f"{Fore.MAGENTA}Working towards a GUI using Qt:{Style.RESET_ALL} piiq, hinxx\n"
- f"{Fore.MAGENTA}Working on our landing page:{Style.RESET_ALL} jose-donato, crspy, martiaaz\n"
- f"{Fore.MAGENTA}Managing Twitter account:{Style.RESET_ALL} Meghan Hone\n"
- f"{Fore.MAGENTA}Responsible by developing Forex menu:{Style.RESET_ALL} alokan\n"
- f"{Fore.MAGENTA}Degiro's integration:{Style.RESET_ALL} Chavithra, Deel18\n"
- f"{Fore.MAGENTA}Preset screeners:{Style.RESET_ALL} Traceabl3\n"
- "\n"
- f"{Fore.YELLOW}Partnerships:{Style.RESET_ALL}\n"
- f"{Fore.CYAN}FinBrain: {Style.RESET_ALL}https://finbrain.tech\n"
- f"{Fore.CYAN}Quiver Quantitative: {Style.RESET_ALL}https://www.quiverquant.com\n"
- f"{Fore.CYAN}Ops.Syncretism: {Style.RESET_ALL}https://ops.syncretism.io/api.html\n"
- f"{Fore.CYAN}SentimentInvestor: {Style.RESET_ALL}https://sentimentinvestor.com\n"
- f"\n{Fore.RED}"
- "DISCLAIMER: Trading in financial instruments involves high risks including the risk of losing some, "
- "or all, of your investment amount, and may not be suitable for all investors. Before deciding to trade in "
- "financial instrument you should be fully informed of the risks and costs associated with trading the financial "
- "markets, carefully consider your investment objectives, level of experience, and risk appetite, and seek "
- "professional advice where needed. The data contained in Gamestonk Terminal (GST) is not necessarily accurate. "
- "GST and any provider of the data contained in this website will not accept liability for any loss or damage "
- "as a result of your trading, or your reliance on the information displayed."
- f"\n{Style.RESET_ALL}"
- )
-
-
-def bootup():
- # Enable VT100 Escape Sequence for WINDOWS 10 Ver. 1607
- if sys.platform == "win32":
- os.system("")
+ """
+ df.sort_index(ascending=True, inplace=True)
+ bar_colors = ["r" if x[1].Open < x[1].Close else "g" for x in df.iterrows()]
try:
- if os.name == "nt":
- # pylint: disable=E1101
- sys.stdin.reconfigure(encoding="utf-8")
- # pylint: disable=E1101
- sys.stdout.reconfigure(encoding="utf-8")
- except Exception as e:
- print(e, "\n")
-
- # Print first welcome message and help
- print("\nWelcome to Gamestonk Terminal Beta")
-
- # The commit has was commented out because the terminal was crashing due to git import for multiple users
- # ({str(git.Repo('.').head.commit)[:7]})
-
- if gtff.ENABLE_THOUGHTS_DAY:
- print("-------------------")
- try:
- thought.get_thought_of_the_day()
- except Exception as e:
- print(e)
- print("")
-
-
-def reset():
- """Resets the terminal. Allows for checking code or keys without quitting"""
- print("resetting...")
- plt.close("all")
- completed_process = subprocess.run("python terminal.py", shell=True, check=False)
- if completed_process.returncode != 0:
- completed_process = subprocess.run(
- "python3 terminal.py", shell=True, check=False
+ fig, ax = plt.subplots(
+ 2,
+ 1,
+ gridspec_kw={"height_ratios": [3, 1]},
+ figsize=plot_autoscale(),
+ dpi=cfgPlot.PLOT_DPI,
)
- if completed_process.returncode != 0:
- print("Unfortunately, resetting wasn't possible!\n")
+ except Exception as e:
+ print(e)
+ print(
+ "Encountered an error trying to open a chart window. Check your X server configuration."
+ )
+ return
- return completed_process.returncode
+ # In order to make nice Volume plot, make the bar width = interval
+ if interval == "1440min":
+ bar_width = timedelta(days=1)
+ title_string = "Daily"
+ else:
+ bar_width = timedelta(minutes=int(interval.split("m")[0]))
+ title_string = f"{int(interval.split('m')[0])} min"
+
+ ax[0].yaxis.tick_right()
+ if "Adj Close" in df.columns:
+ ax[0].plot(df.index, df["Adj Close"], c=cfgPlot.VIEW_COLOR)
+ else:
+ ax[0].plot(df.index, df["Close"], c=cfgPlot.VIEW_COLOR)
+ ax[0].set_xlim(df.index[0], df.index[-1])
+ ax[0].set_xticks([])
+ ax[0].yaxis.set_label_position("right")
+ ax[0].set_ylabel("Share Price ($)")
+ ax[0].grid(axis="y", color="gainsboro", linestyle="-", linewidth=0.5)
+
+ ax[0].spines["top"].set_visible(False)
+ ax[0].spines["left"].set_visible(False)
+ ax[1].bar(
+ df.index, df.Volume / 1_000_000, color=bar_colors, alpha=0.8, width=bar_width
+ )
+ ax[1].set_xlim(df.index[0], df.index[-1])
+ ax[1].yaxis.tick_right()
+ ax[1].yaxis.set_label_position("right")
+ ax[1].set_ylabel("Volume (1M)")
+ ax[1].grid(axis="y", color="gainsboro", linestyle="-", linewidth=0.5)
+ ax[1].spines["top"].set_visible(False)
+ ax[1].spines["left"].set_visible(False)
+ ax[1].set_xlabel("Time")
+ fig.suptitle(
+ symbol + " " + title_string,
+ size=20,
+ x=0.15,
+ y=0.95,
+ fontfamily="serif",
+ fontstyle="italic",
+ )
+ if gtff.USE_ION:
+ plt.ion()
+ fig.tight_layout(pad=2)
+ plt.setp(ax[1].get_xticklabels(), rotation=20, horizontalalignment="right")
+
+ plt.show()
+ print("")
diff --git a/gamestonk_terminal/stocks/technical_analysis/README.md b/gamestonk_terminal/stocks/technical_analysis/README.md
new file mode 100644
index 00000000000..9eb21bd0891
--- /dev/null
+++ b/gamestonk_terminal/stocks/technical_analysis/README.md
@@ -0,0 +1,212 @@
+# TECHNICAL ANALYSIS
+
+This menu aims to perform a technical analysis on a pre-loaded ticker chart, and the usage of the following commands along with an example will be exploited below.
+
+ * [view](#view)
+ - view historical data and trendlines [Finviz]
+ * [summary](#summary)
+ - technical summary report [FinBrain API]
+ * [recom](#recom)
+ - recommendation based on Technical Indicators [Tradingview API]
+ * [pr](#pr)
+ - pattern recognition [Finnhub]
+
+[OVERLAP](#OVERLAP)
+ * [ema](#ema)
+ - exponential moving average
+ * [sma](#sma)
+ - simple moving average
+ * [vwap](#vwap)
+ - volume weighted average price
+
+[MOMENTUM](#MOMENTUM)
+ * [cci](#cci)
+ - commodity channel index
+ * [macd](#macd)
+ - moving average convergence/divergence
+ * [rsi](#rsi)
+ - relative strength index
+ * [stoch](#stoch)
+ - stochastic oscillator
+
+[TREND](#TREND)
+ * [adx](#adx)
+ - average directional movement index
+ * [aroon](#aroon)
+ - aroon indicator
+
+[VOLATILITY](#VOLATILITY)
+ * [bbands](#bbands)
+ - bollinger bands
+
+[VOLUME](#VOLUME)
+ * [ad](#ad)
+ - Accumulation/distribution line values
+ * [obv](#obv)
+ - on balance volume
+
+[CUSTOM](#CUSTOM)
+ * [fib](#fib)
+ - Shows fibonocci levels
+
+
+**S/O to https://github.com/twopirllc/pandas-ta** _Owing to this library, it is fairly easy to add other technical indicators. So, let us know if there's any other that you would like._
+
+## view
+```
+usage: view
+```
+
+View historical price with trendlines. [Source: Finviz]
+
+
+
+
+## summary
+```
+usage: summary
+```
+
+Technical summary report provided by FinBrain's API. FinBrain Technologies develops deep learning algorithms for financial analysis and prediction, which currently serves traders from more than 150 countries all around the world. [Source: https://finbrain.tech]
+
+
+
+
+## recom
+```
+usage: recom [-s {crypto,forex,cfd}] [-e EXCHANGE] [-i {1M,1W,1d,4h,1h,15m,5m,1m}]
+```
+
+Print tradingview recommendation based on technical indicators. [Source: https://pypi.org/project/tradingview-ta/]
+
+* -s : screener. Default america.
+* -e : exchange, e.g. NASDAQ, NYSE. Default uses Alpha Vantage to get this information from ticker
+* -i : interval. Default is showing all of different intervals.
+
+
+
+
+## pr
+```
+usage: pr [-r {1,5,15,30,60,D,W,M}]
+```
+Display pattern recognition signals on the data. [Source: https://finnhub.io]
+
+* -r : Plot resolution to look for pattern signals. Default 'D'.
+
+
+
+
+
+
+# OVERLAP
+
+## ema
+```
+usage: ema [-l N_LENGTH] [-o N_OFFSET]
+```
+
+
+
+## sma
+```
+usage: sma [-l L_LENGTH] [-o N_OFFSET]
+```
+
+
+
+## vwap
+VWAP is available for intraday data. This plots the most recent day only.
+```
+usage: vwap [-o N_OFFSET]
+```
+
+
+
+# MOMENTUM
+
+## cci
+```
+usage: cci [-l N_LENGTH] [-s N_SCALAR] [-o N_OFFSET]
+```
+
+
+
+## macd
+```
+usage: macd [-f N_FAST] [-s N_SLOW] [--signal N_SIGNAL] [-o N_OFFSET]
+```
+
+
+
+## rsi
+```
+usage: rsi [-l N_LENGTH] [-s N_SCALAR] [-d N_DRIFT] [-o N_OFFSET]
+```
+
+
+
+## stoch
+```
+usage: stoch [-k N_FASTKPERIOD] [-d N_SLOWDPERIOD] [--slowkperiod N_SLOWKPERIOD] [-o N_OFFSET]
+```
+
+
+
+# TREND
+
+## adx
+```
+usage: adx [-l N_LENGTH] [-s N_SCALAR] [-d N_DRIFT] [-o N_OFFSET]
+```
+
+
+
+## aroon
+```
+usage: aroon [-l N_LENGTH] [-s N_SCALAR] [-o N_OFFSET]
+```
+
+
+
+# VOLATILITY
+
+## bbands
+```
+usage: bbands [-h] [-l N_LENGTH] [-s N_STD] [-m S_MAMODE] [-o N_OFFSET]
+```
+
+
+
+# VOLUME
+
+## ad
+```
+usage: ad [-o N_OFFSET] [--open]
+```
+
+
+
+## obv
+```
+usage: obv [-o N_OFFSET]
+```
+
+
+# CUSTOM
+
+## fib
+Shows fibonocci levels
+```python
+usage: fib [-p PERIOD] [--start] [--end]
+```
+* -p/--period: Number of days to lookback for retracement. Default = 120.
+* --start: Allows for custom selection of min point.
+* --end : Allows for custom selection of max point.
+
+The fibonocci retracement works by looking at a minimum and maximum point. Between these values, there is typically support/resistance at
+23.5 %, 38.2%, 50% and 61.8%. Those values follow the golden ratio from the fibonocci sequence.
+
+The `--start` and `--end` flags allow the user to select dates for the min and max points as your retracement levels. Both flags are required if using.
+
+
diff --git a/gamestonk_terminal/stocks/technical_analysis/__init__.py b/gamestonk_terminal/stocks/technical_analysis/__init__.py
new file mode 100644
index 00000000000..e69de29bb2d
diff --git a/gamestonk_terminal/technical_analysis/finbrain_view.py b/gamestonk_terminal/stocks/technical_analysis/finbrain_view.py
similarity index 100%
rename from gamestonk_terminal/technical_analysis/finbrain_view.py
rename to gamestonk_terminal/stocks/technical_analysis/finbrain_view.py
diff --git a/gamestonk_terminal/technical_analysis/finnhub_view.py b/gamestonk_terminal/stocks/technical_analysis/finnhub_view.py
similarity index 100%
rename from gamestonk_terminal/technical_analysis/finnhub_view.py
rename to gamestonk_terminal/stocks/technical_analysis/finnhub_view.py
diff --git a/gamestonk_terminal/technical_analysis/finviz_view.py b/gamestonk_terminal/stocks/technical_analysis/finviz_view.py
similarity index 100%
rename from gamestonk_terminal/technical_analysis/finviz_view.py
rename to gamestonk_terminal/stocks/technical_analysis/finviz_view.py
diff --git a/gamestonk_terminal/technical_analysis/ta_controller.py b/gamestonk_terminal/stocks/technical_analysis/ta_controller.py
similarity index 78%
rename from gamestonk_terminal/technical_analysis/ta_controller.py
rename to gamestonk_terminal/stocks/technical_analysis/ta_controller.py
index 3190cd791fe..6d50f82841f 100644
--- a/gamestonk_terminal/technical_analysis/ta_controller.py
+++ b/gamestonk_terminal/stocks/technical_analysis/ta_controller.py
@@ -12,16 +12,20 @@ from prompt_toolkit.completion import NestedCompleter
from gamestonk_terminal import feature_flags as gtff
from gamestonk_terminal.helper_funcs import get_flair
from gamestonk_terminal.menu import session
-from gamestonk_terminal.technical_analysis import momentum as ta_momentum
-from gamestonk_terminal.technical_analysis import overlap as ta_overlap
-from gamestonk_terminal.technical_analysis import trend_indicators as ta_trend
-from gamestonk_terminal.technical_analysis import volatility as ta_volatility
-from gamestonk_terminal.technical_analysis import volume as ta_volume
-from gamestonk_terminal.technical_analysis import finbrain_view
-from gamestonk_terminal.technical_analysis import tradingview_view
-from gamestonk_terminal.technical_analysis import finviz_view
-from gamestonk_terminal.technical_analysis import finnhub_view
-from gamestonk_terminal.technical_analysis import custom_indicators_view
+from gamestonk_terminal.stocks.technical_analysis import (
+ finviz_view,
+ finbrain_view,
+ finnhub_view,
+ tradingview_view,
+)
+from gamestonk_terminal.common.technical_analysis import (
+ custom_indicators_view,
+ momentum,
+ overlap,
+ trend_indicators,
+ volatility,
+ volume,
+)
class TechnicalAnalysisController:
@@ -86,7 +90,7 @@ class TechnicalAnalysisController:
else:
print(f"\n{s_intraday} Stock: {self.ticker}")
- print("\nTechnical Analysis:") # https://github.com/twopirllc/pandas-ta
+ print("\nTechnical Analysis:")
print(" cls clear screen")
print(" ?/help show this menu again")
print(" q quit this menu, and shows back to main menu")
@@ -164,6 +168,7 @@ class TechnicalAnalysisController:
"""Process Quit command - quit the program"""
return True
+ # SPECIFIC
def call_view(self, other_args: List[str]):
"""Process view command"""
finviz_view.view(other_args, self.ticker)
@@ -180,58 +185,54 @@ class TechnicalAnalysisController:
"""Process pr command"""
finnhub_view.pattern_recognition_view(other_args, self.ticker)
- # OVERLAP
+ # COMMON
def call_ema(self, other_args: List[str]):
"""Process ema command"""
- ta_overlap.ema(other_args, self.ticker, self.interval, self.stock)
+ overlap.ema(other_args, self.ticker, self.interval, self.stock)
def call_sma(self, other_args: List[str]):
"""Process sma command"""
- ta_overlap.sma(other_args, self.ticker, self.interval, self.stock)
+ overlap.sma(other_args, self.ticker, self.interval, self.stock)
def call_vwap(self, other_args: List[str]):
"""Process vwap command"""
- ta_overlap.vwap(other_args, self.ticker, self.interval, self.stock)
+ overlap.vwap(other_args, self.ticker, self.interval, self.stock)
- # MOMENTUM
def call_cci(self, other_args: List[str]):
"""Process cci command"""
- ta_momentum.cci(other_args, self.ticker, self.interval, self.stock)
+ momentum.cci(other_args, self.ticker, self.interval, self.stock)
def call_macd(self, other_args: List[str]):
"""Process macd command"""
- ta_momentum.macd(other_args, self.ticker, self.interval, self.stock)
+ momentum.macd(other_args, self.ticker, self.interval, self.stock)
def call_rsi(self, other_args: List[str]):
"""Process rsi command"""
- ta_momentum.rsi(other_args, self.ticker, self.interval, self.stock)
+ momentum.rsi(other_args, self.ticker, self.interval, self.stock)
def call_stoch(self, other_args: List[str]):
"""Process stoch command"""
- ta_momentum.stoch(other_args, self.ticker, self.interval, self.stock)
+ momentum.stoch(other_args, self.ticker, self.interval, self.stock)
- # TREND
def call_adx(self, other_args: List[str]):
"""Process adx command"""
- ta_trend.adx(other_args, self.ticker, self.interval, self.stock)
+ trend_indicators.adx(other_args, self.ticker, self.interval, self.stock)
def call_aroon(self, other_args: List[str]):
"""Process aroon command"""
- ta_trend.aroon(other_args, self.ticker, self.interval, self.stock)
+ trend_indicators.aroon(other_args, self.ticker, self.interval, self.stock)
- # VOLATILITY
def call_bbands(self, other_args: List[str]):
"""Process bbands command"""
- ta_volatility.bbands(other_args, self.ticker, self.interval, self.stock)
+ volatility.bbands(other_args, self.ticker, self.interval, self.stock)
- # VOLUME
def call_ad(self, other_args: List[str]):
"""Process ad command"""
- ta_volume.ad(other_args, self.ticker, self.interval, self.stock)
+ volume.ad(other_args, self.ticker, self.interval, self.stock)
def call_obv(self, other_args: List[str]):
"""Process obv command"""
- ta_volume.obv(other_args, self.ticker, self.interval, self.stock)
+ volume.obv(other_args, self.ticker, self.interval, self.stock)
def call_fib(self, other_args: List[str]):
"""Process fib command"""
@@ -240,17 +241,12 @@ class TechnicalAnalysisController:
)
-def menu(
- ticker: str, start: datetime, interval: str, stock: pd.DataFrame, context: str = ""
-):
+def menu(ticker: str, start: datetime, interval: str, stock: pd.DataFrame):
"""Technical Analysis Menu"""
ta_controller = TechnicalAnalysisController(ticker, start, interval, stock)
ta_controller.call_help(None)
- if context:
- context = f"{context}>"
-
while True:
# Get input command from user
if session and gtff.USE_PROMPT_TOOLKIT:
@@ -258,11 +254,11 @@ def menu(
{c: None for c in ta_controller.CHOICES}
)
an_input = session.prompt(
- f"{get_flair()} {context}(ta)> ",
+ f"{get_flair()} (stocks)>(ta)> ",
completer=completer,
)
else:
- an_input = input(f"{get_flair()} {context}(ta)> ")
+ an_input = input(f"{get_flair()} (stocks)>(ta)> ")
try:
plt.close("all")
diff --git a/gamestonk_terminal/technical_analysis/tradingview_view.py b/gamestonk_terminal/stocks/technical_analysis/tradingview_view.py
similarity index 100%
rename from gamestonk_terminal/technical_analysis/tradingview_view.py
rename to gamestonk_terminal/stocks/technical_analysis/tradingview_view.py
diff --git a/gamestonk_terminal/terminal_helper.py b/gamestonk_terminal/terminal_helper.py
new file mode 100644
index 00000000000..01f77f6e105
--- /dev/null
+++ b/gamestonk_terminal/terminal_helper.py
@@ -0,0 +1,410 @@
+"""Terminal helper"""
+__docformat__ = "numpy"
+import os
+import sys
+import subprocess
+import random
+from datetime import datetime
+import hashlib
+import requests
+from colorama import Fore, Style
+import matplotlib.pyplot as plt
+import pandas as pd
+from alpha_vantage.timeseries import TimeSeries
+import quandl
+from coinmarketcapapi import CoinMarketCapAPI, CoinMarketCapAPIError
+import pyEX
+from pyEX.common.exception import PyEXception
+from tabulate import tabulate
+import praw
+from prawcore.exceptions import ResponseException
+
+# import git
+
+# pylint: disable=no-member,too-many-branches,C0302
+
+from gamestonk_terminal import config_terminal as cfg
+from gamestonk_terminal import feature_flags as gtff
+from gamestonk_terminal import thought_of_the_day as thought
+
+
+# pylint: disable=too-many-statements
+
+
+def check_api_keys():
+ """Check api keys and if they are supplied"""
+
+ key_dict = {}
+ if cfg.API_KEY_ALPHAVANTAGE == "REPLACE_ME": # pragma: allowlist secret
+ key_dict["ALPHA_VANTAGE"] = "Not defined"
+ else:
+ df = TimeSeries(
+ key=cfg.API_KEY_ALPHAVANTAGE, output_format="pandas"
+ ).get_intraday(symbol="AAPL")
+ if df[0].empty:
+ key_dict["ALPHA_VANTAGE"] = "defined, test failed"
+ else:
+ key_dict["ALPHA_VANTAGE"] = "defined, test passed"
+
+ if cfg.API_KEY_FINANCIALMODELINGPREP == "REPLACE_ME": # pragma: allowlist secret
+ key_dict["FINANCIAL_MODELING_PREP"] = "Not defined"
+ else:
+ r = requests.get(
+ f"https://financialmodelingprep.com/api/v3/profile/AAPL?apikey={cfg.API_KEY_FINANCIALMODELINGPREP}"
+ )
+ if r.status_code in [403, 401]:
+ key_dict["FINANCIAL_MODELING_PREP"] = "defined, test failed"
+ elif r.status_code == 200:
+ key_dict["FINANCIAL_MODELING_PREP"] = "defined, test passed"
+ else:
+ key_dict["FINANCIAL_MODELING_PREP"] = "defined, test inconclusive"
+
+ if cfg.API_KEY_QUANDL == "REPLACE_ME": # pragma: allowlist secret
+ key_dict["QUANDL"] = "Not defined"
+ else:
+ try:
+ quandl.save_key(cfg.API_KEY_QUANDL)
+ quandl.get_table(
+ "ZACKS/FC",
+ paginate=True,
+ ticker=["AAPL", "MSFT"],
+ per_end_date={"gte": "2015-01-01"},
+ qopts={"columns": ["ticker", "per_end_date"]},
+ )
+ key_dict["QUANDL"] = "defined, test passed"
+ except quandl.errors.quandl_error.ForbiddenError:
+ key_dict["QUANDL"] = "defined, test failed"
+
+ if cfg.API_POLYGON_KEY == "REPLACE_ME":
+ key_dict["POLYGON"] = "Not defined"
+ else:
+ r = requests.get(
+ f"https://api.polygon.io/v2/aggs/ticker/AAPL/range/1/day/2020-06-01/2020-06-17?apiKey={cfg.API_POLYGON_KEY}"
+ )
+ if r.status_code in [403, 401]:
+ key_dict["POLYGON"] = "defined, test failed"
+ elif r.status_code == 200:
+ key_dict["POLYGON"] = "defined, test passed"
+ else:
+ key_dict["POLYGON"] = "defined, test inconclusive"
+
+ if cfg.API_FRED_KEY == "REPLACE_ME":
+ key_dict["FRED"] = "Not defined"
+ else:
+ r = requests.get(
+ f"https://api.stlouisfed.org/fred/series?series_id=GNPCA&api_key={cfg.API_FRED_KEY}"
+ )
+ if r.status_code in [403, 401, 400]:
+ key_dict["FRED"] = "defined, test failed"
+ elif r.status_code == 200:
+ key_dict["FRED"] = "defined, test passed"
+ else:
+ key_dict["FRED"] = "defined, test inconclusive"
+
+ if cfg.API_NEWS_TOKEN == "REPLACE_ME":
+ key_dict["NEWSAPI"] = "Not defined"
+ else:
+ r = requests.get(
+ f"https://newsapi.org/v2/everything?q=keyword&apiKey={cfg.API_NEWS_TOKEN}"
+ )
+ if r.status_code in [401, 403]:
+ key_dict["NEWSAPI"] = "defined, test failed"
+ elif r.status_code == 200:
+ key_dict["NEWSAPI"] = "defined, test passed"
+ else:
+ key_dict["NEWSAPI"] = "defined, test inconclusive"
+
+ if cfg.TRADIER_TOKEN == "REPLACE_ME":
+ key_dict["TRADIER"] = "Not defined"
+ else:
+ r = requests.get(
+ "https://sandbox.tradier.com/v1/markets/quotes",
+ params={"symbols": "AAPL"},
+ headers={
+ "Authorization": f"Bearer {cfg.TRADIER_TOKEN}",
+ "Accept": "application/json",
+ },
+ )
+ if r.status_code in [401, 403]:
+ key_dict["TRADIER"] = "defined, test failed"
+ elif r.status_code == 200:
+ key_dict["TRADIER"] = "defined, test passed"
+ else:
+ key_dict["TRADIER"] = "defined, test inconclusive"
+
+ if cfg.API_CMC_KEY == "REPLACE_ME":
+ key_dict["COINMARKETCAP"] = "Not defined"
+ else:
+ cmc = CoinMarketCapAPI(cfg.API_CMC_KEY)
+ try:
+ cmc.exchange_info()
+ key_dict["COINMARKETCAP"] = "defined, test passed"
+ except CoinMarketCapAPIError:
+ key_dict["COINMARKETCAP"] = "defined, test failed"
+
+ if cfg.API_FINNHUB_KEY == "REPLACE_ME":
+ key_dict["FINNHUB"] = "Not defined"
+ else:
+ r = r = requests.get(
+ f"https://finnhub.io/api/v1/quote?symbol=AAPL&token={cfg.API_FINNHUB_KEY}"
+ )
+ if r.status_code in [403, 401, 400]:
+ key_dict["FINNHUB"] = "defined, test failed"
+ elif r.status_code == 200:
+ key_dict["FINNHUB"] = "defined, test passed"
+ else:
+ key_dict["FINNHUB"] = "defined, test inconclusive"
+
+ if cfg.API_IEX_TOKEN == "REPLACE_ME":
+ key_dict["IEXCLOUD"] = "Not defined"
+ else:
+ try:
+ pyEX.Client(api_token=cfg.API_IEX_TOKEN, version="v1")
+ key_dict["IEXCLOUD"] = "defined, test passed"
+ except PyEXception:
+ key_dict["IEXCLOUD"] = "defined, test failed"
+
+ # Reddit
+ reddit_keys = [
+ cfg.API_REDDIT_CLIENT_ID,
+ cfg.API_REDDIT_CLIENT_SECRET,
+ cfg.API_REDDIT_USERNAME,
+ cfg.API_REDDIT_PASSWORD,
+ cfg.API_REDDIT_USER_AGENT,
+ ]
+ if "REPLACE_ME" in reddit_keys:
+ key_dict["REDDIT"] = "Not defined"
+ else:
+ praw_api = praw.Reddit(
+ client_id=cfg.API_REDDIT_CLIENT_ID,
+ client_secret=cfg.API_REDDIT_CLIENT_SECRET,
+ username=cfg.API_REDDIT_USERNAME,
+ user_agent=cfg.API_REDDIT_USER_AGENT,
+ password=cfg.API_REDDIT_PASSWORD,
+ )
+
+ try:
+ praw_api.user.me()
+ key_dict["REDDIT"] = "defined, test passed"
+ except ResponseException:
+ key_dict["REDDIT"] = "defined, test failed"
+
+ # Twitter keys
+ twitter_keys = [
+ cfg.API_TWITTER_KEY,
+ cfg.API_TWITTER_SECRET_KEY,
+ cfg.API_TWITTER_BEARER_TOKEN,
+ ]
+ if "REPLACE_ME" in twitter_keys:
+ key_dict["TWITTER"] = "Not defined"
+ else:
+ params = {
+ "query": "(\\$AAPL) (lang:en)",
+ "max_results": "10",
+ "tweet.fields": "created_at,lang",
+ }
+ r = requests.get(
+ "https://api.twitter.com/2/tweets/search/recent",
+ params=params, # type: ignore
+ headers={"authorization": "Bearer " + cfg.API_TWITTER_BEARER_TOKEN},
+ )
+ if r.status_code == 200:
+ key_dict["TWITTER"] = "defined, test passed"
+ elif r.status_code in [401, 403]:
+ key_dict["TWITTER"] = "defined, test failed"
+ else:
+ key_dict["TWITTER"] = "defined, test inconclusive"
+
+ # Robinhood keys
+ rh_keys = [cfg.RH_USERNAME, cfg.RH_PASSWORD]
+ if "REPLACE_ME" in rh_keys:
+ key_dict["ROBINHOOD"] = "Not defined"
+ else:
+ key_dict["ROBINHOOD"] = "defined, not tested"
+ # Degiro keys
+ dg_keys = [cfg.DG_USERNAME, cfg.DG_PASSWORD, cfg.DG_TOTP_SECRET]
+ if "REPLACE_ME" in dg_keys:
+ key_dict["DEGIRO"] = "Not defined"
+ else:
+ key_dict["DEGIRO"] = "defined, not tested"
+ # OANDA keys
+ oanda_keys = [cfg.OANDA_TOKEN, cfg.OANDA_ACCOUNT]
+ if "REPLACE_ME" in oanda_keys:
+ key_dict["OANDA"] = "Not defined"
+ else:
+ key_dict["OANDA"] = "defined, not tested"
+ # Binance keys
+ bn_keys = [cfg.API_BINANCE_KEY, cfg.API_BINANCE_SECRET]
+ if "REPLACE_ME" in bn_keys:
+ key_dict["BINANCE"] = "Not defined"
+ else:
+ key_dict["BINANCE"] = "defined, not tested"
+
+ # SentimentInvestor keys
+ si_keys = [cfg.API_SENTIMENTINVESTOR_KEY, cfg.API_SENTIMENTINVESTOR_TOKEN]
+ if "REPLACE_ME" in si_keys:
+ key_dict["SENTIMENT_INVESTOR"] = "Not defined"
+ else:
+ account = requests.get(
+ f"https://api.sentimentinvestor.com/v4/account"
+ f"?token={cfg.API_SENTIMENTINVESTOR_TOKEN}&key={cfg.API_SENTIMENTINVESTOR_KEY}"
+ )
+ if account.ok and account.json().get("success", False):
+ key_dict["SENTIMENT_INVESTOR"] = "Defined, test passed"
+ else:
+ key_dict["SENTIMENT_INVESTOR"] = "Defined, test unsuccessful"
+
+ print(
+ tabulate(
+ pd.DataFrame(key_dict.items()),
+ showindex=False,
+ headers=[],
+ tablefmt="fancy_grid",
+ ),
+ "\n",
+ )
+
+
+def print_goodbye():
+ """Prints a goodbye message when quitting the terminal"""
+ goodbye_msg = [
+ "An informed ape, is a strong ape. ",
+ "Remember that stonks only go up. ",
+ "Diamond hands. ",
+ "Apes together strong. ",
+ "This is our way. ",
+ "Keep the spacesuit ape, we haven't reached the moon yet. ",
+ "I am not a cat. I'm an ape. ",
+ "We like the terminal. ",
+ ]
+
+ goodbye_hr = datetime.now().hour
+ if goodbye_hr < 5:
+ goodbye_msg_time = "Go get some rest soldier!"
+ elif goodbye_hr < 11:
+ goodbye_msg_time = "Rise and shine baby!"
+ elif goodbye_hr < 17:
+ goodbye_msg_time = "Enjoy your day!"
+ elif goodbye_hr < 23:
+ goodbye_msg_time = "Tomorrow's another day!"
+ else:
+ goodbye_msg_time = "Go get some rest soldier!"
+
+ print(
+ goodbye_msg[random.randint(0, len(goodbye_msg) - 1)] + goodbye_msg_time + "\n"
+ )
+
+
+def sha256sum(filename):
+ h = hashlib.sha256()
+ b = bytearray(128 * 1024)
+ mv = memoryview(b)
+ with open(filename, "rb", buffering=0) as f:
+ for n in iter(lambda: f.readinto(mv), 0):
+ h.update(mv[:n])
+ return h.hexdigest()
+
+
+def update_terminal():
+ """Updates the terminal by running git pull in the directory. Runs poetry install if needed"""
+ poetry_hash = sha256sum("poetry.lock")
+
+ completed_process = subprocess.run("git pull", shell=True, check=False)
+ if completed_process.returncode != 0:
+ return completed_process.returncode
+
+ new_poetry_hash = sha256sum("poetry.lock")
+
+ if poetry_hash == new_poetry_hash:
+ print("Great, seems like poetry hasn't been updated!")
+ return completed_process.returncode
+ print(
+ "Seems like more modules have been added, grab a coke, this may take a while."
+ )
+
+ completed_process = subprocess.run("poetry install", shell=True, check=False)
+ if completed_process.returncode != 0:
+ return completed_process.returncode
+
+ return 0
+
+
+def about_us():
+ """Prints an about us section"""
+ print(
+ f"\n{Fore.GREEN}Thanks for using Gamestonk Terminal. This is our way!{Style.RESET_ALL}\n"
+ "\n"
+ f"{Fore.CYAN}Join our community on discord: {Style.RESET_ALL}https://discord.gg/Up2QGbMKHY\n"
+ f"{Fore.CYAN}Follow our twitter for updates: {Style.RESET_ALL}https://twitter.com/gamestonkt\n"
+ f"{Fore.CYAN}Access our landing page: {Style.RESET_ALL}https://gamestonkterminal.vercel.app\n"
+ "\n"
+ f"{Fore.YELLOW}Author:{Style.RESET_ALL} DidierRLopes\n"
+ f"{Fore.YELLOW}Main Devs:{Style.RESET_ALL} jmaslek, aia\n"
+ "\n"
+ f"{Fore.YELLOW}Main Contributors:{Style.RESET_ALL}\n"
+ f"{Fore.MAGENTA}Working towards a GUI using Qt:{Style.RESET_ALL} piiq, hinxx\n"
+ f"{Fore.MAGENTA}Working on our landing page:{Style.RESET_ALL} jose-donato, crspy, martiaaz\n"
+ f"{Fore.MAGENTA}Managing Twitter account:{Style.RESET_ALL} Meghan Hone\n"
+ f"{Fore.MAGENTA}Responsible by developing Forex menu:{Style.RESET_ALL} alokan\n"
+ f"{Fore.MAGENTA}Degiro's integration:{Style.RESET_ALL} Chavithra, Deel18\n"
+ f"{Fore.MAGENTA}Preset screeners:{Style.RESET_ALL} Traceabl3\n"
+ "\n"
+ f"{Fore.YELLOW}Partnerships:{Style.RESET_ALL}\n"
+ f"{Fore.CYAN}FinBrain: {Style.RESET_ALL}https://finbrain.tech\n"
+ f"{Fore.CYAN}Quiver Quantitative: {Style.RESET_ALL}https://www.quiverquant.com\n"
+ f"{Fore.CYAN}Ops.Syncretism: {Style.RESET_ALL}https://ops.syncretism.io/api.html\n"
+ f"{Fore.CYAN}SentimentInvestor: {Style.RESET_ALL}https://sentimentinvestor.com\n"
+ f"\n{Fore.RED}"
+ "DISCLAIMER: Trading in financial instruments involves high risks including the risk of losing some, "
+ "or all, of your investment amount, and may not be suitable for all investors. Before deciding to trade in "
+ "financial instrument you should be fully informed of the risks and costs associated with trading the financial "
+ "markets, carefully consider your investment objectives, level of experience, and risk appetite, and seek "
+ "professional advice where needed. The data contained in Gamestonk Terminal (GST) is not necessarily accurate. "
+ "GST and any provider of the data contained in this website will not accept liability for any loss or damage "
+ "as a result of your trading, or your reliance on the information displayed."
+ f"\n{Style.RESET_ALL}"
+ )
+
+
+def bootup():
+ # Enable VT100 Escape Sequence for WINDOWS 10 Ver. 1607
+ if sys.platform == "win32":
+ os.system("")
+
+ try:
+ if os.name == "nt":
+ # pylint: disable=E1101
+ sys.stdin.reconfigure(encoding="utf-8")
+ # pylint: disable=E1101
+ sys.stdout.reconfigure(encoding="utf-8")
+ except Exception as e:
+ print(e, "\n")
+
+ # Print first welcome message and help
+ print("\nWelcome to Gamestonk Terminal Beta")
+
+ # The commit has was commented out because the terminal was crashing due to git import for multiple users
+ # ({str(git.Repo('.').head.commit)[:7]})
+
+ if gtff.ENABLE_THOUGHTS_DAY:
+ print("-------------------")
+ try:
+ thought.get_thought_of_the_day()
+ except Exception as e:
+ print(e)
+ print("")
+
+
+def reset():
+ """Resets the terminal. Allows for checking code or keys without quitting"""
+ print("resetting...")
+ plt.close("all")
+ completed_process = subprocess.run("python terminal.py", shell=True, check=False)
+ if completed_process.returncode != 0:
+ completed_process = subprocess.run(
+ "python3 terminal.py", shell=True, check=False
+ )
+ if completed_process.returncode != 0:
+ print("Unfortunately, resetting wasn't possible!\n")
+
+ return completed_process.returncode
diff --git a/notebooks/templates/crypto_market.ipynb b/notebooks/templates/crypto_market.ipynb
index a6fc469534c..3f32abec8bc 100644
--- a/notebooks/templates/crypto_market.ipynb
+++ b/notebooks/templates/crypto_market.ipynb
@@ -3,8 +3,10 @@
{
"cell_type": "code",
"execution_count": 47,
- "id": "atomic-accessory",
- "metadata": {},
+ "id": "exempt-thesaurus",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"import importlib\n",
@@ -25,8 +27,9 @@
{
"cell_type": "code",
"execution_count": 48,
- "id": "early-oxford",
+ "id": "latest-waste",
"metadata": {
+ "collapsed": true,
"tags": [
"parameters"
]
@@ -39,7 +42,7 @@
{
"cell_type": "code",
"execution_count": 49,
- "id": "extra-tennessee",
+ "id": "tamil-laundry",
"metadata": {},
"outputs": [
{
@@ -62,8 +65,10 @@
{
"cell_type": "code",
"execution_count": 50,
- "id": "lovely-communications",
- "metadata": {},
+ "id": "hungry-beverage",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"from gamestonk_terminal.cryptocurrency.coingecko import pycoingecko_view as cg\n",
@@ -72,7 +77,7 @@
},
{
"cell_type": "markdown",
- "id": "ee21a8d8",
+ "id": "round-connection",
"metadata": {},
"source": [
"## Bitcoin Chart"
@@ -81,8 +86,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "f9872e1e",
- "metadata": {},
+ "id": "discrete-olive",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"cp.chart(\"btc-bitcoin\", [\"-d\", \"60\"])"
@@ -90,7 +97,7 @@
},
{
"cell_type": "markdown",
- "id": "criminal-connection",
+ "id": "capable-guidance",
"metadata": {},
"source": [
"## Global Market Information"
@@ -99,7 +106,7 @@
{
"cell_type": "code",
"execution_count": 51,
- "id": "indonesian-stuff",
+ "id": "removed-billy",
"metadata": {},
"outputs": [
{
@@ -145,7 +152,7 @@
},
{
"cell_type": "markdown",
- "id": "c4af059a",
+ "id": "dental-productivity",
"metadata": {},
"source": [
"## Hot news"
@@ -154,7 +161,7 @@
{
"cell_type": "code",
"execution_count": 64,
- "id": "72401875",
+ "id": "positive-switch",
"metadata": {},
"outputs": [
{
@@ -247,7 +254,7 @@
},
{
"cell_type": "markdown",
- "id": "4cb62372",
+ "id": "organizational-recognition",
"metadata": {},
"source": [
"## Top coins market information"
@@ -256,7 +263,7 @@
{
"cell_type": "code",
"execution_count": 65,
- "id": "3e0a2546",
+ "id": "organizational-accuracy",
"metadata": {},
"outputs": [
{
@@ -308,7 +315,7 @@
},
{
"cell_type": "markdown",
- "id": "recognized-affair",
+ "id": "twenty-consideration",
"metadata": {},
"source": [
"## Top gainers in last 24h"
@@ -317,7 +324,7 @@
{
"cell_type": "code",
"execution_count": 53,
- "id": "special-certification",
+ "id": "written-insight",
"metadata": {},
"outputs": [
{
@@ -367,7 +374,7 @@
},
{
"cell_type": "markdown",
- "id": "473b49ae",
+ "id": "compliant-orleans",
"metadata": {},
"source": [
"## Top losers in last 24h"
@@ -376,7 +383,7 @@
{
"cell_type": "code",
"execution_count": 54,
- "id": "38e7f387",
+ "id": "sound-memorabilia",
"metadata": {},
"outputs": [
{
@@ -426,7 +433,7 @@
},
{
"cell_type": "markdown",
- "id": "5285e27d",
+ "id": "collaborative-chrome",
"metadata": {},
"source": [
"## Top coins with most positive sentiment"
@@ -435,7 +442,7 @@
{
"cell_type": "code",
"execution_count": 55,
- "id": "0ae215bc",
+ "id": "featured-creek",
"metadata": {},
"outputs": [
{
@@ -485,7 +492,7 @@
},
{
"cell_type": "markdown",
- "id": "indoor-printing",
+ "id": "champion-repository",
"metadata": {},
"source": [
"## Decentralized Finance Global Market Info"
@@ -494,7 +501,7 @@
{
"cell_type": "code",
"execution_count": 56,
- "id": "consolidated-childhood",
+ "id": "governing-navigation",
"metadata": {},
"outputs": [
{
@@ -528,7 +535,7 @@
},
{
"cell_type": "markdown",
- "id": "1aab8cf7",
+ "id": "decreased-twins",
"metadata": {},
"source": [
"## Top DeFi Coins"
@@ -537,7 +544,7 @@
{
"cell_type": "code",
"execution_count": 57,
- "id": "minus-cross",
+ "id": "descending-fiber",
"metadata": {
"scrolled": false
},
@@ -589,7 +596,7 @@
},
{
"cell_type": "markdown",
- "id": "d5431bb2",
+ "id": "armed-martial",
"metadata": {},
"source": [
"## Top Decentralized Exchanges"
@@ -598,7 +605,7 @@
{
"cell_type": "code",
"execution_count": 58,
- "id": "0adedc11",
+ "id": "promotional-pantyhose",
"metadata": {},
"outputs": [
{
@@ -638,7 +645,7 @@
},
{
"cell_type": "markdown",
- "id": "8d92faa0",
+ "id": "north-shelter",
"metadata": {},
"source": [
"## Top Yield Farms"
@@ -647,7 +654,7 @@
{
"cell_type": "code",
"execution_count": 59,
- "id": "1e386cf8",
+ "id": "unusual-playback",
"metadata": {},
"outputs": [
{
@@ -699,7 +706,7 @@
{
"cell_type": "code",
"execution_count": 60,
- "id": "central-jacob",
+ "id": "turkish-binary",
"metadata": {},
"outputs": [
{
@@ -936,8 +943,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "957a30c6",
- "metadata": {},
+ "id": "fatal-court",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": []
}
@@ -959,7 +968,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.10"
+ "version": "3.6.8"
}
},
"nbformat": 4,
diff --git a/notebooks/templates/dark_pool.ipynb b/notebooks/templates/dark_pool.ipynb
index 63a1f48849a..a6b4eb10755 100644
--- a/notebooks/templates/dark_pool.ipynb
+++ b/notebooks/templates/dark_pool.ipynb
@@ -3,8 +3,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "atomic-accessory",
- "metadata": {},
+ "id": "weighted-pharmacy",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"import importlib\n",
@@ -25,8 +27,9 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "early-oxford",
+ "id": "photographic-wings",
"metadata": {
+ "collapsed": true,
"tags": [
"parameters"
]
@@ -40,8 +43,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "extra-tennessee",
- "metadata": {},
+ "id": "successful-tradition",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"display(Markdown(f\"# {ticker.upper()} - Dark Pool - {datetime.now().strftime('%Y/%m/%d %H:%M:%S')}\"))"
@@ -50,17 +55,19 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "lovely-communications",
- "metadata": {},
+ "id": "recreational-newsletter",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
- "from gamestonk_terminal.technical_analysis import trendline_api as trend\n",
- "from gamestonk_terminal.due_diligence import finviz_view as finviz"
+ "from gamestonk_terminal.common.technical_analysis import trendline_api as trend\n",
+ "from gamestonk_terminal.stocks.due_diligence import finviz_view as finviz"
]
},
{
"cell_type": "markdown",
- "id": "criminal-connection",
+ "id": "nervous-edgar",
"metadata": {},
"source": [
"## Top 10 Negative Dark Pool Positions"
@@ -69,17 +76,19 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "indonesian-stuff",
- "metadata": {},
+ "id": "opponent-atlas",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
- "from gamestonk_terminal.discovery import stockgrid_view\n",
+ "from gamestonk_terminal.stocks.discovery import stockgrid_view\n",
"stockgrid_view.darkshort([\"-a\"])"
]
},
{
"cell_type": "markdown",
- "id": "indoor-printing",
+ "id": "faced-stranger",
"metadata": {},
"source": [
"## Previous Ten Days of trading data for the Dark Pool"
@@ -88,19 +97,23 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "consolidated-childhood",
- "metadata": {},
+ "id": "exterior-royal",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
- "from gamestonk_terminal.due_diligence import stockgrid_dd_view\n",
+ "from gamestonk_terminal.stocks.due_diligence import stockgrid_dd_view\n",
"stockgrid_dd_view.darkpos(ticker.upper(), [\"-n\", \"10\", \"-r\"])"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "minus-cross",
- "metadata": {},
+ "id": "polar-plain",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"stockgrid_dd_view.shortview(ticker.upper(), [\"-n\", \"10\", \"-r\"])"
@@ -108,7 +121,7 @@
},
{
"cell_type": "markdown",
- "id": "recognized-affair",
+ "id": "foster-amendment",
"metadata": {},
"source": [
"## Options info"
@@ -117,8 +130,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "special-certification",
- "metadata": {},
+ "id": "opponent-requirement",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"from gamestonk_terminal.options import barchart_view\n",
@@ -127,7 +142,7 @@
},
{
"cell_type": "markdown",
- "id": "respected-fossil",
+ "id": "junior-paper",
"metadata": {},
"source": [
"## Put and Call Open Interest Expiring"
@@ -136,8 +151,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "compressed-there",
- "metadata": {},
+ "id": "general-reserve",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"from gamestonk_terminal.options import yfinance_model, yfinance_view\n",
@@ -153,7 +170,7 @@
},
{
"cell_type": "markdown",
- "id": "combined-integrity",
+ "id": "decreased-foster",
"metadata": {},
"source": [
"## Failure-to-deliver (30 days lag)"
@@ -162,22 +179,26 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "exciting-harvard",
- "metadata": {},
+ "id": "armed-ridge",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
- "from gamestonk_terminal import main_helper\n",
- "_, _, _, stock = main_helper.load([\"-t\", ticker], \"\", \"\", 1440, pd.DataFrame())\n",
+ "from gamestonk_terminal.stocks import stocks_helper\n",
+ "_, _, _, stock = stocks_helper.load([\"-t\", ticker], \"\", \"\", 1440, pd.DataFrame())\n",
"\n",
- "from gamestonk_terminal.due_diligence import sec_view\n",
+ "from gamestonk_terminal.stocks.due_diligence import sec_view\n",
"sec_view.fails_to_deliver([], ticker.upper(), stock)"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "central-jacob",
- "metadata": {},
+ "id": "noted-mobile",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"!jupyter nbconvert {os.path.join(\"notebooks\", \"reports\", report_name + \".ipynb\")} --to html --no-input"
@@ -201,7 +222,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.10"
+ "version": "3.6.8"
}
},
"nbformat": 4,
diff --git a/notebooks/templates/due_diligence.ipynb b/notebooks/templates/due_diligence.ipynb
index f3c53955f77..92cc6acc336 100644
--- a/notebooks/templates/due_diligence.ipynb
+++ b/notebooks/templates/due_diligence.ipynb
@@ -3,8 +3,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "second-school",
- "metadata": {},
+ "id": "collaborative-pharmacology",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"import importlib\n",
@@ -25,8 +27,9 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "amazing-wrapping",
+ "id": "future-association",
"metadata": {
+ "collapsed": true,
"tags": [
"parameters"
]
@@ -41,8 +44,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "prescription-minister",
- "metadata": {},
+ "id": "oriental-wells",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"display(Markdown(f\"# {ticker.upper()} - Due Diligence - {datetime.now().strftime('%Y/%m/%d %H:%M:%S')}\"))"
@@ -51,8 +56,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "conventional-smile",
- "metadata": {},
+ "id": "fitted-affect",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"report_cache_dir = pathlib.Path(base_path, \"notebooks\", \"reports\", report_name)\n",
@@ -68,19 +75,23 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "comfortable-twelve",
- "metadata": {},
+ "id": "black-latvia",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
- "from gamestonk_terminal.technical_analysis import trendline_api as trend\n",
- "from gamestonk_terminal.due_diligence import finviz_view as finviz"
+ "from gamestonk_terminal.common.technical_analysis import trendline_api as trend\n",
+ "from gamestonk_terminal.stocks.due_diligence import finviz_view as finviz"
]
},
{
"cell_type": "code",
"execution_count": null,
- "id": "african-citation",
- "metadata": {},
+ "id": "loved-dietary",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"df_stock_cache = pathlib.Path(report_cache_dir, f\"{ticker}_stock_data.pkl\")\n",
@@ -98,7 +109,7 @@
},
{
"cell_type": "markdown",
- "id": "classical-sodium",
+ "id": "transparent-change",
"metadata": {},
"source": [
"## Candle View"
@@ -107,8 +118,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "instructional-saturday",
- "metadata": {},
+ "id": "ruled-marks",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"import mplfinance as mpf\n",
@@ -135,8 +148,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "continuing-defensive",
- "metadata": {},
+ "id": "ahead-return",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"mpf.plot(df_stock,type='candle',mav=(20,50,200),volume=True, addplot=ap0,\n",
@@ -146,7 +161,7 @@
},
{
"cell_type": "markdown",
- "id": "pursuant-frost",
+ "id": "amber-hayes",
"metadata": {},
"source": [
"## Analyst Targets"
@@ -155,8 +170,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "stretch-offer",
- "metadata": {},
+ "id": "conservative-baking",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"df_fa = finviz.analyst_df(ticker)\n",
@@ -166,16 +183,18 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "cross-filename",
- "metadata": {},
+ "id": "moderate-dealer",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
- "from gamestonk_terminal.fundamental_analysis import av_view as av"
+ "from gamestonk_terminal.stocks.fundamental_analysis import av_view as av"
]
},
{
"cell_type": "markdown",
- "id": "conscious-monkey",
+ "id": "victorian-classic",
"metadata": {},
"source": [
"## Annual Income Statement"
@@ -184,8 +203,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "completed-likelihood",
- "metadata": {},
+ "id": "three-vegetation",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"# Annual Income Statement\n",
@@ -194,7 +215,7 @@
},
{
"cell_type": "markdown",
- "id": "rocky-evidence",
+ "id": "collected-deployment",
"metadata": {},
"source": [
"## Quarterly Income Statement"
@@ -203,8 +224,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "handy-warning",
- "metadata": {},
+ "id": "grateful-minnesota",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"# Quarterly Income Statement\n",
@@ -213,7 +236,7 @@
},
{
"cell_type": "markdown",
- "id": "south-sphere",
+ "id": "angry-somerset",
"metadata": {},
"source": [
"## Annual Balance Sheet"
@@ -222,8 +245,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "optimum-sandwich",
- "metadata": {},
+ "id": "fifty-angola",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"# Annual Balance Sheet\n",
@@ -232,7 +257,7 @@
},
{
"cell_type": "markdown",
- "id": "metric-concentration",
+ "id": "typical-fundamentals",
"metadata": {},
"source": [
"## Annual Cash Flow"
@@ -241,8 +266,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "plastic-color",
- "metadata": {},
+ "id": "magnetic-throat",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"# Annual cash flow\n",
@@ -252,8 +279,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "overall-material",
- "metadata": {},
+ "id": "instructional-skating",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"!jupyter nbconvert {os.path.join(\"notebooks\", \"reports\", report_name + \".ipynb\")} --to html --no-input"
@@ -277,7 +306,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.10"
+ "version": "3.6.8"
}
},
"nbformat": 4,
diff --git a/notebooks/templates/econ_data.ipynb b/notebooks/templates/econ_data.ipynb
index 35359fa9464..f8ee687f598 100644
--- a/notebooks/templates/econ_data.ipynb
+++ b/notebooks/templates/econ_data.ipynb
@@ -3,8 +3,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "blank-couple",
- "metadata": {},
+ "id": "another-behalf",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"import importlib\n",
@@ -24,8 +26,9 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "naked-shower",
+ "id": "racial-graduation",
"metadata": {
+ "collapsed": true,
"tags": [
"parameters"
]
@@ -39,8 +42,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "5c860cb4",
- "metadata": {},
+ "id": "commercial-cargo",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"display(Markdown(f\"# Economy Data - {datetime.now().strftime('%Y/%m/%d %H:%M:%S')}\"))"
@@ -49,8 +54,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "moderate-cheat",
- "metadata": {},
+ "id": "alive-borough",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"report_cache_dir = pathlib.Path(base_path, \"notebooks\", \"reports\", report_name)\n",
@@ -66,16 +73,18 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "southern-gnome",
- "metadata": {},
+ "id": "orange-merit",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
- "from gamestonk_terminal.papermill import econ_data_helper as edh"
+ "from gamestonk_terminal.economy.report import econ_data_helper as edh"
]
},
{
"cell_type": "markdown",
- "id": "initial-palace",
+ "id": "informative-behavior",
"metadata": {},
"source": [
"## Dow Jones - 2 year trend with 20, 50 and 200 day SMA"
@@ -84,8 +93,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "invalid-interstate",
- "metadata": {},
+ "id": "stylish-elite",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"^DJI\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
@@ -93,7 +104,7 @@
},
{
"cell_type": "markdown",
- "id": "responsible-poker",
+ "id": "fifty-happiness",
"metadata": {},
"source": [
"## Dow Jones - 1 year trend with 20, 50 and 200 day SMA"
@@ -102,8 +113,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "departmental-sender",
- "metadata": {},
+ "id": "identical-classification",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"^DJI\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=360, low_trend=True)"
@@ -111,7 +124,7 @@
},
{
"cell_type": "markdown",
- "id": "passing-printing",
+ "id": "boxed-turning",
"metadata": {},
"source": [
"## S&P 500 - 2 year trend with 20, 50 and 200 day SMA"
@@ -120,8 +133,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "related-quality",
- "metadata": {},
+ "id": "threaded-language",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"^GSPC\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
@@ -129,7 +144,7 @@
},
{
"cell_type": "markdown",
- "id": "verified-simulation",
+ "id": "fleet-transparency",
"metadata": {},
"source": [
"## Market Volatility (VIX) - 2 year trend with 20, 50 and 200 day SMA"
@@ -138,8 +153,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "crude-africa",
- "metadata": {},
+ "id": "disturbed-workstation",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"^VIX\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=False, time_delta=720, high_trend=False, low_trend=False)"
@@ -147,7 +164,7 @@
},
{
"cell_type": "markdown",
- "id": "naval-builder",
+ "id": "civilian-november",
"metadata": {},
"source": [
"## Market Volatility (VIX) - 1 year trend with 20, 50 and 200 day SMA"
@@ -156,8 +173,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "fossil-genealogy",
- "metadata": {},
+ "id": "several-inventory",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"^VIX\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=False, time_delta=360, high_trend=False, low_trend=False)"
@@ -165,7 +184,7 @@
},
{
"cell_type": "markdown",
- "id": "annoying-drain",
+ "id": "bizarre-record",
"metadata": {},
"source": [
"## Yield on 5-Year US Treasury Notes - 2 year trend with 20, 50 and 200 day SMA"
@@ -174,8 +193,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "cathedral-divide",
- "metadata": {},
+ "id": "military-temperature",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"^FVX\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=False, time_delta=720, low_trend=False, high_trend=False)"
@@ -183,7 +204,7 @@
},
{
"cell_type": "markdown",
- "id": "selective-macintosh",
+ "id": "greater-party",
"metadata": {},
"source": [
"## Yield on 10-Year US Treasury Notes - 2 year trend with 20, 50 and 200 day SMA"
@@ -192,8 +213,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "induced-vancouver",
- "metadata": {},
+ "id": "aboriginal-violin",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"^TNX\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=False, time_delta=720, low_trend=False, high_trend=False)"
@@ -201,7 +224,7 @@
},
{
"cell_type": "markdown",
- "id": "imported-message",
+ "id": "continent-sally",
"metadata": {},
"source": [
"## Yield on 30-Year US Treasury Notes - 2 year trend with 20, 50 and 200 day SMA"
@@ -210,8 +233,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "alleged-citizenship",
- "metadata": {},
+ "id": "formed-heating",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"^TYX\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=False, time_delta=720, low_trend=False, high_trend=False)"
@@ -219,7 +244,7 @@
},
{
"cell_type": "markdown",
- "id": "complimentary-stomach",
+ "id": "handled-insurance",
"metadata": {},
"source": [
"## Gold - 2 year trend with 20, 50 and 200 day SMA"
@@ -228,8 +253,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "varying-pasta",
- "metadata": {},
+ "id": "advisory-johnston",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"GLD\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720)"
@@ -237,7 +264,7 @@
},
{
"cell_type": "markdown",
- "id": "perfect-illness",
+ "id": "played-writer",
"metadata": {},
"source": [
"## Silver - 2 year trend with 20, 50 and 200 day SMA"
@@ -246,8 +273,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "confirmed-event",
- "metadata": {},
+ "id": "light-harvest",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"SLV\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
@@ -255,7 +284,7 @@
},
{
"cell_type": "markdown",
- "id": "illusory-reflection",
+ "id": "floral-giant",
"metadata": {},
"source": [
"## Euro vs US Dollar - 2 year trend with 20, 50 and 200 day SMA"
@@ -264,8 +293,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "astonishing-star",
- "metadata": {},
+ "id": "corrected-estimate",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"FXE\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=True)"
@@ -273,7 +304,7 @@
},
{
"cell_type": "markdown",
- "id": "reflective-panda",
+ "id": "neither-montana",
"metadata": {},
"source": [
"## Yen vs US Dollar - 2 year trend with 20, 50 and 200 day SMA"
@@ -282,8 +313,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "starry-night",
- "metadata": {},
+ "id": "middle-geneva",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"FXY\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=True)"
@@ -291,7 +324,7 @@
},
{
"cell_type": "markdown",
- "id": "faced-canon",
+ "id": "theoretical-grammar",
"metadata": {},
"source": [
"## Energy - 2 year trend with 20, 50 and 200 day SMA"
@@ -300,8 +333,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "extended-earthquake",
- "metadata": {},
+ "id": "swedish-thickness",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"XLE\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720)"
@@ -309,7 +344,7 @@
},
{
"cell_type": "markdown",
- "id": "statewide-explanation",
+ "id": "gentle-humor",
"metadata": {},
"source": [
"## Crude Oil - 2 year trend with 20, 50 and 200 day SMA"
@@ -318,8 +353,9 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "classical-coast",
+ "id": "instructional-serve",
"metadata": {
+ "collapsed": true,
"scrolled": false
},
"outputs": [],
@@ -329,7 +365,7 @@
},
{
"cell_type": "markdown",
- "id": "spoken-delta",
+ "id": "classical-listening",
"metadata": {},
"source": [
"## Real Estate - 2 year trend with 20, 50 and 200 day SMA"
@@ -338,8 +374,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "changing-eight",
- "metadata": {},
+ "id": "enclosed-administration",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"XLRE\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
@@ -347,7 +385,7 @@
},
{
"cell_type": "markdown",
- "id": "mathematical-support",
+ "id": "turned-percentage",
"metadata": {},
"source": [
"## Real Estate - 1 year trend with 20, 50 and 200 day SMA"
@@ -356,8 +394,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "exact-jacksonville",
- "metadata": {},
+ "id": "sharing-removal",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"VNQ\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=360, low_trend=True)"
@@ -365,7 +405,7 @@
},
{
"cell_type": "markdown",
- "id": "worse-horror",
+ "id": "swedish-happiness",
"metadata": {},
"source": [
"## Financials - 2 year trend with 20, 50 and 200 day SMA"
@@ -374,8 +414,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "controlled-portuguese",
- "metadata": {},
+ "id": "beginning-aspect",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"XLF\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
@@ -383,7 +425,7 @@
},
{
"cell_type": "markdown",
- "id": "typical-sandwich",
+ "id": "restricted-glucose",
"metadata": {},
"source": [
"## Financials - 1 year trend with 20, 50 and 200 day SMA"
@@ -392,8 +434,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "headed-bundle",
- "metadata": {},
+ "id": "personal-whole",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"XLF\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=360, low_trend=True)"
@@ -401,7 +445,7 @@
},
{
"cell_type": "markdown",
- "id": "blistering-barnacles",
+ "id": "detailed-strike",
"metadata": {},
"source": [
"## Materials - 2 year trend with 20, 50 and 200 day SMA"
@@ -410,8 +454,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "italian-portent",
- "metadata": {},
+ "id": "negative-mitchell",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"XLB\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=720, low_trend=False)"
@@ -419,7 +465,7 @@
},
{
"cell_type": "markdown",
- "id": "material-science",
+ "id": "boolean-rotation",
"metadata": {},
"source": [
"## Materials - 1 year trend with 20, 50 and 200 day SMA"
@@ -428,8 +474,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "bundle-enabler",
- "metadata": {},
+ "id": "settled-orange",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"edh.draw_graph(\"XLB\", report_cache_dir, line_type=\"line\", draw_mas=(20,50,200), draw_volume=True, time_delta=360, low_trend=True)"
@@ -438,8 +486,10 @@
{
"cell_type": "code",
"execution_count": null,
- "id": "german-ecology",
- "metadata": {},
+ "id": "premium-transportation",
+ "metadata": {
+ "collapsed": true
+ },
"outputs": [],
"source": [
"!jupyter nbconvert {os.path.join(\"notebooks\", \"reports\", report_name + \".ipynb\")} --to html --no-input"
@@ -462,7 +512,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.10"
+ "version": "3.6.8"
}
},
"nbformat": 4,
diff --git a/terminal.py b/terminal.py
index 2998a808580..498436e8ac1 100644
--- a/terminal.py
+++ b/terminal.py
@@ -5,126 +5,68 @@ __docformat__ = "numpy"
import argparse
import os
import sys
-from datetime import datetime
-from typing import List
-import pandas as pd
-import yfinance as yf
-from alpha_vantage.timeseries import TimeSeries
from prompt_toolkit.completion import NestedCompleter
-from gamestonk_terminal.helper_funcs import (
- b_is_stock_market_open,
- get_flair,
-)
-from gamestonk_terminal.main_helper import (
- clear,
- load,
- view,
- candle,
+from gamestonk_terminal.terminal_helper import (
print_goodbye,
- quote,
update_terminal,
about_us,
bootup,
reset,
check_api_keys,
)
+from gamestonk_terminal.helper_funcs import get_flair
from gamestonk_terminal.menu import session
-from gamestonk_terminal import config_terminal as cfg
from gamestonk_terminal import feature_flags as gtff
-from gamestonk_terminal.discovery import disc_controller
-from gamestonk_terminal.due_diligence import dd_controller
-from gamestonk_terminal.fundamental_analysis import fa_controller
-from gamestonk_terminal.papermill import papermill_controller as mill
-from gamestonk_terminal.behavioural_analysis import ba_controller
-from gamestonk_terminal.technical_analysis import ta_controller
-from gamestonk_terminal.comparison_analysis import ca_controller
-from gamestonk_terminal.exploratory_data_analysis import eda_controller
-from gamestonk_terminal.options import op_controller
-from gamestonk_terminal.economy import econ_controller
-from gamestonk_terminal.residuals_analysis import ra_controller
-from gamestonk_terminal.portfolio_analysis import pa_controller
-from gamestonk_terminal.brokers import bro_controller
-from gamestonk_terminal.cryptocurrency import crypto_controller
-from gamestonk_terminal.screener import screener_controller
-from gamestonk_terminal.portfolio_optimization import po_controller
-from gamestonk_terminal.forex import fx_controller
-from gamestonk_terminal.backtesting import bt_controller
-from gamestonk_terminal.resource_collection import rc_controller
-from gamestonk_terminal.research import res_controller
-from gamestonk_terminal.government import gov_controller
+from gamestonk_terminal import config_terminal
-# from gamestonk_terminal.etf import etf_controller
-from gamestonk_terminal.insider import insider_controller
+from gamestonk_terminal.stocks import stocks_controller
+from gamestonk_terminal.cryptocurrency import crypto_controller
+from gamestonk_terminal.economy import economy_controller
+from gamestonk_terminal.options import options_controller
+from gamestonk_terminal.etf import etf_controller
+from gamestonk_terminal.forex import forex_controller
+from gamestonk_terminal.resources import resources_controller
+from gamestonk_terminal.portfolio import portfolio_controller
# pylint: disable=too-many-public-methods
+
+
class TerminalController:
"""Terminal Controller class"""
- # To hold suffix for Yahoo Finance
- suffix = ""
-
- # Command choices
- CHOICES_TICKER_DEPENDENT = [
- "ba",
- "res",
- "fa",
- "ta",
- "bt",
- "dd",
- "eda",
- "pred",
- "ca",
- "ra",
- ]
-
CHOICES = [
"cls",
"?",
"help",
- "quit",
"q",
+ "quit",
+ ]
+
+ CHOICES_COMMANDS = [
"reset",
"update",
- "clear",
- "load",
- "quote",
- "candle",
- "view",
- "disc",
- "scr",
- "mill",
- "econ",
- "pa",
- "crypto",
- "po",
- "ins",
- "fx",
- "rc",
- "op",
- "gov",
- "etf",
"about",
- "bro",
- "ins",
"keys",
]
- CHOICES += CHOICES_TICKER_DEPENDENT
- def __init__(
- self,
- stock: pd.DataFrame,
- ticker: str,
- start: datetime,
- interval: str,
- ):
+ CHOICES_MENUS = [
+ "stocks",
+ "economy",
+ "crypto",
+ "portfolio",
+ "forex",
+ "options",
+ "etf",
+ "resources",
+ ]
+
+ CHOICES += CHOICES_COMMANDS
+ CHOICES += CHOICES_MENUS
+
+ def __init__(self):
"""Constructor"""
- self.stock = stock
- self.ticker = ticker
- self.start = start
- self.interval = interval
-
self.update_succcess = False
self.t_parser = argparse.ArgumentParser(add_help=False, prog="terminal")
self.t_parser.add_argument(
@@ -147,56 +89,15 @@ What do you want to do?
about about us
q(uit) to abandon the program
-Contexts:
-> mill papermill menu, \t\t menu to generate notebook reports
-> econ economic data, \t\t\t e.g.: events, FRED data, GDP, VIXCLS
-> pa portfolio analysis, \t\t analyses your custom portfolio
-> bro brokers holdings, \t\t supports: robinhood, alpaca, ally
-> crypto cryptocurrencies, \t\t from: coingecko, coinmarketcap, binance
-> po portfolio optimization, \t optimal portfolio weights from pyportfolioopt
-> gov government menu, \t\t house trading, contracts, corporate lobbying
-> etf TEMPORARILY DISABLED
-> fx forex menu, \t\t\t forex support through Oanda
-> rc resource collection, \t\t e.g. hf letters, arXiv, EDGAR, FINRA
-> op options info, \t e.g.: volume, open interest, chains, volatility
-> ins insider trading, \t e.g.: latest penny stock buys, insider sales
- """
-
- s_intraday = (f"Intraday {self.interval}", "Daily")[self.interval == "1440min"]
- if self.ticker and self.start:
- help_text += f"\n{s_intraday} Stock: {self.ticker} (from {self.start.strftime('%Y-%m-%d')})\n"
- elif self.ticker:
- help_text += f"\n{s_intraday} Stock: {self.ticker}\n"
- else:
- help_text += "\nStock: ?\n"
-
- help_text += f"Market {('CLOSED', 'OPEN')[b_is_stock_market_open()]}.\n"
-
- help_text += """
- clear clear a specific stock ticker from analysis
- load load a specific stock ticker for analysis
+>> stocks
+>> crypto
+>> economy
+>> options
+>> portfolio
+>> etf
+>> forex
+>> resources
"""
-
- if self.ticker:
- help_text += """quote view the current price for a specific stock ticker
- candle view a candle chart for a specific stock ticker
- view view and load a specific stock ticker for technical analysis
-
-> dd in-depth due-diligence, \t e.g.: news, analyst, shorts, insider, sec
-> ba behavioural analysis, \t from: reddit, stocktwits, twitter, google
-> ta technical analysis, \t e.g.: ema, macd, rsi, adx, bbands, obv
-> fa fundamental analysis, \t e.g.: income, balance, cash, earnings
-> res research web page, \t e.g.: macroaxis, yahoo finance, fool
-> ca comparison analysis, \t e.g.: historical, correlation, financials
-> eda exploratory data analysis,\t e.g.: decompose, cusum, residuals analysis
-> ra residuals analysis, \t e.g.: model fit, qqplot, hypothesis test
-> bt strategy backtester, \t e.g.: simple ema, ema cross, rsi strategies
-> pred prediction techniques, \t e.g.: regression, arima, rnn, lstm"""
-
- help_text += """\n> disc discover trending stocks, \t e.g. map, sectors, high short interest
-> scr screener stocks, \t\t e.g. overview/performance, using preset filters
- """
-
print(help_text)
def switch(self, an_input: str):
@@ -215,10 +116,6 @@ Contexts:
print("")
return None
- if not self.ticker and an_input in self.CHOICES_TICKER_DEPENDENT:
- print("No ticker selected. Use 'load '.\n")
- return None
-
(known_args, other_args) = self.t_parser.parse_known_args(an_input.split())
# Help menu again
@@ -247,97 +144,11 @@ Contexts:
"""Process Quit command - quit the program"""
return True
+ # COMMANDS
def call_reset(self, _):
"""Process reset command"""
return True
- def call_clear(self, other_args: List[str]):
- """Process clear command"""
- self.ticker, self.start, self.interval, self.stock = clear(
- other_args, self.ticker, self.start, self.interval, self.stock
- )
-
- def call_load(self, other_args: List[str]):
- """Process load command"""
- self.ticker, self.start, self.interval, self.stock = load(
- other_args, self.ticker, self.start, self.interval, self.stock
- )
- if "." in self.ticker:
- self.ticker, self.suffix = self.ticker.split(".")
- else:
- self.suffix = ""
-
- def call_quote(self, other_args: List[str]):
- """Process quote command"""
- quote(
- other_args, self.ticker + "." + self.suffix if self.suffix else self.ticker
- )
-
- def call_candle(self, other_args: List[str]):
- """Process candle command"""
- candle(
- self.ticker + "." + self.suffix if self.suffix else self.ticker,
- other_args,
- )
-
- def call_view(self, other_args: List[str]):
- """Process view command"""
- view(other_args, self.ticker, self.interval, self.stock)
-
- def call_disc(self, _):
- """Process disc command"""
- return disc_controller.menu()
-
- def call_mill(self, _):
- """Process mill command"""
- return mill.papermill_menu()
-
- def call_fx(self, _):
- """Process fx command"""
- return fx_controller.menu()
-
- def call_econ(self, _):
- """Process econ command"""
- return econ_controller.menu()
-
- def call_pa(self, _):
- """Process pa command"""
- return pa_controller.menu()
-
- def call_bro(self, _):
- """Process bro command"""
- return bro_controller.menu()
-
- def call_crypto(self, _):
- """Process crypto command"""
- return crypto_controller.menu()
-
- def call_scr(self, _):
- """Process scr command"""
- return screener_controller.menu()
-
- def call_rc(self, _):
- """Process rc command"""
- return rc_controller.menu()
-
- def call_etf(self, _):
- """Process etf command"""
- print("TEMPORARILY DISABLED \n")
-
- # return etf_controller.menu()
-
- def call_ins(self, _):
- """Process ins command"""
- return insider_controller.menu()
-
- def call_gov(self, _):
- """Process gov command"""
- return gov_controller.menu(self.ticker)
-
- def call_po(self, _):
- """Process po command"""
- return po_controller.menu([self.ticker])
-
def call_update(self, _):
"""Process update command"""
self.update_succcess = not update_terminal()
@@ -351,143 +162,38 @@ Contexts:
"""Process about command"""
about_us()
- def call_ba(self, _):
- """Process ba command"""
- return ba_controller.menu(
- self.ticker,
- self.start,
- )
+ # MENUS
+ def call_stocks(self, _):
+ """Process stocks command"""
+ return stocks_controller.menu()
- def call_res(self, _):
- """Process res command"""
- return res_controller.menu(
- self.ticker,
- self.start,
- self.interval,
- )
+ def call_crypto(self, _):
+ """Process crypto command"""
+ return crypto_controller.menu()
- def call_ca(self, _):
- """Process ca command"""
- return ca_controller.menu(self.ticker, self.start, self.interval, self.stock)
+ def call_economy(self, _):
+ """Process econ command"""
+ return economy_controller.menu()
- def call_fa(self, _):
- """Process fa command"""
- return fa_controller.menu(
- self.ticker,
- self.start,
- self.interval,
- )
-
- def call_ta(self, _):
- """Process ta command"""
- return ta_controller.menu(
- self.ticker,
- self.start,
- self.interval,
- self.stock,
- )
-
- def call_dd(self, _):
- """Process dd command"""
- return dd_controller.menu(
- self.ticker,
- self.start,
- self.interval,
- self.stock,
- )
-
- def call_ra(self, _):
- """Process ra command"""
- return ra_controller.menu(
- self.ticker,
- self.start,
- self.interval,
- self.stock,
- )
-
- def call_bt(self, _):
- """Process bt command"""
- return bt_controller.menu(
- self.ticker,
- self.start,
- )
-
- def call_eda(self, _):
- """Process eda command"""
- if self.interval == "1440min":
- return eda_controller.menu(
- self.ticker,
- self.start,
- self.interval,
- self.stock,
- )
-
- df_stock = yf.download(self.ticker, start=self.start, progress=False)
- df_stock.index.name = "date"
- s_interval = "1440min"
-
- return eda_controller.menu(
- self.ticker,
- self.start,
- s_interval,
- df_stock,
- )
-
- def call_op(self, _):
+ def call_options(self, _):
"""Process op command"""
- return op_controller.menu(self.ticker)
+ return options_controller.menu()
- def call_pred(self, _):
- """Process pred command"""
- if not gtff.ENABLE_PREDICT:
- print(
- "Predict is disabled. Check ENABLE_PREDICT flag on feature_flags.py",
- "\n",
- )
- return None
+ def call_etf(self, _):
+ """Process etf command"""
+ return etf_controller.menu()
- try:
- # pylint: disable=import-outside-toplevel
- from gamestonk_terminal.prediction_techniques import pred_controller
- except ModuleNotFoundError as e:
- print("One of the optional packages seems to be missing: ", e, "\n")
- return None
- except Exception as e:
- print(e, "\n")
- return None
+ def call_forex(self, _):
+ """Process fx command"""
+ return forex_controller.menu()
- if self.interval == "1440min":
- return pred_controller.menu(
- self.ticker,
- self.start,
- self.interval,
- self.stock,
- )
+ def call_resources(self, _):
+ """Process resources command"""
+ return resources_controller.menu()
- # If stock data is intradaily, we need to get data again as prediction
- # techniques work on daily adjusted data. By default we load data from
- # Alpha Vantage because the historical data loaded gives a larger
- # dataset than the one provided by quandl
- try:
- ts = TimeSeries(key=cfg.API_KEY_ALPHAVANTAGE, output_format="pandas")
- # pylint: disable=unbalanced-tuple-unpacking
- df_stock_pred, _ = ts.get_daily_adjusted(
- symbol=self.ticker, outputsize="full"
- )
-
- # pylint: disable=no-member
- df_stock_pred = df_stock_pred.sort_index(ascending=True)
- df_stock_pred = df_stock_pred[self.start :]
- return pred_controller.menu(
- self.ticker,
- self.start,
- "1440min",
- df_stock_pred,
- )
- except Exception as e:
- print(e)
- print("Either the ticker or the API_KEY are invalids. Try again!")
- return None
+ def call_portfolio(self, _):
+ """Process portfolio command"""
+ return portfolio_controller.menu()
def terminal():
@@ -495,18 +201,22 @@ def terminal():
bootup()
- ticker = "" # "GME"
- start = "" # "2021-01-01"
- stock = pd.DataFrame() # yf.download(ticker, start, progress=False)
- interval = "1440min"
+ t_controller = TerminalController()
+
+ if config_terminal.DEFAULT_CONTEXT:
+ if config_terminal.DEFAULT_CONTEXT in t_controller.CHOICES_MENUS:
+ try:
+ print("")
+ t_controller.switch(config_terminal.DEFAULT_CONTEXT.lower())
+ except SystemExit:
+ print("")
+ else:
+ print("\nInvalid DEFAULT_CONTEXT config selected!", "\n")
- t_controller = TerminalController(stock, ticker, start, interval)
t_controller.print_help()
-
parsed_stdin = False
while True:
-
if gtff.ENABLE_QUICK_EXIT:
print("Quick exit enabled")
break
diff --git a/tests/test_dd_financial_modeling_prep_view.py b/tests/test_dd_financial_modeling_prep_view.py
index 0db0c299699..05edc296255 100644
--- a/tests/test_dd_financial_modeling_prep_view.py
+++ b/tests/test_dd_financial_modeling_prep_view.py
@@ -1,7 +1,7 @@
""" fundamental_analysis/business_insider_api.py tests """
import unittest
-from gamestonk_terminal.due_diligence.financial_modeling_prep_view import rating
+from gamestonk_terminal.stocks.due_diligence.financial_modeling_prep_view import rating
class TestDdFinancialModelingPrepView(unittest.TestCase):
diff --git a/tests/test_dd_finviz_view.py b/tests/test_dd_finviz_view.py
index 8c062510029..7c980c2f728 100644
--- a/tests/test_dd_finviz_view.py
+++ b/tests/test_dd_finviz_view.py
@@ -1,7 +1,7 @@
""" due_diligence/finviz_api.py tests """
import unittest
-from gamestonk_terminal.due_diligence.finviz_view import analyst
+from gamestonk_terminal.stocks.due_diligence.finviz_view import analyst
class TestDdFinvizApi(unittest.TestCase):
diff --git a/tests/test_discovery_ark_model.py b/tests/test_discovery_ark_model.py
index 71fe4f6341e..a9b9993531b 100644
--- a/tests/test_discovery_ark_model.py
+++ b/tests/test_discovery_ark_model.py
@@ -11,13 +11,16 @@ from gamestonk_terminal.test_helper import ( # noqa: F401
pytest_generate_tests,
)
-from gamestonk_terminal.discovery.ark_model import get_ark_orders, add_order_total
+from gamestonk_terminal.stocks.discovery.ark_model import (
+ get_ark_orders,
+ add_order_total,
+)
assertions = unittest.TestCase("__init__")
class TestDiscoveryArkModel:
- @mock.patch("gamestonk_terminal.discovery.ark_model.requests")
+ @mock.patch("gamestonk_terminal.stocks.discovery.ark_model.requests")
@parameterize_from_file(
"test_get_ark_orders",
"../tests/data/discovery_ark_model.yaml",
@@ -37,7 +40,7 @@ class TestDiscoveryArkModel:
ret.to_csv().replace("\r\n", "\n"), expected_orders.replace("\r\n", "\n")
)
- @mock.patch("gamestonk_terminal.discovery.ark_model.yf.download")
+ @mock.patch("gamestonk_terminal.stocks.discovery.ark_model.yf.download")
@parameterize_from_file(
"test_add_order_total",
"../tests/data/discovery_ark_model.yaml",
diff --git a/tests/test_discovery_ark_view.py b/tests/test_discovery_ark_view.py
index 5b40b6f30a8..c92b0aa3e08 100644
--- a/tests/test_discovery_ark_view.py
+++ b/tests/test_discovery_ark_view.py
@@ -10,14 +10,16 @@ from gamestonk_terminal.test_helper import ( # noqa: F401
pytest_generate_tests,
)
-from gamestonk_terminal.discovery.ark_view import ark_orders_view
+from gamestonk_terminal.stocks.discovery.ark_view import ark_orders_view
assertions = unittest.TestCase("__init__")
class TestDiscoveryArkView:
- @mock.patch("gamestonk_terminal.discovery.ark_view.ark_model.get_ark_orders")
- @mock.patch("gamestonk_terminal.discovery.ark_view.ark_model.add_order_total")
+ @mock.patch("gamestonk_terminal.stocks.discovery.ark_view.ark_model.get_ark_orders")
+ @mock.patch(
+ "gamestonk_terminal.stocks.discovery.ark_view.ark_model.add_order_total"
+ )
@parameterize_from_file(
"test_ark_orders_view",
"../tests/data/discovery_ark_view.yaml",
diff --git a/tests/test_discovery_fidelity_api.py b/tests/test_discovery_fidelity_api.py
index 7396e54e754..7ff92717cec 100644
--- a/tests/test_discovery_fidelity_api.py
+++ b/tests/test_discovery_fidelity_api.py
@@ -1,7 +1,7 @@
""" discovery/fidelity_api.py tests """
import unittest
-from gamestonk_terminal.discovery.fidelity_view import (
+from gamestonk_terminal.stocks.discovery.fidelity_view import (
buy_sell_ratio_color_red_green,
price_change_color_red_green,
orders_view,
diff --git a/tests/test_discovery_fidelity_model.py b/tests/test_discovery_fidelity_model.py
index 34feb5b5ec9..ed8bf8271d2 100644
--- a/tests/test_discovery_fidelity_model.py
+++ b/tests/test_discovery_fidelity_model.py
@@ -8,13 +8,13 @@ from gamestonk_terminal.test_helper import ( # noqa: F401
pytest_generate_tests,
)
-from gamestonk_terminal.discovery.fidelity_model import get_orders
+from gamestonk_terminal.stocks.discovery.fidelity_model import get_orders
assertions = unittest.TestCase("__init__")
class TestDiscoveryFidelityModel:
- @mock.patch("gamestonk_terminal.discovery.fidelity_model.requests")
+ @mock.patch("gamestonk_terminal.stocks.discovery.fidelity_model.requests")
@parameterize_from_file(
"test_get_orders",
"../tests/data/discovery_fidelity_model.yaml",
diff --git a/tests/test_discovery_seeing_alpha_model.py b/tests/test_discovery_seeing_alpha_model.py
index 3606ca2178d..9cd3c7e677e 100644
--- a/tests/test_discovery_seeing_alpha_model.py
+++ b/tests/test_discovery_seeing_alpha_model.py
@@ -8,13 +8,15 @@ from gamestonk_terminal.test_helper import ( # noqa: F401
pytest_generate_tests,
)
-from gamestonk_terminal.discovery.seeking_alpha_model import get_next_earnings
+from gamestonk_terminal.stocks.discovery.seeking_alpha_model import get_next_earnings
assertions = unittest.TestCase("__init__")
class TestDiscoverySeekingAlphaModel:
- @mock.patch("gamestonk_terminal.discovery.seeking_alpha_model.get_earnings_html")
+ @mock.patch(
+ "gamestonk_terminal.stocks.discovery.seeking_alpha_model.get_earnings_html"
+ )
@parameterize_from_file(
"test_get_next_earnings",
"../tests/data/discovery_seeking_alpha_model.yaml",
diff --git a/tests/test_discovery_short_interest_model.py b/tests/test_discovery_short_interest_model.py
index 254101054cc..7dd168d1c7d 100644
--- a/tests/test_discovery_short_interest_model.py
+++ b/tests/test_discovery_short_interest_model.py
@@ -8,7 +8,7 @@ from gamestonk_terminal.test_helper import ( # noqa: F401
pytest_generate_tests,
)
-from gamestonk_terminal.discovery.short_interest_model import (
+from gamestonk_terminal.stocks.discovery.short_interest_model import (
get_high_short_interest,
get_low_float,
)
@@ -17,7 +17,7 @@ assertions = unittest.TestCase("__init__")
class TestDiscoveryShortInterestApi:
- @mock.patch("gamestonk_terminal.discovery.short_interest_model.requests")
+ @mock.patch("gamestonk_terminal.stocks.discovery.short_interest_model.requests")
@parameterize_from_file(
"test_get_high_short_interest",
"../tests/data/discovery_short_interest_model.yaml",
@@ -36,7 +36,7 @@ class TestDiscoveryShortInterestApi:
expected_result.replace("\r\n", "\n"),
)
- @mock.patch("gamestonk_terminal.discovery.short_interest_model.requests")
+ @mock.patch("gamestonk_terminal.stocks.discovery.short_interest_model.requests")
@parameterize_from_file(
"test_get_low_float",
"../tests/data/discovery_short_interest_model.yaml",
diff --git a/tests/test_fa_business_insider_view.py b/tests/test_fa_business_insider_view.py
index b9d35af0af9..26a8e7e2fc3 100644
--- a/tests/test_fa_business_insider_view.py
+++ b/tests/test_fa_business_insider_view.py
@@ -1,7 +1,9 @@
""" fundamental_analysis/business_insider_api.py tests """
import unittest
-from gamestonk_terminal.fundamental_analysis.business_insider_view import management
+from gamestonk_terminal.stocks.fundamental_analysis.business_insider_view import (
+ management,
+)
class TestFaBusinessInsiderApi(unittest.TestCase):
diff --git a/tests/test_fa_market_watch_model.py b/tests/test_fa_market_watch_model.py
index 4e671236f00..08c51422830 100644
--- a/tests/test_fa_market_watch_model.py
+++ b/tests/test_fa_market_watch_model.py
@@ -8,7 +8,7 @@ from gamestonk_terminal.test_helper import ( # noqa: F401
pytest_generate_tests,
)
-from gamestonk_terminal.fundamental_analysis.market_watch_model import (
+from gamestonk_terminal.stocks.fundamental_analysis.market_watch_model import (
prepare_df_financials,
)
@@ -16,7 +16,9 @@ assertions = unittest.TestCase("__init__")
class TestFaMarketWatchApiUnit:
- @mock.patch("gamestonk_terminal.fundamental_analysis.market_watch_model.requests")
+ @mock.patch(
+ "gamestonk_terminal.stocks.fundamental_analysis.market_watch_model.requests"
+ )
@parameterize_from_file(
"test_prepare_df_financials",
"../tests/data/fa_market_watch_model.yaml",
diff --git a/tests/test_fa_market_watch_view.py b/tests/test_fa_market_watch_view.py
index 9ebe411fdb3..ba78cb6a869 100644
--- a/tests/test_fa_market_watch_view.py
+++ b/tests/test_fa_market_watch_view.py
@@ -1,7 +1,7 @@
""" fundamental_analysis/market_watch_api.py tests """
import unittest
-from gamestonk_terminal.fundamental_analysis.market_watch_view import income
+from gamestonk_terminal.stocks.fundamental_analysis.market_watch_view import income
class TestFaMarketWatchApi(unittest.TestCase):
diff --git a/tests/test_fa_yahoo_finance_view.py b/tests/test_fa_yahoo_finance_view.py
index fb068647595..7cd9090abae 100644
--- a/tests/test_fa_yahoo_finance_view.py
+++ b/tests/test_fa_yahoo_finance_view.py
@@ -2,7 +2,7 @@
import unittest
# pylint: disable=unused-import
-from gamestonk_terminal.fundamental_analysis.yahoo_finance_view import ( # noqa: F401
+from gamestonk_terminal.stocks.fundamental_analysis.yahoo_finance_view import ( # noqa: F401
info,
sustainability,
calendar_earnings,
diff --git a/tests/test_fa_yield_curve_model.py b/tests/test_fa_yield_curve_model.py
index 0744e6cad72..35f46aaa555 100644
--- a/tests/test_fa_yield_curve_model.py
+++ b/tests/test_fa_yield_curve_model.py
@@ -11,7 +11,7 @@ from gamestonk_terminal.test_helper import ( # noqa: F401
pytest_generate_tests,
)
-from gamestonk_terminal.fundamental_analysis.yield_curve_model import (
+from gamestonk_terminal.stocks.fundamental_analysis.yield_curve_model import (
get_yield_curve,
get_yield_curve_year,
)
@@ -21,7 +21,7 @@ assertions = unittest.TestCase("__init__")
class TestFaYieldCurveModel:
@mock.patch(
- "gamestonk_terminal.fundamental_analysis.yield_curve_model.get_yield_curve_year"
+ "gamestonk_terminal.stocks.fundamental_analysis.yield_curve_model.get_yield_curve_year"
)
@parameterize_from_file(
"test_get_yield_curve",
@@ -53,7 +53,9 @@ class TestFaYieldCurveModel:
df.to_csv().replace("\r\n", "\n"), expected_result.replace("\r\n", "\n")
)
- @mock.patch("gamestonk_terminal.fundamental_analysis.yield_curve_model.requests")
+ @mock.patch(
+ "gamestonk_terminal.stocks.fundamental_analysis.yield_curve_model.requests"
+ )
@parameterize_from_file(
"test_get_yield_curve_year",
"../tests/data/fa_yield_curve_model.yaml",
diff --git a/tests/test_pred_neural_networks.py b/tests/test_pred_neural_networks.py
index d804cc4f129..20d079200c5 100644
--- a/tests/test_pred_neural_networks.py
+++ b/tests/test_pred_neural_networks.py
@@ -2,7 +2,7 @@
import unittest
try:
- from gamestonk_terminal.prediction_techniques.neural_networks_view import mlp
+ from gamestonk_terminal.common.prediction_techniques.neural_networks_view import mlp
except ModuleNotFoundError as e_module:
print("One of the optional packages seems to be missing")
print(e_module)