mirror of
https://github.com/OpenBB-finance/OpenBB.git
synced 2026-10-27 12:40:35 +00:00
Adding identification of exceptions
This commit is contained in:
@@ -54,7 +54,7 @@ confidence=
|
||||
# disable=import-error,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call
|
||||
# disable=too-many-instance-attributes,len-as-condition,too-few-public-methods,anomalous-backslash-in-string,no-else-return,simplifiable-if-statement,too-many-arguments,duplicate-code,no-name-in-module,no-member,print-statement,parameter-unpacking,unpacking-in-except,old-raise-syntax,backtick,long-suffix,old-ne-operator,old-octal-literal,import-star-module-level,raw-checker-failed,bad-inline-option,locally-disabled,locally-enabled,file-ignored,suppressed-message,useless-suppression,deprecated-pragma,apply-builtin,basestring-builtin,buffer-builtin,cmp-builtin,coerce-builtin,execfile-builtin,file-builtin,long-builtin,raw_input-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,no-absolute-import,old-division,dict-iter-method,dict-view-method,next-method-called,metaclass-assignment,indexing-exception,raising-string,reload-builtin,oct-method,hex-method,nonzero-method,cmp-method,input-builtin,round-builtin,intern-builtin,unichr-builtin,map-builtin-not-iterating,zip-builtin-not-iterating,range-builtin-not-iterating,filter-builtin-not-iterating,using-cmp-argument,eq-without-hash,div-method,idiv-method,rdiv-method,exception-message-attribute,invalid-str-codec,sys-max-int,bad-python3-import,deprecated-string-function,deprecated-str-translate-call,import-error,missing-docstring,invalid-name,bad-whitespace,consider-using-enumerate,unexpected-keyword-arg
|
||||
|
||||
disable=useless-return,missing-docstring,invalid-name,import-error,bad-continuation
|
||||
disable=useless-return,missing-docstring,invalid-name,import-error,bad-continuation,broad-except
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
@@ -74,7 +74,7 @@ evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / stateme
|
||||
|
||||
# Template used to display messages. This is a python new-style format string
|
||||
# used to format the message information. See doc for all details
|
||||
msg-template='{path} {line}: {msg} ({symbol})'
|
||||
msg-template='{path} {line}: {msg_id} {msg} ({symbol})'
|
||||
|
||||
# Set the output format. Available formats are text, parseable, colorized, json
|
||||
# and msvs (visual studio).You can also give a reporter class, eg
|
||||
|
||||
@@ -107,7 +107,7 @@ def due_diligence(l_args, s_ticker):
|
||||
s_datetime = datetime.utcfromtimestamp(
|
||||
submission.created_utc
|
||||
).strftime("%d/%m/%Y %H:%M:%S")
|
||||
s_link = f"https://www.reddit.com{submission.permalink}"
|
||||
s_link = f"https://old.reddit.com{submission.permalink}"
|
||||
s_all_awards = ""
|
||||
for award in submission.all_awardings:
|
||||
s_all_awards += f"{award['count']} {award['name']}\n"
|
||||
@@ -172,5 +172,6 @@ def due_diligence(l_args, s_ticker):
|
||||
# df_submissions = pd.DataFrame.from_dict(d_submission, orient='index', columns=list(d_submission[next(iter(d_submission.keys()))].keys()))
|
||||
# df_submissions.sort_values(by=['created_utc'], inplace=True, ascending=True)
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
|
||||
@@ -41,7 +41,8 @@ def profile(l_args, s_ticker):
|
||||
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
return
|
||||
|
||||
@@ -90,7 +91,8 @@ def quote(l_args, s_ticker):
|
||||
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
return
|
||||
|
||||
@@ -157,7 +159,8 @@ def enterprise(l_args, s_ticker):
|
||||
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
return
|
||||
|
||||
@@ -223,7 +226,8 @@ def discounted_cash_flow(l_args, s_ticker):
|
||||
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
return
|
||||
|
||||
@@ -303,7 +307,8 @@ def income_statement(l_args, s_ticker):
|
||||
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
return
|
||||
|
||||
@@ -391,7 +396,8 @@ def balance_sheet(l_args, s_ticker):
|
||||
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
return
|
||||
|
||||
@@ -474,7 +480,8 @@ def cash_flow(l_args, s_ticker):
|
||||
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
return
|
||||
|
||||
@@ -560,7 +567,8 @@ def key_metrics(l_args, s_ticker):
|
||||
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
return
|
||||
|
||||
@@ -644,7 +652,8 @@ def financial_ratios(l_args, s_ticker):
|
||||
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
return
|
||||
|
||||
@@ -726,6 +735,7 @@ def financial_statement_growth(l_args, s_ticker):
|
||||
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
return
|
||||
|
||||
@@ -216,7 +216,8 @@ def watchlist(l_args):
|
||||
print(s_watchlist_tickers[:-2] + "\n")
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
|
||||
|
||||
@@ -379,7 +380,8 @@ def popular_tickers(l_args):
|
||||
print("No tickers found")
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
|
||||
|
||||
@@ -556,7 +558,8 @@ def spac_community(l_args):
|
||||
print(s_watchlist_tickers[:-2])
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
|
||||
|
||||
@@ -756,7 +759,8 @@ def spac(l_args):
|
||||
print(s_watchlist_tickers[:-2])
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
|
||||
|
||||
@@ -880,5 +884,6 @@ def wsb_community(l_args):
|
||||
else:
|
||||
break
|
||||
print("")
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
import argparse
|
||||
from datetime import datetime, timedelta
|
||||
import requests
|
||||
import dateutil
|
||||
import pandas as pd
|
||||
import re
|
||||
import numpy as np
|
||||
import flair
|
||||
import matplotlib.pyplot as plt
|
||||
import iso8601
|
||||
import dateutil
|
||||
from gamestonk_terminal import config_terminal as cfg
|
||||
from gamestonk_terminal.helper_funcs import *
|
||||
from gamestonk_terminal.helper_funcs import get_data, clean_tweet
|
||||
|
||||
|
||||
# ------------------------------------------------- INFERENCE -------------------------------------------------
|
||||
def inference(l_args, s_ticker):
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="infer",
|
||||
description="""Print quick sentiment inference from last tweets that contain
|
||||
the ticker. This model splits the text into character-level
|
||||
tokens and uses the DistilBERT model to make predictions. DistilBERT is a distilled
|
||||
version of the powerful BERT transformer model. Not only time period of these,
|
||||
but also frequency. [Source: Twitter]""",
|
||||
description="""
|
||||
Print quick sentiment inference from last tweets that contain the ticker.
|
||||
This model splits the text into character-level tokens and uses the DistilBERT
|
||||
model to make predictions. DistilBERT is a distilled version of the powerful
|
||||
BERT transformer model. Not only time period of these, but also frequency. [Source: Twitter]
|
||||
""",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
@@ -110,6 +111,12 @@ def inference(l_args, s_ticker):
|
||||
print(f"From: {dt_from.strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
print(f"To: {dt_to.strftime('%Y-%m-%d %H:%M:%S')}")
|
||||
|
||||
# pd.set_option("display.max_rows", None)
|
||||
# pd.set_option("display.max_columns", None)
|
||||
# pd.set_option("display.width", None)
|
||||
# pd.set_option("display.max_colwidth", None)
|
||||
# print(df_tweets)
|
||||
|
||||
print(f"{len(df_tweets)} tweets were analyzed.")
|
||||
dt_delta = dt_to - dt_from
|
||||
n_freq = dt_delta.total_seconds() / len(df_tweets)
|
||||
@@ -120,7 +127,8 @@ def inference(l_args, s_ticker):
|
||||
print(f"The sentiment of {s_ticker} is: {s_sen} ({s_conf})")
|
||||
print("")
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
|
||||
|
||||
@@ -128,12 +136,14 @@ def inference(l_args, s_ticker):
|
||||
def sentiment(l_args, s_ticker):
|
||||
parser = argparse.ArgumentParser(
|
||||
prog="sen",
|
||||
description="""Plot in-depth sentiment predicted from tweets from last days
|
||||
that contain pre-defined ticker. This model splits the text into character-level
|
||||
tokens and uses the DistilBERT model to make predictions. DistilBERT is a distilled
|
||||
version of the powerful BERT transformer model. Note that a big num of tweets extracted per
|
||||
hour in conjunction with a high number of days in the past, will make the
|
||||
algorithm take a long period of time to estimate sentiment. [Source: Twitter]""",
|
||||
description="""
|
||||
Plot in-depth sentiment predicted from tweets from last days
|
||||
that contain pre-defined ticker. This model splits the text into character-level
|
||||
tokens and uses the DistilBERT model to make predictions. DistilBERT is a distilled
|
||||
version of the powerful BERT transformer model. Note that a big num of tweets extracted per
|
||||
hour in conjunction with a high number of days in the past, will make the
|
||||
algorithm take a long period of time to estimate sentiment. [Source: Twitter]
|
||||
""",
|
||||
)
|
||||
|
||||
# in reality this argument could be 100, but after testing it takes too long to compute which may not be acceptable
|
||||
@@ -386,5 +396,6 @@ def sentiment(l_args, s_ticker):
|
||||
plt.xlabel("Time")
|
||||
plt.show()
|
||||
|
||||
except:
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print("")
|
||||
|
||||
Reference in New Issue
Block a user