mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-05 17:01:58 +00:00
new black update -- many files changed
This commit is contained in:
@@ -13,7 +13,7 @@ from gamestonk_terminal.backtesting import bt_view
|
||||
|
||||
|
||||
class BacktestingController:
|
||||
"""Backtesting Class """
|
||||
"""Backtesting Class"""
|
||||
|
||||
CHOICES = ["help", "q", "quit", "ema", "ema_cross", "rsi"]
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ register_matplotlib_converters()
|
||||
|
||||
|
||||
def buy_and_hold(ticker: str, start: Union[str, datetime], name: str):
|
||||
""" Generates a backtest object for the given ticker"""
|
||||
"""Generates a backtest object for the given ticker"""
|
||||
prices = bt.get(ticker, start=start)
|
||||
bt_strategy = bt.Strategy(
|
||||
name,
|
||||
|
||||
@@ -16,7 +16,7 @@ class CryptoController:
|
||||
CHOICES = ["help", "q", "quit", "load", "view", "top"]
|
||||
|
||||
def __init__(self):
|
||||
""" CONSTRUCTOR """
|
||||
"""CONSTRUCTOR"""
|
||||
|
||||
self.crypto_parser = argparse.ArgumentParser(add_help=False, prog="crypto")
|
||||
self.crypto_parser.add_argument("cmd", choices=self.CHOICES)
|
||||
@@ -25,7 +25,7 @@ class CryptoController:
|
||||
|
||||
@staticmethod
|
||||
def print_help(current_coin):
|
||||
""" Print help """
|
||||
"""Print help"""
|
||||
print("\nCryptocurrency:")
|
||||
print(" help show this menu again")
|
||||
print(" q quit this menu, and shows back to main menu")
|
||||
|
||||
@@ -26,7 +26,7 @@ from gamestonk_terminal.discovery import (
|
||||
|
||||
|
||||
class DiscoveryController:
|
||||
""" Discovery Controller """
|
||||
"""Discovery Controller"""
|
||||
|
||||
# Command choices
|
||||
CHOICES = [
|
||||
@@ -65,7 +65,7 @@ class DiscoveryController:
|
||||
|
||||
@staticmethod
|
||||
def print_help():
|
||||
""" Print help """
|
||||
"""Print help"""
|
||||
|
||||
print("\nDiscovery Mode:")
|
||||
print(" help show this discovery menu again")
|
||||
|
||||
@@ -21,7 +21,7 @@ from gamestonk_terminal.menu import session
|
||||
|
||||
|
||||
class DueDiligenceController:
|
||||
""" Due Diligence Controller """
|
||||
"""Due Diligence Controller"""
|
||||
|
||||
# Command choices
|
||||
CHOICES = [
|
||||
@@ -68,7 +68,7 @@ class DueDiligenceController:
|
||||
)
|
||||
|
||||
def print_help(self):
|
||||
""" Print help """
|
||||
"""Print help"""
|
||||
|
||||
intraday = (f"Intraday {self.interval}", "Daily")[self.interval == "1440min"]
|
||||
|
||||
@@ -134,59 +134,59 @@ class DueDiligenceController:
|
||||
return True
|
||||
|
||||
def call_red(self, other_args: List[str]):
|
||||
""" Process red command """
|
||||
"""Process red command"""
|
||||
r_view.due_diligence(other_args, self.ticker)
|
||||
|
||||
def call_insider(self, other_args: List[str]):
|
||||
""" Process insider command """
|
||||
"""Process insider command"""
|
||||
fvz_view.insider(other_args, self.ticker)
|
||||
|
||||
def call_news(self, other_args: List[str]):
|
||||
""" Process news command """
|
||||
"""Process news command"""
|
||||
news_view.news(other_args, self.ticker)
|
||||
|
||||
def call_analyst(self, other_args: List[str]):
|
||||
""" Process analyst command """
|
||||
"""Process analyst command"""
|
||||
fvz_view.analyst(other_args, self.ticker)
|
||||
|
||||
def call_pt(self, other_args: List[str]):
|
||||
""" Process pt command """
|
||||
"""Process pt command"""
|
||||
bi_view.price_target_from_analysts(
|
||||
other_args, self.stock, self.ticker, self.start, self.interval
|
||||
)
|
||||
|
||||
def call_est(self, other_args: List[str]):
|
||||
""" Process est command """
|
||||
"""Process est command"""
|
||||
bi_view.estimates(other_args, self.ticker)
|
||||
|
||||
def call_ins(self, other_args: List[str]):
|
||||
""" Process ins command """
|
||||
"""Process ins command"""
|
||||
bi_view.insider_activity(
|
||||
other_args, self.stock, self.ticker, self.start, self.interval
|
||||
)
|
||||
|
||||
def call_rating(self, other_args: List[str]):
|
||||
""" Process rating command """
|
||||
"""Process rating command"""
|
||||
fmp_view.rating(other_args, self.ticker)
|
||||
|
||||
def call_warnings(self, other_args: List[str]):
|
||||
""" Process rating command """
|
||||
"""Process rating command"""
|
||||
mw_view.sean_seah_warnings(other_args, self.ticker)
|
||||
|
||||
def call_sec(self, other_args: List[str]):
|
||||
""" Process sec command """
|
||||
"""Process sec command"""
|
||||
mw_view.sec_fillings(other_args, self.ticker)
|
||||
|
||||
def call_short(self, other_args: List[str]):
|
||||
""" Process short command """
|
||||
"""Process short command"""
|
||||
q_view.short_interest(other_args, self.ticker, self.start)
|
||||
|
||||
def call_dp(self, other_args: List[str]):
|
||||
""" Process dp command """
|
||||
"""Process dp command"""
|
||||
finra_view.dark_pool(other_args, self.ticker)
|
||||
|
||||
def call_ftd(self, other_args: List[str]):
|
||||
""" Process ftd command """
|
||||
"""Process ftd command"""
|
||||
sec_view.fails_to_deliver(other_args, self.ticker)
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from gamestonk_terminal.fred import fred_view
|
||||
|
||||
|
||||
class FredController:
|
||||
""" Fred Controller """
|
||||
"""Fred Controller"""
|
||||
|
||||
# Command choices
|
||||
CHOICES = [
|
||||
@@ -42,7 +42,7 @@ class FredController:
|
||||
|
||||
@staticmethod
|
||||
def print_help():
|
||||
""" Print help """
|
||||
"""Print help"""
|
||||
|
||||
print("\nFred Economic Data:")
|
||||
print(" help show this menu again")
|
||||
|
||||
@@ -12,7 +12,7 @@ from gamestonk_terminal.menu import session
|
||||
|
||||
|
||||
class AlphaVantageController:
|
||||
""" Alpha Vantage Controller """
|
||||
"""Alpha Vantage Controller"""
|
||||
|
||||
# Command choices
|
||||
CHOICES = [
|
||||
@@ -50,7 +50,7 @@ class AlphaVantageController:
|
||||
)
|
||||
|
||||
def print_help(self):
|
||||
""" Print help """
|
||||
"""Print help"""
|
||||
|
||||
intraday = (f"Intraday {self.interval}", "Daily")[self.interval == "1440min"]
|
||||
|
||||
@@ -103,27 +103,27 @@ class AlphaVantageController:
|
||||
return True
|
||||
|
||||
def call_overview(self, other_args: List[str]):
|
||||
""" Process overview command """
|
||||
"""Process overview command"""
|
||||
avv.overview(other_args, self.ticker)
|
||||
|
||||
def call_key(self, other_args: List[str]):
|
||||
""" Process overview command """
|
||||
"""Process overview command"""
|
||||
avv.key(other_args, self.ticker)
|
||||
|
||||
def call_income(self, other_args: List[str]):
|
||||
""" Process income command """
|
||||
"""Process income command"""
|
||||
avv.income_statement(other_args, self.ticker)
|
||||
|
||||
def call_balance(self, other_args: List[str]):
|
||||
""" Process balance command """
|
||||
"""Process balance command"""
|
||||
avv.balance_sheet(other_args, self.ticker)
|
||||
|
||||
def call_cash(self, other_args: List[str]):
|
||||
""" Process cash command """
|
||||
"""Process cash command"""
|
||||
avv.cash_flow(other_args, self.ticker)
|
||||
|
||||
def call_earnings(self, other_args: List[str]):
|
||||
""" Process earnings command """
|
||||
"""Process earnings command"""
|
||||
avv.earnings(other_args, self.ticker)
|
||||
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ from gamestonk_terminal.menu import session
|
||||
|
||||
|
||||
class FundamentalAnalysisController:
|
||||
""" Fundamental Analysis Controller """
|
||||
"""Fundamental Analysis Controller"""
|
||||
|
||||
# Command choices
|
||||
CHOICES = [
|
||||
@@ -65,7 +65,7 @@ class FundamentalAnalysisController:
|
||||
)
|
||||
|
||||
def print_help(self):
|
||||
""" Print help """
|
||||
"""Print help"""
|
||||
|
||||
intraday = (f"Intraday {self.interval}", "Daily")[self.interval == "1440min"]
|
||||
|
||||
@@ -135,48 +135,48 @@ class FundamentalAnalysisController:
|
||||
return True
|
||||
|
||||
def call_mgmt(self, other_args: List[str]):
|
||||
""" Process mgmt command """
|
||||
"""Process mgmt command"""
|
||||
biw.management(other_args, self.ticker)
|
||||
|
||||
def call_screener(self, other_args: List[str]):
|
||||
""" Process screener command """
|
||||
"""Process screener command"""
|
||||
finviz_view.screener(other_args, self.ticker)
|
||||
|
||||
def call_score(self, other_args: List[str]):
|
||||
""" Process score command """
|
||||
"""Process score command"""
|
||||
fmpv.valinvest_score(other_args, self.ticker)
|
||||
|
||||
def call_income(self, other_args: List[str]):
|
||||
""" Process income command """
|
||||
"""Process income command"""
|
||||
market_watch_view.income(other_args, self.ticker)
|
||||
|
||||
def call_balance(self, other_args: List[str]):
|
||||
""" Process balance command """
|
||||
"""Process balance command"""
|
||||
market_watch_view.balance(other_args, self.ticker)
|
||||
|
||||
def call_cash(self, other_args: List[str]):
|
||||
""" Process cash command """
|
||||
"""Process cash command"""
|
||||
market_watch_view.cash(other_args, self.ticker)
|
||||
|
||||
def call_info(self, other_args: List[str]):
|
||||
""" Process info command """
|
||||
"""Process info command"""
|
||||
yahoo_finance_view.info(other_args, self.ticker)
|
||||
|
||||
def call_shrs(self, other_args: List[str]):
|
||||
""" Process shrs command """
|
||||
"""Process shrs command"""
|
||||
yahoo_finance_view.shareholders(other_args, self.ticker)
|
||||
|
||||
def call_sust(self, other_args: List[str]):
|
||||
""" Process sust command """
|
||||
"""Process sust command"""
|
||||
yahoo_finance_view.sustainability(other_args, self.ticker)
|
||||
|
||||
def call_cal(self, other_args: List[str]):
|
||||
""" Process cal command """
|
||||
"""Process cal command"""
|
||||
yahoo_finance_view.calendar_earnings(other_args, self.ticker)
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
def call_av(self, other_args: List[str]):
|
||||
""" Process av command """
|
||||
"""Process av command"""
|
||||
ret = avc.menu(self.ticker, self.start, self.interval)
|
||||
|
||||
if ret is not True:
|
||||
@@ -184,7 +184,7 @@ class FundamentalAnalysisController:
|
||||
|
||||
# pylint: disable=unused-argument
|
||||
def call_fmp(self, other_args: List[str]):
|
||||
""" Process fmp command """
|
||||
"""Process fmp command"""
|
||||
ret = fmpc.menu(self.ticker, self.start, self.interval)
|
||||
|
||||
if ret is not True:
|
||||
|
||||
@@ -14,7 +14,7 @@ from gamestonk_terminal.menu import session
|
||||
|
||||
|
||||
class FinancialModelingPrepController:
|
||||
""" Financial Modeling Prep Controller """
|
||||
"""Financial Modeling Prep Controller"""
|
||||
|
||||
# Command choices
|
||||
CHOICES = [
|
||||
@@ -56,7 +56,7 @@ class FinancialModelingPrepController:
|
||||
)
|
||||
|
||||
def print_help(self):
|
||||
""" Print help """
|
||||
"""Print help"""
|
||||
|
||||
intraday = (f"Intraday {self.interval}", "Daily")[self.interval == "1440min"]
|
||||
|
||||
@@ -113,43 +113,43 @@ class FinancialModelingPrepController:
|
||||
return True
|
||||
|
||||
def call_profile(self, other_args: List[str]):
|
||||
""" Process profile command """
|
||||
"""Process profile command"""
|
||||
fmpv.profile(other_args, self.ticker)
|
||||
|
||||
def call_quote(self, other_args: List[str]):
|
||||
""" Process quote command """
|
||||
"""Process quote command"""
|
||||
fmpv.quote(other_args, self.ticker)
|
||||
|
||||
def call_enterprise(self, other_args: List[str]):
|
||||
""" Process income command """
|
||||
"""Process income command"""
|
||||
fmpv.enterprise(other_args, self.ticker)
|
||||
|
||||
def call_dcf(self, other_args: List[str]):
|
||||
""" Process dcf command """
|
||||
"""Process dcf command"""
|
||||
fmpv.discounted_cash_flow(other_args, self.ticker)
|
||||
|
||||
def call_income(self, other_args: List[str]):
|
||||
""" Process income command """
|
||||
"""Process income command"""
|
||||
fmpv.income_statement(other_args, self.ticker)
|
||||
|
||||
def call_balance(self, other_args: List[str]):
|
||||
""" Process balance command """
|
||||
"""Process balance command"""
|
||||
fmpv.balance_sheet(other_args, self.ticker)
|
||||
|
||||
def call_cash(self, other_args: List[str]):
|
||||
""" Process cash command """
|
||||
"""Process cash command"""
|
||||
fmpv.cash_flow(other_args, self.ticker)
|
||||
|
||||
def call_metrics(self, other_args: List[str]):
|
||||
""" Process metrics command """
|
||||
"""Process metrics command"""
|
||||
fmpv.key_metrics(other_args, self.ticker)
|
||||
|
||||
def call_ratios(self, other_args: List[str]):
|
||||
""" Process cash command """
|
||||
"""Process cash command"""
|
||||
fmpv.financial_ratios(other_args, self.ticker)
|
||||
|
||||
def call_growth(self, other_args: List[str]):
|
||||
""" Process cash command """
|
||||
"""Process cash command"""
|
||||
fmpv.financial_statement_growth(other_args, self.ticker)
|
||||
|
||||
|
||||
|
||||
@@ -130,7 +130,7 @@ def us_market_holidays(years) -> list:
|
||||
|
||||
|
||||
def b_is_stock_market_open() -> bool:
|
||||
""" checks if the stock market is open """
|
||||
"""checks if the stock market is open"""
|
||||
# Get current US time
|
||||
now = datetime.now(timezone("US/Eastern"))
|
||||
# Check if it is a weekend
|
||||
|
||||
@@ -169,7 +169,7 @@ class OptionsController:
|
||||
|
||||
|
||||
def menu(ticker: str, last_adj_close_price: float):
|
||||
""" Options Menu. """
|
||||
"""Options Menu."""
|
||||
|
||||
try:
|
||||
op_controller = OptionsController(ticker, last_adj_close_price)
|
||||
|
||||
@@ -11,7 +11,7 @@ from gamestonk_terminal.helper_funcs import get_flair
|
||||
|
||||
|
||||
class PapermillController:
|
||||
""" Papermill Controller class"""
|
||||
"""Papermill Controller class"""
|
||||
|
||||
def __init__(self):
|
||||
"""Constructor"""
|
||||
|
||||
@@ -16,7 +16,7 @@ from gamestonk_terminal.portfolio.portfolio_helpers import (
|
||||
|
||||
|
||||
class PortfolioController:
|
||||
""" Portfolio Controller """
|
||||
"""Portfolio Controller"""
|
||||
|
||||
CHOICES = [
|
||||
"help",
|
||||
@@ -46,7 +46,7 @@ class PortfolioController:
|
||||
@staticmethod
|
||||
def print_help(broker_list):
|
||||
|
||||
""" Print help """
|
||||
"""Print help"""
|
||||
print("\nBrokers Supported: rh - Robinhood")
|
||||
print(" alp - Alpaca")
|
||||
print(" ally - Ally Invest")
|
||||
|
||||
@@ -111,7 +111,7 @@ l_valid_property_infos = [
|
||||
|
||||
|
||||
def check_valid_property_type(aproperty: str) -> str:
|
||||
""" Check that the property selected is valid """
|
||||
"""Check that the property selected is valid"""
|
||||
if aproperty in l_valid_property_infos:
|
||||
return aproperty
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ class PortfolioOptimization:
|
||||
print("")
|
||||
|
||||
def add_stocks(self, other_args: List[str]):
|
||||
""" Add ticker or Select tickes for portfolio to be optimized """
|
||||
"""Add ticker or Select tickes for portfolio to be optimized"""
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
prog="add/select",
|
||||
|
||||
@@ -342,7 +342,7 @@ def _preprocess_split(df_stock, ns_parser):
|
||||
|
||||
|
||||
def _rescale_data(df_stock, ns_parser, scaler, yhat, idx_loop):
|
||||
"""Re-scale the data back and return the prediction dataframe. """
|
||||
"""Re-scale the data back and return the prediction dataframe."""
|
||||
if (ns_parser.s_preprocessing == "standardization") or (
|
||||
ns_parser.s_preprocessing == "normalization"
|
||||
):
|
||||
@@ -362,7 +362,7 @@ def _rescale_data(df_stock, ns_parser, scaler, yhat, idx_loop):
|
||||
def _plot_and_print_results(
|
||||
df_stock, ns_parser, df_future, df_pred, model_name, s_ticker
|
||||
):
|
||||
"""Plot and print the results. """
|
||||
"""Plot and print the results."""
|
||||
# Plotting
|
||||
plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI)
|
||||
plt.plot(df_stock.index, df_stock["5. adjusted close"], lw=3)
|
||||
|
||||
@@ -61,7 +61,7 @@ class PredictionTechniquesController:
|
||||
)
|
||||
|
||||
def print_help(self):
|
||||
""" Print help """
|
||||
"""Print help"""
|
||||
|
||||
s_intraday = (f"Intraday {self.interval}", "Daily")[self.interval == "1440min"]
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import webbrowser
|
||||
|
||||
|
||||
def print_research(s_ticker, s_start, s_interval):
|
||||
""" Print help """
|
||||
"""Print help"""
|
||||
|
||||
s_intraday = (f"Intraday {s_interval}", "Daily")[s_interval == "1440min"]
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class ScreenerController:
|
||||
|
||||
@staticmethod
|
||||
def view_available_presets(other_args: List[str]):
|
||||
""" View available presets. """
|
||||
"""View available presets."""
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
prog="view",
|
||||
@@ -119,7 +119,7 @@ class ScreenerController:
|
||||
|
||||
@staticmethod
|
||||
def set_preset(self, other_args: List[str]):
|
||||
""" Set preset """
|
||||
"""Set preset"""
|
||||
parser = argparse.ArgumentParser(
|
||||
add_help=False,
|
||||
prog="set",
|
||||
|
||||
@@ -53,7 +53,7 @@ def parameterize_from_file(test_namespace: str, parameter_file: str) -> Callable
|
||||
|
||||
|
||||
def pytest_generate_tests(metafunc):
|
||||
""" https://docs.pytest.org/en/stable/parametrize.html#pytest-generate-tests """
|
||||
"""https://docs.pytest.org/en/stable/parametrize.html#pytest-generate-tests"""
|
||||
if getattr(metafunc.function, "test_params_names", None):
|
||||
metafunc.parametrize(
|
||||
metafunc.function.test_params_names,
|
||||
|
||||
@@ -11,10 +11,10 @@ from gamestonk_terminal.helper_funcs import get_user_agent
|
||||
|
||||
|
||||
class ThoughtOfTheDay:
|
||||
""" ThoughtOfTheDay class """
|
||||
"""ThoughtOfTheDay class"""
|
||||
|
||||
def __init__(self, urls: Dict[str, str] = None):
|
||||
""" Constructor """
|
||||
"""Constructor"""
|
||||
|
||||
self.metadata = {} # type: Dict
|
||||
|
||||
@@ -34,7 +34,7 @@ class ThoughtOfTheDay:
|
||||
self.urls = urls
|
||||
|
||||
def get_urls(self) -> dict:
|
||||
""" Getter method for URLs """
|
||||
"""Getter method for URLs"""
|
||||
return self.urls
|
||||
|
||||
def get_metadata(self, author: str) -> dict:
|
||||
|
||||
Reference in New Issue
Block a user