mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-11-07 01:41:17 +00:00
@@ -58,8 +58,8 @@ def watchlist(other_args: List[str]):
|
||||
|
||||
d_submission: Dict = {}
|
||||
d_watchlist_tickers: Dict = {}
|
||||
l_watchlist_links = list()
|
||||
l_watchlist_author = list()
|
||||
l_watchlist_links = []
|
||||
l_watchlist_author = []
|
||||
|
||||
praw_api = praw.Reddit(
|
||||
client_id=cfg.API_REDDIT_CLIENT_ID,
|
||||
@@ -237,8 +237,8 @@ def popular_tickers(other_args: List[str]):
|
||||
|
||||
# d_submission = {}
|
||||
d_watchlist_tickers: Dict = {}
|
||||
# l_watchlist_links = list()
|
||||
l_watchlist_author = list()
|
||||
# l_watchlist_links = []
|
||||
l_watchlist_author = []
|
||||
|
||||
praw_api = praw.Reddit(
|
||||
client_id=cfg.API_REDDIT_CLIENT_ID,
|
||||
@@ -419,8 +419,8 @@ def spac_community(other_args: List[str]):
|
||||
|
||||
d_submission: Dict = {}
|
||||
d_watchlist_tickers: Dict = {}
|
||||
l_watchlist_links = list()
|
||||
l_watchlist_author = list()
|
||||
l_watchlist_links = []
|
||||
l_watchlist_author = []
|
||||
|
||||
# psaw_api = PushshiftAPI()
|
||||
|
||||
@@ -543,8 +543,8 @@ def spac(other_args: List[str]):
|
||||
|
||||
d_submission: Dict = {}
|
||||
d_watchlist_tickers: Dict = {}
|
||||
l_watchlist_links = list()
|
||||
l_watchlist_author = list()
|
||||
l_watchlist_links = []
|
||||
l_watchlist_author = []
|
||||
|
||||
# n_ts_after = int(
|
||||
# (datetime.today() - timedelta(days=ns_parser.n_days)).timestamp()
|
||||
@@ -696,7 +696,7 @@ def wsb_community(other_args: List[str]):
|
||||
)
|
||||
|
||||
d_submission: Dict = {}
|
||||
l_watchlist_links = list()
|
||||
l_watchlist_links = []
|
||||
|
||||
# psaw_api = PushshiftAPI()
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ def trending(other_args: List[str]):
|
||||
|
||||
result = requests.get("https://api.stocktwits.com/api/2/trending/symbols.json")
|
||||
if result.status_code == 200:
|
||||
l_symbols = list()
|
||||
l_symbols = []
|
||||
for symbol in result.json()["symbols"]:
|
||||
l_symbols.append(
|
||||
[symbol["symbol"], symbol["watchlist_count"], symbol["title"]]
|
||||
|
||||
@@ -305,7 +305,7 @@ def bwm(other_args: List[str], ticker: str, stock: pd.DataFrame, start: datetime
|
||||
"Nov",
|
||||
"Dec",
|
||||
]
|
||||
l_ticks = list()
|
||||
l_ticks = []
|
||||
for val in box_plot.get_xticklabels():
|
||||
l_ticks.append(l_months[int(val.get_text()) - 1])
|
||||
box_plot.set_xticklabels(l_ticks)
|
||||
|
||||
@@ -477,7 +477,7 @@ def load_binance_map() -> pd.DataFrame:
|
||||
symbol, id
|
||||
"""
|
||||
path = os.path.abspath(__file__ + "/../../")
|
||||
with open(path + "/data/binance_gecko_map.json") as f:
|
||||
with open(path + "/data/binance_gecko_map.json", encoding="utf8") as f:
|
||||
coins = json.load(f)
|
||||
|
||||
coins_df = pd.Series(coins).reset_index()
|
||||
|
||||
@@ -100,7 +100,7 @@ def calculate_time_delta(date: dt.datetime) -> int:
|
||||
|
||||
|
||||
def get_eth_addresses_for_cg_coins(file) -> pd.DataFrame: # pragma: no cover
|
||||
with open(file) as f:
|
||||
with open(file, encoding="utf8") as f:
|
||||
data = json.load(f)
|
||||
df = pd.DataFrame(data)
|
||||
df["ethereum"] = df["platforms"].apply(
|
||||
|
||||
@@ -44,7 +44,7 @@ def display_series(series: str, start_date: str, raw: bool, export: str):
|
||||
Export dataframe data to csv,json,xlsx file
|
||||
"""
|
||||
if export:
|
||||
l_series_fred = list()
|
||||
l_series_fred = []
|
||||
|
||||
if not raw:
|
||||
_, ax = plt.subplots(figsize=plot_autoscale(), dpi=PLOT_DPI)
|
||||
@@ -63,12 +63,12 @@ def display_series(series: str, start_date: str, raw: bool, export: str):
|
||||
"tab:cyan",
|
||||
]
|
||||
|
||||
l_ts_start = list()
|
||||
l_ts_end = list()
|
||||
l_ts_start = []
|
||||
l_ts_end = []
|
||||
p = {}
|
||||
success = -1
|
||||
success_series = list()
|
||||
success_titles = list()
|
||||
success_series = []
|
||||
success_titles = []
|
||||
|
||||
for serie_term in series.split(","):
|
||||
if serie_term:
|
||||
|
||||
@@ -382,7 +382,7 @@ def divide_chunks(data, n):
|
||||
def get_next_stock_market_days(last_stock_day, n_next_days) -> list:
|
||||
"""gets the next stock market day. Checks against weekends and holidays"""
|
||||
n_days = 0
|
||||
l_pred_days = list()
|
||||
l_pred_days = []
|
||||
years: list = []
|
||||
holidays: list = []
|
||||
while n_days < n_next_days:
|
||||
@@ -712,7 +712,7 @@ def get_last_time_market_was_open(dt):
|
||||
|
||||
|
||||
def find_tickers(submission):
|
||||
ls_text = list()
|
||||
ls_text = []
|
||||
ls_text.append(submission.selftext)
|
||||
ls_text.append(submission.title)
|
||||
|
||||
@@ -720,7 +720,7 @@ def find_tickers(submission):
|
||||
for comment in submission.comments.list():
|
||||
ls_text.append(comment.body)
|
||||
|
||||
l_tickers_found = list()
|
||||
l_tickers_found = []
|
||||
for s_text in ls_text:
|
||||
for s_ticker in set(re.findall(r"([A-Z]{3,5} )", s_text)):
|
||||
l_tickers_found.append(s_ticker.strip())
|
||||
|
||||
@@ -165,7 +165,7 @@ def get_sentiments(similar: List[str]) -> pd.DataFrame:
|
||||
"""
|
||||
|
||||
df_sentiment = pd.DataFrame()
|
||||
dates_sentiment = list()
|
||||
dates_sentiment = []
|
||||
for ticker in similar:
|
||||
result = requests.get(f"https://api.finbrain.tech/v0/sentiments/{ticker}")
|
||||
if result.status_code == 200:
|
||||
|
||||
@@ -389,7 +389,7 @@ def prepare_df_financials(
|
||||
)
|
||||
|
||||
# Define financials columns
|
||||
a_financials_header = list()
|
||||
a_financials_header = []
|
||||
for financials_header in text_soup_financials.findAll(
|
||||
"th", {"class": "overflow__heading"}
|
||||
):
|
||||
@@ -412,7 +412,7 @@ def prepare_df_financials(
|
||||
)
|
||||
|
||||
for a_row in financials_rows:
|
||||
constructed_row = list()
|
||||
constructed_row = []
|
||||
financial_columns = a_row.findAll(
|
||||
"td", {"class": ["overflow__cell", "overflow__cell fixed--column"]}
|
||||
)
|
||||
|
||||
@@ -135,7 +135,7 @@ def historical(
|
||||
l_stocks = similar[:]
|
||||
|
||||
while l_stocks:
|
||||
l_parsed_stocks = list()
|
||||
l_parsed_stocks = []
|
||||
for symbol in l_stocks:
|
||||
try:
|
||||
df_similar_stock = yf.download(
|
||||
|
||||
@@ -286,7 +286,7 @@ def getTickerFINRAdata(ticker: str) -> Tuple[pd.DataFrame, pd.DataFrame]:
|
||||
"""
|
||||
tiers = ["T1", "T2", "OTCE"]
|
||||
|
||||
l_data = list()
|
||||
l_data = []
|
||||
for tier in tiers:
|
||||
for d_week in getFINRAweeks(tier, is_ats=True):
|
||||
status_code, response = getFINRAdata(
|
||||
@@ -305,7 +305,7 @@ def getTickerFINRAdata(ticker: str) -> Tuple[pd.DataFrame, pd.DataFrame]:
|
||||
df_ats = df_ats.sort_values("weekStartDate")
|
||||
df_ats = df_ats.set_index("weekStartDate")
|
||||
|
||||
l_data = list()
|
||||
l_data = []
|
||||
for tier in tiers:
|
||||
for d_week in getFINRAweeks(tier, is_ats=False):
|
||||
status_code, response = getFINRAdata(
|
||||
|
||||
@@ -72,7 +72,7 @@ def get_fails_to_deliver(
|
||||
# Filter by start and end dates for FTD
|
||||
else:
|
||||
base_url = "https://www.sec.gov/files/data/fails-deliver-data/cnsfails"
|
||||
ftd_dates = list()
|
||||
ftd_dates = []
|
||||
|
||||
for y in range(start.year, end.year + 1):
|
||||
if y < end.year:
|
||||
|
||||
@@ -27,7 +27,7 @@ def get_high_short_interest() -> DataFrame:
|
||||
"lxml",
|
||||
)
|
||||
|
||||
a_high_short_interest_header = list()
|
||||
a_high_short_interest_header = []
|
||||
for high_short_interest_header in text_soup_high_short_interested_stocks.findAll(
|
||||
"td", {"class": "tblhdr"}
|
||||
):
|
||||
@@ -39,7 +39,7 @@ def get_high_short_interest() -> DataFrame:
|
||||
|
||||
stock_list_tr = text_soup_high_short_interested_stocks.find_all("tr")
|
||||
|
||||
shorted_stock_data = list()
|
||||
shorted_stock_data = []
|
||||
for a_stock in stock_list_tr:
|
||||
a_stock_txt = a_stock.text
|
||||
|
||||
@@ -53,6 +53,6 @@ def get_high_short_interest() -> DataFrame:
|
||||
len(df_high_short_interest.index)
|
||||
] = shorted_stock_data[:-1]
|
||||
|
||||
shorted_stock_data = list()
|
||||
shorted_stock_data = []
|
||||
|
||||
return df_high_short_interest
|
||||
|
||||
@@ -28,8 +28,8 @@ def get_orders() -> Tuple[str, DataFrame]:
|
||||
requests.get(url_orders, headers={"User-Agent": get_user_agent()}).text, "lxml"
|
||||
)
|
||||
|
||||
l_orders = list()
|
||||
l_orders_vals = list()
|
||||
l_orders = []
|
||||
l_orders_vals = []
|
||||
idx = 0
|
||||
order_list = text_soup_url_orders.findAll(
|
||||
"td",
|
||||
@@ -59,7 +59,7 @@ def get_orders() -> Tuple[str, DataFrame]:
|
||||
# Add value to dictionary
|
||||
if (idx + 1) % 8 == 0:
|
||||
l_orders.append(l_orders_vals)
|
||||
l_orders_vals = list()
|
||||
l_orders_vals = []
|
||||
idx = 0
|
||||
|
||||
df_orders = pd.DataFrame(
|
||||
|
||||
@@ -41,7 +41,7 @@ def get_ratings() -> List[dict]:
|
||||
Ratings list
|
||||
"""
|
||||
|
||||
ratings = list()
|
||||
ratings = []
|
||||
url_ratings = "https://www.marketbeat.com/ratings/"
|
||||
|
||||
text_soup_ratings = BeautifulSoup(
|
||||
|
||||
@@ -44,7 +44,7 @@ def get_next_earnings(pages: int) -> DataFrame:
|
||||
DataFrame
|
||||
Upcoming earnings DataFrame
|
||||
"""
|
||||
earnings = list()
|
||||
earnings = []
|
||||
url_next_earnings = "https://seekingalpha.com/earnings/earnings-calendar"
|
||||
|
||||
for idx in range(0, pages):
|
||||
@@ -54,7 +54,7 @@ def get_next_earnings(pages: int) -> DataFrame:
|
||||
)
|
||||
|
||||
for stock_rows in text_soup_earnings.findAll("tr", {"data-exchange": "NASDAQ"}):
|
||||
stocks = list()
|
||||
stocks = []
|
||||
for a_stock in stock_rows.contents[:3]:
|
||||
stocks.append(a_stock.text)
|
||||
earnings.append(stocks)
|
||||
@@ -157,7 +157,7 @@ def get_trending_list(num: int) -> list:
|
||||
Trending articles list
|
||||
"""
|
||||
|
||||
articles = list()
|
||||
articles = []
|
||||
url_articles = "https://seekingalpha.com/news/trending_news"
|
||||
response = requests.get(url_articles, headers={"User-Agent": get_user_agent()})
|
||||
|
||||
|
||||
@@ -30,8 +30,8 @@ def upcoming_earning_release_dates(num_pages: int, num_earnings: int, export: st
|
||||
|
||||
pd.set_option("display.max_colwidth", None)
|
||||
if export:
|
||||
l_earnings = list()
|
||||
l_earnings_dates = list()
|
||||
l_earnings = []
|
||||
l_earnings_dates = []
|
||||
|
||||
for n_days, earning_date in enumerate(df_earnings.index.unique()):
|
||||
if n_days > (num_earnings - 1):
|
||||
|
||||
@@ -27,7 +27,7 @@ def get_low_float() -> DataFrame:
|
||||
"lxml",
|
||||
)
|
||||
|
||||
a_low_float_header = list()
|
||||
a_low_float_header = []
|
||||
for low_float_header in text_soup_low_float_stocks.findAll(
|
||||
"td", {"class": "tblhdr"}
|
||||
):
|
||||
@@ -37,7 +37,7 @@ def get_low_float() -> DataFrame:
|
||||
|
||||
stock_list_tr = text_soup_low_float_stocks.find_all("tr")
|
||||
|
||||
low_float_data = list()
|
||||
low_float_data = []
|
||||
for a_stock in stock_list_tr:
|
||||
a_stock_txt = a_stock.text
|
||||
|
||||
@@ -49,7 +49,7 @@ def get_low_float() -> DataFrame:
|
||||
if len(low_float_data) == 8:
|
||||
df_low_float.loc[len(df_low_float.index)] = low_float_data[:-1]
|
||||
|
||||
low_float_data = list()
|
||||
low_float_data = []
|
||||
|
||||
return df_low_float
|
||||
|
||||
@@ -72,7 +72,7 @@ def get_today_hot_penny_stocks() -> DataFrame:
|
||||
"lxml",
|
||||
)
|
||||
|
||||
a_penny_stock_header = list()
|
||||
a_penny_stock_header = []
|
||||
for penny_stock_header in text_soup_penny_stock_stocks.findAll(
|
||||
"td", {"class": "tblhdr"}
|
||||
):
|
||||
@@ -80,7 +80,7 @@ def get_today_hot_penny_stocks() -> DataFrame:
|
||||
|
||||
df_penny = pd.DataFrame(columns=a_penny_stock_header)
|
||||
|
||||
first_penny = list()
|
||||
first_penny = []
|
||||
for idx, penny_stock_header in enumerate(text_soup_penny_stock_stocks.findAll("a")):
|
||||
if idx == 0:
|
||||
continue
|
||||
@@ -97,7 +97,7 @@ def get_today_hot_penny_stocks() -> DataFrame:
|
||||
|
||||
df_penny.loc[0] = first_penny
|
||||
|
||||
a_penny_stock = list()
|
||||
a_penny_stock = []
|
||||
penny_idx = 1
|
||||
for idx, penny_stock in enumerate(
|
||||
text_soup_penny_stock_stocks.findAll("td", {"class": "tdi"})
|
||||
@@ -107,6 +107,6 @@ def get_today_hot_penny_stocks() -> DataFrame:
|
||||
if (idx + 1) % 6 == 0:
|
||||
df_penny.loc[penny_idx] = a_penny_stock
|
||||
penny_idx += 1
|
||||
a_penny_stock = list()
|
||||
a_penny_stock = []
|
||||
|
||||
return df_penny
|
||||
|
||||
@@ -173,8 +173,8 @@ def estimates(other_args: List[str], ticker: str):
|
||||
"lxml",
|
||||
)
|
||||
|
||||
l_estimates_year_header = list()
|
||||
l_estimates_quarter_header = list()
|
||||
l_estimates_year_header = []
|
||||
l_estimates_quarter_header = []
|
||||
for estimates_header in text_soup_market_business_insider.findAll(
|
||||
"th", {"class": "table__th text-right"}
|
||||
):
|
||||
@@ -186,13 +186,13 @@ def estimates(other_args: List[str], ticker: str):
|
||||
):
|
||||
l_estimates_quarter_header.append(s_estimates_header)
|
||||
|
||||
l_estimates_year_metric = list()
|
||||
l_estimates_year_metric = []
|
||||
for estimates_year_metric in text_soup_market_business_insider.findAll(
|
||||
"td", {"class": "table__td black"}
|
||||
):
|
||||
l_estimates_year_metric.append(estimates_year_metric.text)
|
||||
|
||||
l_estimates_quarter_metric = list()
|
||||
l_estimates_quarter_metric = []
|
||||
for estimates_quarter_metric in text_soup_market_business_insider.findAll(
|
||||
"td", {"class": "table__td font-color-dim-gray"}
|
||||
):
|
||||
@@ -201,7 +201,7 @@ def estimates(other_args: List[str], ticker: str):
|
||||
d_metric_year = dict()
|
||||
d_metric_quarter_earnings = dict()
|
||||
d_metric_quarter_revenues = dict()
|
||||
l_metrics = list()
|
||||
l_metrics = []
|
||||
n_metrics = 0
|
||||
b_year = True
|
||||
for idx, metric_value in enumerate(
|
||||
@@ -218,13 +218,13 @@ def estimates(other_args: List[str], ticker: str):
|
||||
if n_metrics > len(l_estimates_year_metric) - 1:
|
||||
b_year = False
|
||||
n_metrics = 0
|
||||
l_metrics = list()
|
||||
l_metrics = []
|
||||
idx_y = idx
|
||||
|
||||
# Add value to dictionary
|
||||
if (idx + 1) % len(l_estimates_year_header) == 0:
|
||||
d_metric_year[l_estimates_year_metric[n_metrics]] = l_metrics
|
||||
l_metrics = list()
|
||||
l_metrics = []
|
||||
n_metrics += 1
|
||||
|
||||
if not b_year:
|
||||
@@ -245,7 +245,7 @@ def estimates(other_args: List[str], ticker: str):
|
||||
d_metric_quarter_revenues[
|
||||
l_estimates_quarter_metric[n_metrics - 4]
|
||||
] = l_metrics
|
||||
l_metrics = list()
|
||||
l_metrics = []
|
||||
n_metrics += 1
|
||||
|
||||
df_year_estimates = pd.DataFrame.from_dict(
|
||||
@@ -265,8 +265,8 @@ def estimates(other_args: List[str], ticker: str):
|
||||
)
|
||||
# df_quarter_revenues.index.name = 'Revenues'
|
||||
|
||||
l_quarter = list()
|
||||
l_date = list()
|
||||
l_quarter = []
|
||||
l_date = []
|
||||
for quarter_title in df_quarter_earnings.columns:
|
||||
l_quarter.append(re.split(" ending", quarter_title)[0])
|
||||
if len(re.split(" ending", quarter_title)) == 2:
|
||||
|
||||
@@ -35,7 +35,7 @@ def suppliers(ticker: str, other_args: List[str]):
|
||||
url_supply_chain = f"https://csimarket.com/stocks/competitionNO3.php?supply&code={ticker.upper()}"
|
||||
text_supplier_chain = BeautifulSoup(requests.get(url_supply_chain).text, "lxml")
|
||||
|
||||
l_supplier = list()
|
||||
l_supplier = []
|
||||
for supplier in text_supplier_chain.findAll(
|
||||
"td", {"class": "plavat svjetlirub dae al"}
|
||||
):
|
||||
@@ -79,7 +79,7 @@ def customers(ticker: str, other_args: List[str]):
|
||||
requests.get(url_customer_chain).text, "lxml"
|
||||
)
|
||||
|
||||
l_customer = list()
|
||||
l_customer = []
|
||||
for customer in text_customer_chain.findAll(
|
||||
"td", {"class": "plava svjetlirub"}
|
||||
):
|
||||
|
||||
@@ -59,7 +59,7 @@ def sec_fillings(other_args: List[str], ticker: str):
|
||||
"lxml",
|
||||
)
|
||||
|
||||
# a_financials_header = list()
|
||||
# a_financials_header = []
|
||||
df_financials = None
|
||||
b_ready_to_process_info = False
|
||||
soup_financials = text_soup_financials.findAll("tr", {"class": "table__row"})
|
||||
|
||||
@@ -60,7 +60,7 @@ def management(other_args: List[str], ticker: str):
|
||||
print("")
|
||||
return
|
||||
|
||||
l_titles = list()
|
||||
l_titles = []
|
||||
for s_title in found_h2s["Management"].findAll(
|
||||
"td", {"class": "table__td text-right"}
|
||||
):
|
||||
@@ -69,7 +69,7 @@ def management(other_args: List[str], ticker: str):
|
||||
):
|
||||
l_titles.append(s_title.text.strip())
|
||||
|
||||
l_names = list()
|
||||
l_names = []
|
||||
for s_name in found_h2s["Management"].findAll(
|
||||
"td", {"class": "table__td table--allow-wrap"}
|
||||
):
|
||||
|
||||
@@ -66,7 +66,7 @@ def prepare_df_financials(
|
||||
)
|
||||
|
||||
# Define financials columns
|
||||
a_financials_header = list()
|
||||
a_financials_header = []
|
||||
for financials_header in text_soup_financials.findAll(
|
||||
"th", {"class": "overflow__heading"}
|
||||
):
|
||||
@@ -93,7 +93,7 @@ def prepare_df_financials(
|
||||
)
|
||||
|
||||
for a_row in financials_rows:
|
||||
constructed_row = list()
|
||||
constructed_row = []
|
||||
financial_columns = a_row.findAll(
|
||||
"td", {"class": ["overflow__cell", "overflow__cell fixed--column"]}
|
||||
)
|
||||
|
||||
@@ -319,7 +319,7 @@ def sean_seah_warnings(other_args: List[str], ticker: str):
|
||||
)
|
||||
|
||||
# Define financials columns
|
||||
a_financials_header = list()
|
||||
a_financials_header = []
|
||||
for financials_header in text_soup_financials.findAll(
|
||||
"th", {"class": "overflow__heading"}
|
||||
):
|
||||
@@ -367,7 +367,7 @@ def sean_seah_warnings(other_args: List[str], ticker: str):
|
||||
)
|
||||
|
||||
# Define financials columns
|
||||
a_financials_header = list()
|
||||
a_financials_header = []
|
||||
for financials_header in text_soup_financials.findAll(
|
||||
"th", {"class": "overflow__heading"}
|
||||
):
|
||||
|
||||
@@ -72,7 +72,7 @@ def get_yield_curve_year(year: str) -> DataFrame:
|
||||
|
||||
yield_table = text_soup_yield_curve.find_all("table", {"class": "t-chart"})[0]
|
||||
|
||||
a_yield_table_header = list()
|
||||
a_yield_table_header = []
|
||||
for yield_table_header_col in yield_table.find("tr", {"class": None}).find_all(
|
||||
"th"
|
||||
):
|
||||
@@ -81,7 +81,7 @@ def get_yield_curve_year(year: str) -> DataFrame:
|
||||
df_yield_curve = pd.DataFrame(columns=a_yield_table_header)
|
||||
|
||||
for yield_table_row in yield_table.find_all("tr", {"class": ["oddrow", "evenrow"]}):
|
||||
a_yield_row = list()
|
||||
a_yield_row = []
|
||||
for idx, yield_table_col in enumerate(yield_table_row.find_all("td")):
|
||||
if idx == 0:
|
||||
a_yield_row.append(datetime.strptime(yield_table_col.text, "%m/%d/%y"))
|
||||
|
||||
@@ -838,7 +838,7 @@ def qtr_contracts(other_args: List[str]):
|
||||
]
|
||||
|
||||
max_amount = 0
|
||||
quarter_ticks = list()
|
||||
quarter_ticks = []
|
||||
for symbol in tickers:
|
||||
amounts = (
|
||||
df_contracts[df_contracts["Ticker"] == symbol]
|
||||
|
||||
@@ -69,7 +69,7 @@ def insider_activity(
|
||||
)
|
||||
|
||||
d_insider = dict()
|
||||
l_insider_vals = list()
|
||||
l_insider_vals = []
|
||||
for idx, insider_val in enumerate(
|
||||
text_soup_market_business_insider.findAll(
|
||||
"td", {"class": "table__td text-center"}
|
||||
@@ -85,7 +85,7 @@ def insider_activity(
|
||||
if "/" not in l_insider_vals[0]:
|
||||
break
|
||||
d_insider[(idx + 1) // 6] = l_insider_vals
|
||||
l_insider_vals = list()
|
||||
l_insider_vals = []
|
||||
|
||||
df_insider = pd.DataFrame.from_dict(
|
||||
d_insider,
|
||||
@@ -200,7 +200,7 @@ def insider_activity(
|
||||
|
||||
plt.show()
|
||||
|
||||
l_names = list()
|
||||
l_names = []
|
||||
for s_name in text_soup_market_business_insider.findAll(
|
||||
"a", {"onclick": "silentTrackPI()"}
|
||||
):
|
||||
|
||||
@@ -1246,9 +1246,9 @@ def get_open_insider_data(url: str, has_company_name: bool) -> pd.DataFrame:
|
||||
print("No insider trading found.")
|
||||
return pd.DataFrame()
|
||||
|
||||
l_filing_link = list()
|
||||
l_ticker_link = list()
|
||||
l_insider_link = list()
|
||||
l_filing_link = []
|
||||
l_ticker_link = []
|
||||
l_insider_link = []
|
||||
|
||||
idx = 0
|
||||
for val in text_soup_open_insider.find_all("tbody")[1].find_all("a"):
|
||||
@@ -1264,19 +1264,19 @@ def get_open_insider_data(url: str, has_company_name: bool) -> pd.DataFrame:
|
||||
l_insider_link.append("http://openinsider.com" + val["href"])
|
||||
idx = 0
|
||||
|
||||
l_X = list()
|
||||
l_filing_date = list()
|
||||
l_trading_date = list()
|
||||
l_ticker = list()
|
||||
l_company = list()
|
||||
l_insider = list()
|
||||
l_title = list()
|
||||
l_trade_type = list()
|
||||
l_price = list()
|
||||
l_quantity = list()
|
||||
l_owned = list()
|
||||
l_delta_own = list()
|
||||
l_value = list()
|
||||
l_X = []
|
||||
l_filing_date = []
|
||||
l_trading_date = []
|
||||
l_ticker = []
|
||||
l_company = []
|
||||
l_insider = []
|
||||
l_title = []
|
||||
l_trade_type = []
|
||||
l_price = []
|
||||
l_quantity = []
|
||||
l_owned = []
|
||||
l_delta_own = []
|
||||
l_value = []
|
||||
|
||||
idx = 0
|
||||
for val in text_soup_open_insider.find_all("tbody")[1].find_all("td"):
|
||||
|
||||
@@ -52,7 +52,7 @@ class ResidualsController:
|
||||
|
||||
self.model_name: str = "None"
|
||||
self.model: pd.Series = None
|
||||
self.residuals: List[float] = list()
|
||||
self.residuals: List[float] = []
|
||||
|
||||
self.ra_parser = argparse.ArgumentParser(add_help=False, prog="ra")
|
||||
self.ra_parser.add_argument(
|
||||
|
||||
@@ -115,8 +115,8 @@ def historical(other_args: List[str], preset_loaded: str) -> List[str]:
|
||||
else:
|
||||
screen.set_filter(filters_dict=d_filters)
|
||||
|
||||
l_min = list()
|
||||
l_leg = list()
|
||||
l_min = []
|
||||
l_leg = []
|
||||
plt.figure(figsize=plot_autoscale(), dpi=PLOT_DPI)
|
||||
|
||||
l_stocks = screen.ScreenerView(verbose=0)
|
||||
@@ -131,7 +131,7 @@ def historical(other_args: List[str], preset_loaded: str) -> List[str]:
|
||||
print(", ".join(l_stocks))
|
||||
|
||||
while l_stocks:
|
||||
l_parsed_stocks = list()
|
||||
l_parsed_stocks = []
|
||||
for symbol in l_stocks:
|
||||
try:
|
||||
df_similar_stock = yf.download(
|
||||
|
||||
@@ -366,7 +366,7 @@ def load(
|
||||
|
||||
df_stock_candidate.sort_index(ascending=True, inplace=True)
|
||||
|
||||
new_index = list()
|
||||
new_index = []
|
||||
for idx in range(len(df_stock_candidate)):
|
||||
dt_time = datetime.strptime(
|
||||
df_stock_candidate.index[idx][1], "%H:%M"
|
||||
|
||||
@@ -34,7 +34,7 @@ def plot_pattern_recognition(ticker: str, resolution: str, export: str):
|
||||
pattern,
|
||||
)
|
||||
|
||||
l_segments = list()
|
||||
l_segments = []
|
||||
for i in pattern:
|
||||
a_part = ("", "")
|
||||
if "aprice" in pattern[i]:
|
||||
|
||||
@@ -48,7 +48,7 @@ def get_tradingview_recommendation(
|
||||
|
||||
if not interval:
|
||||
df_recommendation = pd.DataFrame()
|
||||
index_recommendation = list()
|
||||
index_recommendation = []
|
||||
for interv in ["1M", "1W", "1d", "4h", "1h", "15m", "5m", "1m"]:
|
||||
# If the returned data was successful
|
||||
if result.status_code == 200:
|
||||
|
||||
@@ -63,7 +63,7 @@ class ThoughtOfTheDay:
|
||||
"div"
|
||||
)
|
||||
|
||||
page_count = list()
|
||||
page_count = []
|
||||
for a_page_ref in find_navigation.find_all("a", href=True):
|
||||
page_count.append(a_page_ref.text.strip("\n"))
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ from gamestonk_terminal.cryptocurrency.due_diligence.pycoingecko_model import Co
|
||||
def get_bitcoin(mock_load):
|
||||
# pylint: disable=unused-argument
|
||||
print(os.getcwd())
|
||||
with open("tests/data/btc_usd_test_data.json") as f:
|
||||
with open("tests/data/btc_usd_test_data.json", encoding="utf8") as f:
|
||||
sample_return = json.load(f)
|
||||
mock_load.return_value = sample_return
|
||||
return dd_pycoingecko_view.load(["-c", "bitcoin"])
|
||||
@@ -54,7 +54,7 @@ class TestCoinGeckoAPI(TestCase):
|
||||
Mock returns a dict saved as .json
|
||||
"""
|
||||
|
||||
with open("tests/data/btc_usd_test_data.json") as f:
|
||||
with open("tests/data/btc_usd_test_data.json", encoding="utf8") as f:
|
||||
sample_return = json.load(f)
|
||||
|
||||
mock_load.return_value = sample_return
|
||||
|
||||
@@ -34,7 +34,7 @@ def mocked_requests_get(*args, **kwargs):
|
||||
|
||||
base = "https://www.alphavantage.co/query?function="
|
||||
if args[0] == f"{base}OVERVIEW&symbol=GME&apikey={cfg.API_KEY_ALPHAVANTAGE}":
|
||||
with open("tests/data/json/fa_av_overview.json") as f:
|
||||
with open("tests/data/json/fa_av_overview.json", encoding="utf8") as f:
|
||||
data = json.load(f)
|
||||
return MockResponse(data, 200)
|
||||
|
||||
@@ -42,22 +42,22 @@ def mocked_requests_get(*args, **kwargs):
|
||||
args[0]
|
||||
== f"{base}INCOME_STATEMENT&symbol=GME&apikey={cfg.API_KEY_ALPHAVANTAGE}"
|
||||
):
|
||||
with open("tests/data/json/fa_av_income.json") as f:
|
||||
with open("tests/data/json/fa_av_income.json", encoding="utf8") as f:
|
||||
data = json.load(f)
|
||||
return MockResponse(data, 200)
|
||||
|
||||
if args[0] == f"{base}BALANCE_SHEET&symbol=GME&apikey={cfg.API_KEY_ALPHAVANTAGE}":
|
||||
with open("tests/data/json/fa_av_balance.json") as f:
|
||||
with open("tests/data/json/fa_av_balance.json", encoding="utf8") as f:
|
||||
data = json.load(f)
|
||||
return MockResponse(data, 200)
|
||||
|
||||
if args[0] == f"{base}CASH_FLOW&symbol=GME&apikey={cfg.API_KEY_ALPHAVANTAGE}":
|
||||
with open("tests/data/json/fa_av_cash.json") as f:
|
||||
with open("tests/data/json/fa_av_cash.json", encoding="utf8") as f:
|
||||
data = json.load(f)
|
||||
return MockResponse(data, 200)
|
||||
|
||||
if args[0] == f"{base}EARNINGS&symbol=GME&apikey={cfg.API_KEY_ALPHAVANTAGE}":
|
||||
with open("tests/data/json/fa_av_earnings.json") as f:
|
||||
with open("tests/data/json/fa_av_earnings.json", encoding="utf8") as f:
|
||||
data = json.load(f)
|
||||
return MockResponse(data, 200)
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class TestFaYieldCurveModel:
|
||||
expected_result,
|
||||
):
|
||||
|
||||
rets = list()
|
||||
rets = []
|
||||
for a_ret in mock_get_yield_curve_year_rets:
|
||||
rets.append(
|
||||
pd.read_csv(StringIO(a_ret), header=0, index_col=0, parse_dates=True)
|
||||
|
||||
Reference in New Issue
Block a user